| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881 |
- <?php
- namespace app\api\controller;
- use app\api\controller\v1\PayNotify;
- use app\service\PayService;
- use think\Config;
- use think\Console;
- use think\console\Input;
- use think\console\Output;
- use think\Controller;
- use think\Db;
- use app\common\library\WeixinPay;
- class Index extends Controller
- {
- public function sywpay(){
- die;
- $wxPay = new WeixinPay();
- // $params['appid'] = Config::get('wxpay-h5')['app_id'];
- // $params['mch_id'] = Config::get('wxpay-h5')['mch_id'];
- $params['appid'] = 'wxf6d1543cec2dfa53';
- $params['mch_id'] = '1675127018';
- $params['sub_mch_id'] = '1726067763';
- $params['nonce_str'] = random(10);
- $params['body'] = '测试商品描述';
- $params['out_trade_no'] = "DT". time(). mt_rand(10000000,99999999);
- $params['total_fee'] = 1; // 支付金额,以分为单位
- $params['spbill_create_ip'] = request()->ip();
- // $params['spbill_create_ip'] = '115.195.83.99';
- $params['notify_url'] = 'http://sdkapi.newsdk.com/pay.php';
- $params['trade_type'] = 'MWEB';
- // $params['scene_info'] = '{"h5_info":{"type":"Wap","wap_url":"'.$wap_url.'","wap_name":"祈盟"}}';
- $params['scene_info'] = '{"h5_info":{"type":"Wap","wap_url":"http://sdkapi.newsdk.com","wap_name":"祈盟"}}';
- //获取签名数据
- // $params['sign'] = $wxPay->MakeSign($params, Config::get('wxpay-h5')['key']);
- $params['sign'] = $wxPay->MakeSign($params, '66052a198653943dbc6c8032f1a40a9c');
- $xml = dataToXml($params);
- $response = $wxPay->postXmlCurl($xml, 'https://api.mch.weixin.qq.com/v3/pay/partner/transactions/h5');
- dump($response);
- $result = $wxPay->xmlToArray($response);
- }
- public function index()
- {
- // echo phpinfo();
- // $return_arr['mweb_url'] = 'http://sdkapi.46yx.com';
- // $return_url = 'https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx05112758904301e15b6b8e875970b00000&package=2416986125';
- // header("location:" . $return_arr['mweb_url'] . "&redirect_url={$return_url}");
- // return json_encode(["code" => 200, "message" => "HELLO API!", "data" => ""]);
- $gameid = input('gameid');
- if(!$gameid){
- return json_encode(["code" => 200, "message" => "HELLO API!", "data" => ""]);
- }
- $userAgent = $_SERVER["HTTP_USER_AGENT"];
- if((stripos($userAgent, "iPhone") !== false || stripos($userAgent, "iPad") !== false)){
- $gameIds = Config::get('ios_jump_game');
- if(array_key_exists($gameid, $gameIds)){
- header("location: ". $gameIds[$gameid]);
- }
- echo "请联系开发配置当前游戏跳转!";
- }
- }
- // TODO:媒体对接测试(可删)
- public function mediaTest(){
- $input = input();
- log_message('input:' . json_encode($input), 'log', LOG_PATH . 'mediaTest/');
- $msg = "\n input=". json_encode($input) ." , \n date: ".date('Y-m-d H:i:s', time())." \n";
- curlDD($msg,"https://oapi.dingtalk.com/robot/send?access_token=e129a024173c56f193a6343012edd4072cb8f1d1a771a72ca126fcfa4d521ba8");
- return "success";
- }
- public function transpondUrlAction()
- {
- // $url = $request->get("url"); // 获取接口传入需要转发的url注意需要用url编码。由于基于Symfony框架实现$request可以直接获取url参数,原生可用$_GET['url']代替
- $url = 'https://wx.tenpay.com/cgi-bin/mmpayweb-bin/checkmweb?prepay_id=wx05112758904301e15b6b8e875970b00000&package=2416986125';
- $userAgent = $this->getAgent('user-agent');
- if (empty($url) or $url == "") return false;
- if (empty($userAgent)) $userAgent = $this->getAgent();
- $ch = curl_init();
- if (preg_match("/^https:\\/\\/.+/", $url)) {
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- }
- $cip = '125.77.44.84';
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
- @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 60);
- curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
- // curl_setopt ($ch, CURLOPT_COOKIEJAR, './cookie.txt'); // cookie日志
- // 微信Wap支付需要伪造请求头Referer该参数,该参数需设置与微信支付配置都安全域名一致
- curl_setopt($ch, CURLOPT_REFERER, "http://sdkapi.46yx.com");
- curl_setopt($ch, CURLOPT_HTTPHEADER, ["CLIENT-IP:$cip"]);// 这里需要设置客户端的Ip地址,用于伪造请求IP地址
- curl_setopt($ch, CURLOPT_HEADER, 1); //显示返回的HEAD区域的内容
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($ch, CURLOPT_TIMEOUT, 10);
- $result = curl_exec($ch);
- curl_close($ch);
- var_dump($result);
- }
- public function getAgent()
- {
- $agentarry = [
- "iPhone11" => "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.18 NetType/WIFI Language/en",
- "华为P9全网通" => "Mozilla/5.0 (Linux; Android 7.0; EVA-AL00 Build/HUAWEIEVA-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 MicroMessenger/6.5.13.1100 NetType/WIFI Language/zh_CN",
- "小米5X" => "Mozilla/5.0 (Linux; U; Android 7.1.2; zh-cn; MI 5X Build/N2G47H) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.146 Mobile Safari/537.36 XiaoMi/MiuiBrowser/9.2.2",
- "一加手机3" => "Mozilla/5.0 (Linux; Android 7.1.1; ONEPLUS A3000 Build/NMF26F; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 MicroMessenger/6.5.13.1100 NetType/WIFI Language/zh_CN",
- "努比亚Z11" => "Mozilla/5.0 (Linux; U; Android 6.0.1; zh-cn; NX531J Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 Chrome/37.0.0.0 MQQBrowser/6.8 Mobile Safari/537.36",
- "小米5s" => "Mozilla/5.0 (Linux; Android 6.0.1; MI 5s Build/MXB48T; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 V1_AND_SQ_7.2.0_730_YYB_D QQ/7.2.0.3270 NetType/WIFI WebP/0.3.0 Pixel/1080",
- "华为nova" => "Mozilla/5.0 (Linux; Android 7.0; HUAWEI CAZ-AL10 Build/HUAWEICAZ-AL10; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 V1_AND_SQ_7.1.0_692_YYB_D QQ/7.1.0.3175 NetType/WIFI WebP/0.3.0 Pixel/1080",
- "联想ZUK Z2 Pro" => "Mozilla/5.0 (Linux; Android 7.0; ZUK Z2121 Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 V1_AND_SQ_7.2.0_730_YYB_D QQ/7.2.0.3270 NetType/4G WebP/0.3.0 Pixel/1080",
- "魅蓝note 3" => "Mozilla/5.0 (Linux; Android 5.1; m3 note Build/LMY47I; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 Mobile Safari/537.36 T7/9.3 baiduboxapp/9.3.0.10 (Baidu; P1 5.1)",
- "三星GALAXY S8+" => "Mozilla/5.0 (Linux; U; Android 7.0; zh-CN; SM-G9550 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.7.0.953 Mobile Safari/537.36",
- "魅族MX6 " => "Mozilla/5.0 (Linux; Android 6.0; MX6 Build/MRA58K; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.49 Mobile MQQBrowser/6.2 TBS/043508 Safari/537.36 MicroMessenger/6.5.13.1100 NetType/4G Language/zh_CN",
- "vivo Xplay5A" => "Mozilla/5.0 (Linux; Android 5.1.1; vivo Xplay5A Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 Mobile Safari/537.36 T7/9.3 baiduboxapp/9.3.0.10 (Baidu; P1 5.1.1)",
- "三星GALAXY C7" => "Mozilla/5.0 (Linux; U; Android 6.0.1; zh-CN; SM-C7000 Build/MMB29M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.6.2.948 Mobile Safari/537.36",
- "三星GALAXY S8" => "Mozilla/5.0 (Linux; U; Android 7.0; zh-CN; SM-G9500 Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.7.0.953 Mobile Safari/537.36",
- "荣耀8青春版" => "Mozilla/5.0 (Linux; U; Android 7.0; zh-CN; PRA-AL00 Build/HONORPRA-AL00) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.7.0.953 Mobile Safari/537.36",
- "UCOpenwave" => "Openwave/ UCWEB7.0.2.37/28/999",
- "UC Opera" => "Mozilla/4.0 (compatible; MSIE 6.0; ) Opera/UCWEB7.0.2.37/28/999",
- "小米4S" => "Mozilla/5.0 (Linux; U; Android 5.1.1; zh-cn; MI 4S Build/LMY47V) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/53.0.2785.146 Mobile Safari/537.36 XiaoMi/MiuiBrowser/9.1.3",
- "OPPO R12" => "Mozilla/5.0 (Linux; U; Android 7.1.1; zh-CN; OPPO R11 Build/NMF26X) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/40.0.2214.89 UCBrowser/11.7.0.953 Mobile Safari/537.36",
- "iPhone2" => "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60 MicroMessenger/6.5.7 NetType/WIFI Language/zh_CN",
- ];
- return $agentarry[array_rand($agentarry, 1)];
- }
- // ## 短信验证码
- private function encode($str)
- {
- $res = urlencode($str);
- $res = preg_replace("/\+/", "%20", $res);
- $res = preg_replace("/\*/", "%2A", $res);
- $res = preg_replace("/%7E/", "~", $res);
- return $res;
- }
- private function fetchContent($url, $method, $body)
- {
- $ch = curl_init();
- if ($method == 'POST') {
- curl_setopt($ch, CURLOPT_POST, 1);//post提交方式
- curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
- } else {
- $url .= '?' . $body;
- }
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_TIMEOUT, 5);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- "x-sdk-client" => "php/2.0.0"
- ));
- if (substr($url, 0, 5) == 'https') {
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
- }
- $rtn = curl_exec($ch);
- if ($rtn === false) {
- // 大多由设置等原因引起,一般无法保障后续逻辑正常执行,
- // 所以这里触发的是E_USER_ERROR,会终止脚本执行,无法被try...catch捕获,需要用户排查环境、网络等故障
- trigger_error("[CURL_" . curl_errno($ch) . "]: " . curl_error($ch), E_USER_ERROR);
- }
- curl_close($ch);
- return $rtn;
- }
- public function senCode(){
- $accessKeyId = 'LTAI5tMnwbRaFFNegZABs1i9';
- $accessKeySecret = '1AFchDeuPoytXzcCD8HUU4gsMizwn3';
- $params = [
- 'PhoneNumbers' => '13121776520',
- 'SignName' => '祈盟',
- 'TemplateCode' => 'SMS_496015161',
- 'TemplateParam' => json_encode(['name' => '顾长歌', 'money' => 999], JSON_UNESCAPED_UNICODE),
- ];
- $params = array_merge($params, [
- "RegionId" => "cn-hangzhou",
- "Action" => "SendSms",
- "Version" => "2017-05-25",
- ]);
- $apiParams = array_merge([
- "SignatureMethod" => "HMAC-SHA1",
- "SignatureNonce" => uniqid(mt_rand(0,0xffff), true),
- "SignatureVersion" => "1.0",
- "AccessKeyId" => $accessKeyId,
- "Timestamp" => gmdate("Y-m-d\TH:i:s\Z"),
- "Format" => "JSON",
- ], $params);
- // dump($apiParams);
- ksort($apiParams);
- $sortedQueryStringTmp = "";
- foreach ($apiParams as $key => $value) {
- $sortedQueryStringTmp .= "&" . $this->encode($key) . "=" . $this->encode($value);
- }
- $stringToSign = "POST&%2F&" . $this->encode(substr($sortedQueryStringTmp, 1));
- $sign = base64_encode(hash_hmac("sha1", $stringToSign, $accessKeySecret . "&",true));
- $signature = $this->encode($sign);
- $content = $this->fetchContent("http://dysmsapi.aliyuncs.com/", "POST", "Signature={$signature}{$sortedQueryStringTmp}");
- dump($content);
- }
- public function pay(){
- die;
- // 根据域名获取发起支付URL
- // http://devsdkapi.youxi9.com/test_pay?customMoney=1
- // http://devsdkapi.qmgames.cn/test_pay?customMoney=1
- // http://sdkapi.newsdk.com/test_pay?customMoney=1
- // http://sdkapi.newsdk.com/test_pay
- // 根据URL做跳转
- // $pay_url = input('pay_url');
- // if($pay_url){
- // $this->assign('pay_url', $pay_url);
- // return $this->fetch();
- // }else{
- // 直接生成订单,发起支付
- $pay = new PayService();
- $notify_url = Config::get('wxpay-h5')['notify_url'];
- $ip = $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
- $orderid = 'DT'. time(). mt_rand(10000000,99999999);
- $payInfoRes = $pay->getWxpayH5Param($orderid, 1, "测试商品", $ip, $notify_url);
- $pay_url = "http://devsdkapi.youxi9.com/test_pay?pay_url=".$payInfoRes['data']['mweb_url'];
- // header("Location: {$pay_url}");
- // }
- $this->assign('pay_url', $pay_url);
- return $this->fetch();
- }
- public function notify(){
- // 根据域名获取发起支付URL
- // http://sdkapi.newsdk.com/notify
- // $input = '{"gmt_create":"2026-04-16 20:33:08","charset":"utf-8","seller_email":"coolpads@126.com","notify_time":"2026-04-16 22:30:48","subject":"\u7279\u60e0\u793c\u5305","sign":"YsAqB42sE4rXglnlAo0rls1RaeP8xyznILR55y+IUK8oge2ktIBI+N9YqUu+GzOIomMzO5yhnMWvrdG\/xUa+Usop6gJZOPAYDpUON8pmYWunRoPWr9b1vEh+hVQFMxM4rQePyDx3e7gJ8GlpxEgrGohjJt2XETQyOSxKIXyRkENFKNxW93KwLp4gKNcLvB\/NutK4schqNtBaTuXrWIUX07bMDq7PAlzG7iOnFuNoouLwEAgMKHuzUSawgs7eD40No3FoDRZzJIhehyca9ZNTjGfMU\/dNF\/FOg+QHuyEmK6tvDICRYkwHOIQ0w099W\/1ToXyLp4aoYZMrq5HpQ+Y\/gA==","buyer_id":"2088822405920853","version":"1.0","notify_id":"2026041601222210402020851433505728","notify_type":"trade_status_sync","out_trade_no":"WL17763427819316214057","total_amount":"10.50","refund_fee":"0.00","trade_status":"TRADE_CLOSED","trade_no":"2026041623001420851437484237","auth_app_id":"2021002136682180","buyer_logon_id":"177****2043","gmt_close":"2026-04-16 21:04:02","app_id":"2021002136682180","sign_type":"RSA2","seller_id":"2088141187506144"}';
- // $result = json_decode($input, true);
- // dump($result);
- // $orderid = 'DT'. time(). mt_rand(10000000,99999999);
- // $orderid = 'WL17769362780609203154';
- $orderid = 'WL17803075011896409072';
- $orderid = 'WL17803175979579639315';
- $refundData = [
- "out_trade_no" => $orderid, // 商户订单号
- // "order_no" => $order_no, // 交易流水号
- "out_refund_no" => $orderid.'_T', // 商户退款单号
- "refund_amount" => "0.01", // 退款金额(元)
- "refund_reason" => "订单已取消,系统自动退款处理", // 退款原因
- ];
- // $refundRsult = \app\common\factory\Pay::makeRefund('ali_pay', $refundData);
- // $refundRsult = \app\common\factory\Pay::makeQuery('xty_pay', $refundData);
- // $refundRsult = \app\common\factory\Pay::makeRefund('xty_pay', $refundData);
- // $refundRsult = \app\common\factory\Pay::makeQuery('qzl_pay', $refundData);
- $refundRsult = \app\common\factory\Pay::makeRefund('qzl_pay', $refundData);
- dump("notify: ", $refundRsult);
- }
- // 接口测试专用
- public function wen_test()
- {
- // http://sdkapi.newsdk.com/index/wen_test
- // // 调用系统内置命令,例如 optimize:schema
- // Console::call('ComplexSummaryGameServer', ['day'=>'2025-12-21']);
- // // // 调用自定义命令,并传参
- // $input = new Input(['day', '2025-12-17']);
- // $output = new Output();
- // Console::call('ComplexSummaryComplex', $input->getArguments(), $output);
- // // 获取命令输出内容
- // echo $output->fetch();
- // die;
- // dump(strtotime("2025-10-30 23:59:59"));
- // dump(date("Y-m-d H:i:s", 1761799926), date("Y-m-d H:i:s", 1761809613));
- // ## Hi支付测试
- $payData = [
- 'productname' => '测试商品',
- 'attach' => 'DT'. time(). mt_rand(10000000, 99999999),
- 'amount' => 0.01,
- 'notify_url' => 'http://devsdkapi.qmgames.cn/payNotify',
- ];
- $pay = new PayService();
- $result = $pay->getSywPayParam($payData, 'wxh5');
- // dump($result);
- dump("http://qmpay.youxi9.com/?orderid=".$payData['attach']."&payurl=".$result['data']['mweb_url']);
- // header("Location: " . $result['data']);
- $mweb_url = $result['data'];
- // $this->assign('data', $result['data']);
- // $this->fetch();
- // die;
- // $res = (new HandleService())->getCacheGiftNum();
- // dump($res);
- // ## 短信
- // config('ALI_SMS.channelAdvanceMobile')
- // $result = (new \app\common\library\Sms)->sendNotify('13121776520', 'SMS_496015161', ['name' => 'xxx', 'money' => 999]);
- // dump($result);
- // ## 发起支付测试
- // $orderid = makeOrderid();
- // $notify_url = Config::get('wxpay-h5')['notify_url'];
- // $result = (new PayService)->getHipayWxpayH5Param($orderid, 0.01, $notify_url, '测试商品', request()->ip(), 10);
- // dump($result);
- // ## 旅人三区活动
- // $res = (new LvRenSdk())->sendRewards('103523_stable', '10082', '1008200125959', '250225', '1'); // 发放集结礼包
- // $res = (new LvRenSdk())->getRoleList('103523_stable', '10082');
- // $res = (new LvRenSdk())->getTagAndValByRole('10082', '1008200125959'); // 获取角色活动标签
- // $res = (new LvRenSdk())->getRoleList('267973_stable', '10083'); // 账户角色数据
- // $res = (new LvRenSdk())->getTagAndValByRole('10083', '1008300003478'); // 获取角色活动标签
- // $res = (new LvRenSdk())->getRoleList('213910_stable', '10082');
- // $res = (new LvRenSdk())->getTagAndValByRole('10082', '1008100200674'); // 获取角色活动标签
- //
- // dump($res);
- // $res = Db::query("UPDATE `new_sdk`.`cy_members` SET `amount` = 4.5 WHERE `id` = 153196");
- // dump($res);
- // ## 订单号
- // dump(makeOrderid());
- // 加密
- // $password = auth_code('123456', "ENCODE", Env::get('auth_key'));
- //
- // dump(urlEncode('J3YrYmrn7cOLBjIubTOz5HavJg39G3C40T/voMiuvR2nSIt5LknEs4r+o+MwVWho57cSBzGjOcF/sTB4HjhF8/W9ol0'));
- // // 解密
- // $password1 = auth_code('msVNNwhwHMAs8wiDo5Y6p07mK/EGEcrq2iUQX0vfiGxQE7jjkqj/B50uKYQxEhnzPpbUB9Kh7C/j3tOl+n8aoRmOfL1+kDBHOmTs8y7WKnzjPUnCDbu85EJBnf+3l2JlkiByW/JkWkjAMCfZf7YK3ZbzuxE0xJmunQwAIFuP0+Hey9+L84Jz0da9XqQiBX49iJwyYJEed+NYSRL6sejjQTgoYLz1UosR3B2Kwvl+yEbDbpisGfYenT803n0kpkOOd5dgmISVI350kxYSQeu1PsvIwxXzBV+oZ+LCYO99sjiatNI66r+M0KKBQ9SM9/owr/FZEu7XdrbAKmevVlTfag==
- // ', "DECODE", Env::get('auth_key'));
- // dump($password1);
- // 获取支付的配置参数
- // $public_key = Config::get('ali_pay_config')['configs'][Config::get('ali_pay_config')['default']['zfb']]['public_key'];
- // dump($public_key);
- // dump(Config::get('ali_pay_config')['sign_type']);
- // 游戏订单回调签名生成 - 订单通知表: cy_paycpinfo
- // $str = "orderid=WL17683337938759161607&username=298960_stable&gameid=645&roleid=10924&serverid=4&paytype=xty_wx_h5&amount=98&paytime=1768333793&attach=%7B%22gameOrderId%22%3A7594935792166765171%7D&sign=608a8a8d93ed552406f0550f98a05897"; // 订单数据拿过来的时候,这里记得去除sign参数
- // $param = $str . "&appkey=d5bb829af0e9eb3b09f93f207c4a5364";
- // $md5params = md5($param);
- // $params = $str . "&sign=" . urlencode($md5params);
- // dump($params);
- // $params = [
- // "mer_id" => "55282",
- // "notify_url" => "http://xxx.xxx.com",
- // "amt_type" => "RMB",
- // "goods_inf" => "测试商品",
- // "order_id" => rand(0,
- // 999999999),
- // "mer_date" => date("Ymd"),
- // "amount" => "1",
- // // "user_ip" => "127.0.0.1",
- // "user_ip" => "115.196.65.151", // 要真实IP地址
- // "open_id" => "o0jap60RiBbxuKoiM1tWm2oyurxU",
- // "app_id" => "wx117849d0c0632d22",
- // "scancode_type" => "WECHAT",
- // "mer_flag" => "KMER",
- // ];
- // $service = new UmfService("55282");
- // $res = $service->miniProgramPayMap($params); // 小程序
- // // $res = $service->H5AutoConnectMap($params); // H5直连-范围URL地址
- // // $res = $service->H5ConnectMap($params); // H5直连-返回请求参数
- // dump($res);
- // $payData = [
- // 'productname' => '测试',
- // 'order_id' => makeOrderid(),
- // 'amount' => '1',
- // 'open_id' => $param['open_id'],
- // ];
- // // $result = (new LdysPay())->getWxmpPay($payData);
- // // $result = (new LdysPay())->getWxToekn($payData);
- // $result = (new LdysPay())->generateWxmpPayUrl();
- // dump($result);
- // $res = Db::query("UPDATE `new_sdk`.`cy_memberstwo` SET `realname` = '', `idcard` = '' WHERE `id` = 56557");
- // dump($res);
- // $jule = new Jule();
- // $data = [
- // 'account' => '{"user_code":"104471097","user_name":"jolo666","game_code":"3143016315883","session_id":"12842658","id":"1573633923000"}',
- // 'accountSign' => '13DersLTir22ofrzbxii4+N44gByUIZi6vg/ulP8ru9vid0GOY3sVvgSoAmBkNezKiUWEqei/gPrPERYUccbpM05yh1I4Bs81nunLx1GrlDl6FU3nPRzC4a8mtDbCcU3aZ+lzSXk/8ieymPXdrOMtq6ncmqgVf/jk2A8K151oXQ='
- // ];
- // $res = $jule->getSpecialParam($data);
- // dump($res);
- // ## 统计需要分包的相关游戏
- // 订单
- // $res = Db::query("select p.channel_id,p.gameid,g.nickname,SUM(p.amount) as sum_amount FROM cy_pay as p LEFT JOIN cy_game as g ON g.id=p.gameid where p.create_time BETWEEN 1704038400 AND 1711962953 GROUP BY p.gameid ORDER BY sum_amount desc");
- // 登陆
- // $res = Db::query("select * FROM nw_subaccount limit 1");
- // dump($res);
- // // APP 加固
- // $rsa = new RsaSign();
- // $str = '6f8ffbbc02059d05be0816953102f6cc425599';
- // $jiaMiRes = $rsa->openssl_public_encrypt($str);
- // $jieMiRes = $rsa->openssl_private_decrypt($jiaMiRes);
- //
- // // $jiaMiRes = $rsa->openssl_sign($str);
- // // $jieMiRes = $rsa->openssl_verify($str, $jiaMiRes);
- // dump($str, $jiaMiRes, $jieMiRes);
- // dump(json_encode(input()));
- // $sdk = new Yueyou();
- // $res = $sdk->getSpecialParam(['channel_token' => 'RT_7D535DFD85F94A2FBB01072C58610E68', 'time' => 1711079997], ['param' => '{"app_id":"1011","server_key":"rqejOC0Jep"}']);
- // dump($res);
- // 发送分包请求
- // $redis = Cache::init()->handler(); // 获取redis句柄
- // // $redis_value ='{"filename":"mubaoANDROID","channel_id":"5215","apktype":0,"extend":{"channel_version":13,"pinyin":"mubaoANDROID","channel_id":"5215","admin_id":1,"512pngUrl":"https:\/\/cdn.' . QM_DOMAIN_URL . '\/image\/game\/icons\/2023091416266502c3cc46898.png","bundleID":"com.qimeng.mubao","gameChineseName":"\u6bcd\u5305ANDROID"},"target_filename":"6601454dc8b90.apk","finish_notice_url":"http:\/\/admin.7dgames.cn\/upload_notify\/index\/game_id\/10\/channel_id\/5215\/adminid\/1\/apktype\/0.html"}';
- // $redis_value = '{"filename":"aaaaav1anzhuo","channel_id":"5215","apktype":0,"extend":{"channel_version":17,"pinyin":"aaaaav1anzhuo","channel_id":"5215","admin_id":1,"512pngUrl":"http:\/\/cdn.7dgame.cn\/","bundleID":"aaa.xxcc","gameChineseName":"aaaaa_v1(\u5b89\u5353)"},"target_filename":"66b46056b1b1d.apk","finish_notice_url":"http:\/\/admin.7dgames.cn\/upload_notify\/index\/game_id\/271\/channel_id\/5215\/adminid\/1\/apktype\/0.html","sign_ver":1}';
- // $res = $redis->lpush('aoyou:apk:subpackage:task', $redis_value);
- // dump($res);
- // ## 分包通知-ws
- // http://admin.7dgames.cn/upload_notify/makeExcelComplete?action=payList&adminid=1&file_path=https://static.7dgames.cn/excel_dev/20240806/充值记录管理导出_20240806144943_1.csv&time=1722926977
- // $ws = new Websocket();
- // $gamename = 'test'.'-'.'9527';
- // $str = '{"error_code":0,"data":{"action":"subpackageFinish","data":{"code":0,"gamename":"'.$gamename.'", "message":"分包完成!"}}}';
- // $res = $ws->sayToUid('1', $str);
- // dump($res);
- // $res = Db::query("SELECT * FROM `new_sdk`.`cy_members` where username='18947335139 '");
- // dump($res);
- // ## 代金卷使用通知
- // $res = (new \app\common\logic\YqlHandle())->notifyCoupon('206'); -- 弃用
- // $res = (new \app\api\controller\YqlData())->notifyCoupon('206');
- // dump($res);
- // 176 解密/加密
- // $a = strEncrypt("13","Su)sjKsu23G0slow");
- // var_dump('# $a: ', $a);
- // $a = 'd7afaff8a880a0fe535318299fdf80b5';
- // var_dump('# $b: ', strDecrypt($a,"Su)sjKsu23G0slow"));
- // $res = RSACryptUtil::encrypt(['xxx' => 'xxx']);
- // dump($res);
- // $signStr = sprintf('token=%s&userID=%s&key=%s', 'db733736e9613e42f81f69b4309b9dca', '13028121', '0adc300369494b5f9e195024b2bdefee');
- // $res = md5($signStr);
- // dump($signStr, $res);
- // 支付回调 - 微信H5
- // $res = '{"charset":"UTF-8","req_data":"{\"order_no\":\"1010317672024080718032424646\",\"pay_scene\":\"H5\",\"order_desc\":\"\u9053\u5177\",\"order_name\":\"\u9053\u5177\",\"pay_time\":\"20240807180351\",\"ch_order_no\":\"4200002304202408074418206630\",\"payer_account\":\"oAVOM6yBC6zrc8MdVXQAMQ9p4gyE\",\"out_trade_no\":\"WL17230250041470115375\",\"total_amount\":10,\"reserved\":\"\",\"ch_out_trade_no\":\"5150147638240807\",\"trade_status\":\"SUCCESS\",\"pay_channel\":\"WX\",\"payer_id\":\"oAVOM6yBC6zrc8MdVXQAMQ9p4gyE\"}","method":"trade.order.notify","app_id":"A17222309452323464","version":"1.0.1","sign_type":"RSA2","timestamp":"20240807180351"}';
- // 支付回调 - 支付宝H5
- // $res = '{"charset":"UTF-8","req_data":"{\"order_no\":\"1010317672024080718071324962\",\"pay_scene\":\"H5\",\"order_desc\":\"\u9053\u5177\",\"order_name\":\"\u9053\u5177\",\"pay_time\":\"20240807180752\",\"ch_order_no\":\"2024080722001456531440275398\",\"payer_account\":\"ahj***@163.com\",\"out_trade_no\":\"WL17230252337046293807\",\"total_amount\":10,\"reserved\":\"\",\"ch_out_trade_no\":\"705150165776240807\",\"trade_status\":\"SUCCESS\",\"pay_channel\":\"ALI\",\"payer_id\":\"2088022151356531\"}","method":"trade.order.notify","app_id":"A17222309452323464","version":"1.0.1","sign_type":"RSA2","timestamp":"20240807180753"}';
- // dump(json_decode($res));
- // ## TC-喜钛游 支付
- // $pay = new PayService();
- // $data = [
- // "orderid" => makeOrderid(),
- // "productname" => '道具',
- // "real_amount" => '0.01',
- // "notify_url" => Config::get('xty_pay')['notify']['notify_url'],
- // "ip" => request()->ip(),
- // ];
- // $payInfoRes = $pay->getXtyPayParam($data, 'payWxH5');
- // // $payInfoRes = $pay->getXtyPayParam($data, 'payAliH5');
- // dump($payInfoRes);
- // $randomList = [
- // ['pay_scene' => 'wx_h5', 'game_id' => 10, 'version' => 'v3.4.4'],
- // ['pay_scene' => 'wx_h5', 'game_id' => 266, 'version' => 'v3.4.4'],
- // ['pay_scene' => 'wx_h5', 'game_id' => 256, 'version' => 'v3.4.4'],
- // ['pay_scene' => 'wx_h5', 'game_id' => 20, 'version' => 'v3.4.3'],
- // ['pay_scene' => 'wx_h5', 'game_id' => 259, 'version' => 'v3.4.3'],
- // ];
- // $countNum = ['qzl_wx_h5' => 0, 'ldys_wx_h5' => 0, 'ybzf_wxmp_h5' => 0, 'yyyb_wx_h5' => 0, 'xty_wx_h5' => 0, 'qmf_wxmp_h5' => 0];
- // for ($i = 0; $i < 100; $i++) {
- // // $info =
- // // 随机获取$randomList数据总数中的一条
- // $data = $randomList[array_rand($randomList)];
- // $newPayType = (new PayHandle())->getPayChannel($data['pay_scene'], $data['game_id'], $data['version']);
- // $countNum[$newPayType['data']['paytype']] = $countNum[$newPayType['data']['paytype']] + 1;
- // echo "<br />" . $newPayType['data']['paytype'] . ' - ' . $data['game_id'];
- // }
- // dump($countNum);
- }
- // shop 测试订单生成
- public function wxPay()
- {
- $money = input('customMoney');
- if (!$money) {
- return json_encode(['code' => 0, 'msg' => '请输入金额!', 'data' => '']);
- }
- $title = input('title', '购买商品');
- $pay = new PayService();
- $notify_url = Config::get('wxpay-h5')['notify_url'];
- $ip = $_SERVER['REMOTE_ADDR'] ? $_SERVER['REMOTE_ADDR'] : '127.0.0.1';
- $payInfoRes = $pay->getWxpayH5Param(makeUniqueid('API'), $money, $title, $ip, $notify_url);
- if($payInfoRes['error'] == true){
- return json_encode(['data' => '', 'code' => 0, 'msg' => $payInfoRes['msg']]);
- }
- // $payInfoRes['data']['mweb_url'] = 'http://sdkapi.'.QM_DOMAIN_URL.'/jump?key=' . base64_encode($payInfoRes['data']['mweb_url']);
- // $payInfoRes['data']['mweb_url'] = 'http://devsdkapi.youxi9.com/jump?key=' . base64_encode($payInfoRes['data']['mweb_url']);
- return json_encode(['data' => $payInfoRes['data'], 'code' => 1, 'msg' => '订单生成成功']);
- }
- // 会长数据迁移
- public function migrate_hz(){
- $qy_id = input('qy_id', ''); // 迁移的会长
- $js_id = input('js_id', ''); // 接收会长
- if(!$qy_id || !$js_id){
- return json_encode(["code" => 100, "message" => "缺少迁移或接收会长", "data" => ""]);
- }
- // 迁移会长
- $qy_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id' => $qy_id, 'level' => 1])->find();
- $js_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id' => $js_id, 'level' => 1])->find();
- // $id_path = $info['id_path'].$info['id'].',';
- // ## 数据统计 ##
- // 子会长
- $qy_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $qy_id, 'level' => 2])->count();
- $js_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $js_id, 'level' => 2])->count();
- // dump($qy_child_count, $js_child_count);
- $qy_child_id_path = $qy_info['id_path'].$qy_info['id'].',';
- $js_child_id_path = $js_info['id_path'].$js_info['id'].',';
- // dump($qy_child_id_path, $js_child_id_path);
- // 推广员
- $qy_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$qy_child_id_path.'%'], 'level' => 3])->count();
- $js_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$js_child_id_path.'%'], 'level' => 3])->count();
- // dump($qy_promoter_count, $js_promoter_count);
- $statisticsData = [
- // 迁移
- 'qy' => [
- 'child_count' => $qy_child_count,
- 'promoter_count' => $qy_promoter_count,
- ],
- // 接收
- 'js' => [
- 'child_count' => $js_child_count,
- 'promoter_count' => $js_promoter_count,
- ],
- // 汇总
- 'hz' => [
- 'child_count' => $qy_child_count+$js_child_count,
- 'promoter_count' => $qy_promoter_count+$js_promoter_count,
- ],
- // 实际数据(处理后)
- 'sj' => [
- 'child_count' => 0,
- 'promoter_count' => 0,
- ],
- // 程序处理
- 'cx' => [
- 'child_count' => 0,
- 'promoter_count' => 0,
- ],
- ];
- // dump($statisticsData);
- // 子会长
- $child_list = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $qy_info['id'], 'level' => 2])->select();
- $child_list_ids = array_column($child_list, 'id');
- $child_sql = [];
- $child_count = 0;
- $promoter_count = 0;
- $id_path = $js_info['id_path'].$js_info['id'].',';
- foreach ($child_list as $v){
- $child_count++;
- $child_sql[] = [
- 'id' => $v['id'],
- 'parent_id' => $js_info['id'],
- 'id_path' => $id_path,
- ];
- // $v['parent_ids'] = $js_info['id'];
- // $v['id_paths'] = $id_path;
- // $child_sql[] = $v;
- // 推广员
- $promoter_list = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => ['in', $child_list_ids], 'level' => 3])->select();
- $vp_id_path = $id_path.$v['id'].',';
- foreach ($promoter_list as $vp){
- $promoter_count++;
- $child_sql[] = [
- 'id' => $vp['id'],
- 'parent_id' => $v['id'],
- 'id_path' => $vp_id_path,
- ];
- }
- }
- // return (json_encode($child_sql));
- // 启动事务
- // Db::startTrans();
- // try {
- // $channel = new Channel();
- // if (!$res = $channel->saveAll($child_sql)) {
- // // 回滚事务
- // Db::rollback();
- // throw new \Exception('迁移失败!');
- // }
- // Cache::clear('channel_cache');
- //
- // // 提交事务
- // Db::commit();
- //
- // } catch (\Exception $e) {
- // // 回滚事务
- // Db::rollback();
- // return json_encode(['code' => 0, 'msg' => '操作失败:' . $e->getMessage()]);
- // }
- // ## 数据统计
- $js_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $js_id, 'level' => 2])->count();
- $js_child_id_path = $js_info['id_path'].$js_info['id'].',';
- // 推广员
- $js_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$js_child_id_path.'%'], 'level' => 3])->count();
- $statisticsData['sj'] = [
- 'child_count' => $js_child_count,
- 'promoter_count' => $js_promoter_count,
- ];
- $statisticsData['cx'] = [
- 'count' => count($child_sql),
- 'child_count' => $child_count,
- 'promoter_count' => $promoter_count,
- ];
- return json_encode(['code' => 0, 'msg' => '操作成功', 'data' => $statisticsData]);
- }
- // 商务账号下的会长数据迁移
- public function migrate_sw(){
- $qy_id = input('qy_id', ''); // 迁移的商务
- $js_id = input('js_id', ''); // 接收的商务
- if(!$qy_id || !$js_id){
- return json_encode(["code" => 100, "message" => "缺少迁移或接收商务", "data" => ""]);
- }
- // 迁移的商务
- $qy_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id' => $qy_id, 'level' => 0, 'parent_id' => 0])->find();
- $js_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id' => $js_id, 'level' => 0, 'parent_id' => 0])->find();
- $qy_path = ','.$qy_info['id'].',';
- $js_path = ','.$js_info['id'].',';
- // dump($qy_path,' - ', $js_path);
- // TODO: 以下流程只是复制上边的,还未完善。等韩辉后续需要再说。
- // 迁移的会长
- $qy_ids = [''];
- $qy_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $qy_info['id'], 'level' => 1])->find();
- $js_info = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $js_info['id'], 'level' => 1])->find();
- // $id_path = $info['id_path'].$info['id'].',';
- // ## 数据统计 ##
- // 子会长
- $qy_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $qy_id, 'level' => 2])->count();
- $js_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $js_id, 'level' => 2])->count();
- // dump($qy_child_count, $js_child_count);
- $qy_child_id_path = $qy_info['id_path'].$qy_info['id'].',';
- $js_child_id_path = $js_info['id_path'].$js_info['id'].',';
- // dump($qy_child_id_path, $js_child_id_path);
- // 推广员
- $qy_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$qy_child_id_path.'%'], 'level' => 3])->count();
- $js_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$js_child_id_path.'%'], 'level' => 3])->count();
- // dump($qy_promoter_count, $js_promoter_count);
- $statisticsData = [
- // 迁移
- 'qy' => [
- 'child_count' => $qy_child_count,
- 'promoter_count' => $qy_promoter_count,
- ],
- // 接收
- 'js' => [
- 'child_count' => $js_child_count,
- 'promoter_count' => $js_promoter_count,
- ],
- // 汇总
- 'hz' => [
- 'child_count' => $qy_child_count+$js_child_count,
- 'promoter_count' => $qy_promoter_count+$js_promoter_count,
- ],
- // 实际数据(处理后)
- 'sj' => [
- 'child_count' => 0,
- 'promoter_count' => 0,
- ],
- // 程序处理
- 'cx' => [
- 'child_count' => 0,
- 'promoter_count' => 0,
- ],
- ];
- // dump($statisticsData);
- // 子会长
- $child_list = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $qy_info['id'], 'level' => 2])->select();
- $child_list_ids = array_column($child_list, 'id');
- $child_sql = [];
- $child_count = 0;
- $promoter_count = 0;
- $id_path = $js_info['id_path'].$js_info['id'].',';
- foreach ($child_list as $v){
- $child_count++;
- $child_sql[] = [
- 'id' => $v['id'],
- 'parent_id' => $js_info['id'],
- 'id_path' => $id_path,
- ];
- // $v['parent_ids'] = $js_info['id'];
- // $v['id_paths'] = $id_path;
- // $child_sql[] = $v;
- // 推广员
- $promoter_list = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => ['in', $child_list_ids], 'level' => 3])->select();
- $vp_id_path = $id_path.$v['id'].',';
- foreach ($promoter_list as $vp){
- $promoter_count++;
- $child_sql[] = [
- 'id' => $vp['id'],
- 'parent_id' => $v['id'],
- 'id_path' => $vp_id_path,
- ];
- }
- }
- // return (json_encode($child_sql));
- // 启动事务
- // Db::startTrans();
- // try {
- // $channel = new Channel();
- // if (!$res = $channel->saveAll($child_sql)) {
- // // 回滚事务
- // Db::rollback();
- // throw new \Exception('迁移失败!');
- // }
- // Cache::clear('channel_cache');
- //
- // // 提交事务
- // Db::commit();
- //
- // } catch (\Exception $e) {
- // // 回滚事务
- // Db::rollback();
- // return json_encode(['code' => 0, 'msg' => '操作失败:' . $e->getMessage()]);
- // }
- // ## 数据统计
- $js_child_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['parent_id' => $js_id, 'level' => 2])->count();
- $js_child_id_path = $js_info['id_path'].$js_info['id'].',';
- // 推广员
- $js_promoter_count = Db::name('nw_channel')->field('id,name,parent_id,level,id_path')->where(['id_path' => ['like', '%'.$js_child_id_path.'%'], 'level' => 3])->count();
- $statisticsData['sj'] = [
- 'child_count' => $js_child_count,
- 'promoter_count' => $js_promoter_count,
- ];
- $statisticsData['cx'] = [
- 'count' => count($child_sql),
- 'child_count' => $child_count,
- 'promoter_count' => $promoter_count,
- ];
- return json_encode(['code' => 0, 'msg' => '操作成功', 'data' => $statisticsData]);
- }
- // 空方法
- public function _empty()
- {
- return "url error!";
- }
- // 微信小程序跳转
- public function wxmp()
- {
- $url = input('url');
- if ($url) {
- header("location: " . $url);
- }
- }
- // 魔力宝贝推广页地址 - 2024.05.17
- public function mlbbDownload()
- {
- $code = input('code', '');
- $img_status = true;
- if (!$code) {
- $img_status = false;
- }
- $code = base64_decode($code);
- $code = str_replace('@qm_mlbb', "", $code);
- $url_host = QM_DOMAIN_URL;
- $file_url = "https://sdkdown.{$url_host}/game_mlbb/app/{$code}.plist";
- $this->assign('img_status', $img_status);
- $this->assign('file_url', $file_url);
- return $this->fetch();
- }
- // 批量获取推广标识
- public function getMlbbCode()
- {
- $pix = 'mlbb_';
- // $arr = [];
- // for ($i = 21; $i <= 100; $i++) {
- // $paddedNumber = str_pad($i, 4, '0', STR_PAD_LEFT);
- //
- // // if (intval($i / 10) = 0) {
- // //
- // // }
- // $code = $pix . $paddedNumber;
- // // echo $code . ' = https://t.'.QM_DOMAIN_URL.'/mlbb/' . base64_encode($code . '@qm_mlbb') . "<br />";
- // echo 'https://t.'.QM_DOMAIN_URL.'/mlbb/' . base64_encode($code . '@qm_mlbb') . "<br />";
- // // if (intval($i % 10) === 0) {
- // // echo $i . "<br />";
- // // }
- //
- //
- // // $arr[$i] = [
- // // 'title' => $code,
- // // 'code' => base64_encode($code . '@qm_mlbb'),
- // // ];
- // }
- //
- // dump($arr);
- $name = input('name', '');
- $code = $pix . $name;
- // 范例文件:public/mubao/mlbb_1001.plist
- return 'https://t.'.QM_DOMAIN_URL.'/mlbb/' . base64_encode($code . '@qm_mlbb');
- }
- }
|