奇迹h5 直接开通内购方法,在页面内点击各种购买按钮直接购买成功,不需要再进行其他的操作了。
貌似没有对应扣费,有能力自行修改。
可以单独加一个RMB字段用来扣费,不过充值就几项,其他的特权开通项目比较多,要单独找出来对应扣费,还是要花点功夫,不晓得有没类似需求,这样GM直接给玩家充值RMB,玩家用RMB直接在游戏内进行内购操作。
1.找到/www/wwwroot/game/mkhf/api/ybStatus.php
里面内容替换:
<?php header("Content-type:text/html;charset=utf-8"); ini_set('date.timezone','Asia/Shanghai'); include_once("../../cfg.php"); @$openId = trim($_GET['openId']); @$appid = trim($_GET['appid']); @$pfParam = trim($_GET['pfParam']); @$serverId = trim($_GET['serverId']); @$payName = trim($_GET['payName']); @$itemid = trim($_GET['itemid']); $qufu=$server_list[$serverId]; $qufu_db=$qufu["dbname"]; $data = [ "code"=>"200", "msg"=>urlencode ("开通成功"), ]; @$mysqli = new mysqli($config['host'],$config['root'],$config['pass'],$config['dbname'],$config['port']); //第一步查询用户信息 $sql = "SELECT * FROM `h5`.`account` WHERE `id`={$appid} LIMIT 1"; $row = $mysqli->query($sql); if($row && $row->num_rows > 0){ $ret = $row->fetch_array(1); $account=$ret['account']; $sql="SELECT `actorid` FROM $qufu_db.`actors` WHERE `accountname` = '${account}'"; $row = $mysqli->query($sql); if($row && $row->num_rows > 0){ $actorid=$row->fetch_array(1)['actorid']; //第二步判断payName 发送对应邮件 if(strpos($payName,'充值') !== false){ //充值: $sql="insert into $qufu_db.feecallback(serverid,openid,itemid,actor_id) values ('{$serverId}','{$account}','{$itemid}','{$actorid}')"; $mysqli->query($sql); $data['msg'] = urlencode ("充值成功"); }else{ //开通: $sql="insert into $qufu_db.feecallback(serverid,openid,itemid,actor_id) values ('{$serverId}','{$account}','{$itemid}','{$actorid}')"; $mysqli->query($sql); } }else{ $data['code'] = "500"; $data['msg'] = urlencode ("角色不存在"); } }else{ $data['code'] = "500"; $data['msg'] = urlencode ("账号不存在"); } exit(urldecode(json_encode($data))); ?>
2.找到/www/wwwroot/game/ver/209/entry.min.js 搜索 t.prototype.checkShowRecharge
对应代码替换成下面的
t.prototype.checkShowRecharge = function (t) { return __awaiter(this, void 0, void 0, function () { var e, r, n, o; return __generator(this, function (i) { switch (i.label) { case 0: e = this.getRechargeStateUrl(); if(e){ this.getHttp(e+"&payName="+t.itemName+"&itemid="+t.yb).then( (res)=>{ const result =JSON.parse(res); console.log(result) if(result.code == "500"){ window.platform.alert(result.msg) }else { if(result.msg == "充值成功"){ window.platform.alert("充值成功"); }else if(result.msg == "开通成功"){ window.platform.alert("开通成功"); } } }, (err)=>{ window.platform.alert("请求失败") } ); } return e ? [4] : [3, 2]; case 1: return r = i.sent(), n = JSON.parse(r), o = 1 == n[-1], o ? (this.alert(LangEntry.str12.replace("$name$", "")), [2, !1]) : 1 === n[t.yb] ? (this.alert(LangEntry.str12.replace("$name$", t.itemName)), [2, !1]) : [2, !0]; case 2: return [2, !0]; case 3: return [2] } }) }) },
3.清楚本地缓存重新加载即可
或者直接下载改好的文件覆盖
修改好的内购文件 下载
记得修改 /www/wwwroot/game/ver/209/entry.min.js 里面的IP(192.168.200.129)为你的实际IP
本文由网上采集发布,不代表我们立场,转载联系作者并注明出处:https://www.90175.com/wenku/txtlist_i115v.html