From 02151093af3fd52983904c6ef49f0f6c529f687e Mon Sep 17 00:00:00 2001
From: chenzhi <“chenzhi063@qq.com>
Date: Fri, 25 Oct 2019 17:10:35 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Mobile/Controller/SsgController.class.php | 383 ------------------
Public/Mobile/js/ssg/flexible.min.js | 4 +-
2 files changed, 2 insertions(+), 385 deletions(-)
diff --git a/Application/Mobile/Controller/SsgController.class.php b/Application/Mobile/Controller/SsgController.class.php
index fffe86220..42ad4a54d 100644
--- a/Application/Mobile/Controller/SsgController.class.php
+++ b/Application/Mobile/Controller/SsgController.class.php
@@ -426,387 +426,4 @@ class SsgController extends BaseController {
}
}
-
- /**
- *支付中心
- */
- public function pay(){
- $user = session("user_auth");
- $gameId = I("game_id", 0);
- //$price = self::signprice;
- if (!$user) {
- redirect("/mobile.php/ssg/login");
- // $this->error("请登入", "/mobile.php/ssg/login");
- }
- $userId = $user['user_id'];
- $gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array(
- 'id' => $gameId,
- ))->find();
-
-
- $payLog = M('game_supersign', 'tab_')->where(array(
- 'user_id' => $userId,
- 'game_id' => $gameId
- ))->find();
-
- if($payLog && $payLog['pay_status']==1){
- //$this->assign("error","亲~您已购买过了~
请到【订单查询】查看订单信息哟~");
- //$this->display('blank');
- redirect("/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/".$payLog['order_id']);
- }else{
- if (!$gameInfo['supersign_token']) {
- //$this->error("超级签token未填写!");
- $this->assign("error","超级签token未配置~");
- $this->display('blank');
- exit();
- }
-
- $this->assign("price", self::signprice);
- //$this->assign("order_id", $orderId);
- $this->assign("game_id",$gameId);
- $this->assign("game_name",$gameInfo['game_name']);
- $this->display('pay');
- }
- }
-
-
-
- /*
- * 发起支付
- */
- public function dopay() {
- $user = session("user_auth");
- if (!$user ) {
- //redirect("/mobile.php/ssg/login");
- redirect(U("ssg/login"));
- }
- $gameId = I("game_id", 0);
- $paytype = I("pay_type", 'ali');
- $price = self::signprice;
- $userId = $user['user_id'];
- if (!$userId || !$gameId) {
- //$this->error("参数有误!");
- $this->assign("error","参数有误~");
- $this->display('blank');
- exit();
- }
-
- $payLog = M('game_supersign', 'tab_')->where(array(
- 'user_id' => $userId,
- 'game_id' => $gameId
- ))->find();
-
- $gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array(
- 'id' => $gameId,
- ))->find();
-
- if ($payLog && $payLog['pay_status']==0) {
- $orderId = $payLog['order_id'];
- }elseif ($payLog && $payLog['pay_status']==1){
- /*$orderId = $payLog['order_id'];
- if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){
- redirect("http://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
- }else{
- redirect("https://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
- }*/
- $this->assign("error","亲~您已购买过了~
请到【订单查询】查看订单信息哟~");
- $this->display('blank');
- //$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~");
- exit();
- } else {
- $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签
- if (!$gameInfo['supersign_token']) {
- //$this->error("超级签token未填写!");
- $this->assign("error","超级签token未配置~");
- $this->display('blank');
- exit();
- }
-
- $r = M('game_supersign', 'tab_')->add(array(
- 'udid' => '',
- 'user_id' => $userId,
- 'game_id' => $gameId,
- 'order_id' => $orderId,
- 'pay_price' => $price,
- 'pay_status' => 0,
- 'ticket' => '', // 调用安装的时候分配
- 'token' => $gameInfo['supersign_token'],
- 'create_time' => time()
- ));
- if (!$r) return -1;
- }
- if($paytype=='ali'){
- $param['price'] = $price;
- $param['sdk_version'] = '2';
- $param['user_id'] = $userId;
- $param['game_id'] = $gameId;
- $param['order_id'] = $orderId;
- $param['apitype'] = "alipay";
- $param['config'] = "alipay";
- $param['signtype']= "MD5";
- $param['server'] = "alipay.wap.create.direct.pay.by.user";
- $param['payway'] = 1;
- $param['title'] = $price;
- $param['body'] = $price;
- //$param['callback'] = "https://m.wmtxkj.com/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
- //$param['notifyurl'] = "https://m.wmtxkj.com/callback.php/Notify/notify/apitype/alipay";
- if(stripos($_SERVER['HTTP_HOST'], '.wmtxkj.cn') || $_SERVER['HTTP_HOST']=='127.0.0.1' || stripos($_SERVER['HTTP_HOST'], '.free.idcfengye.com')){
- $param['callback'] = "http://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
- $param['notifyurl'] = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
- }else{
- $param['callback'] = "https://".$_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
- $param['notifyurl'] = "https://".$_SERVER['HTTP_HOST']."/callback.php/Notify/notify/apitype/alipay";
- }
-
- $ali_pay = $this->alipay($param);
- redirect($ali_pay['url']);
- }else{
- $weixn = new Weixin();
- $wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true);
- if($wx_pay['status']==1){
- //$redirect_url = $_SERVER['HTTP_HOST']."/mobile.php/Ssg/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
- redirect($wx_pay['mweb_url']);
- }else{
- $this->assign("error",$wx_pay['return_msg']);
- $this->display('blank');
- }
- }
- }
-
- // alipay
- public function alipay($param) {
- $pay = new \Think\Pay($param['apitype'],C($param['config']));
- $vo = new \Think\Pay\PayVo();
- $vo->setBody("超级签消费")
- ->setFee($param['price'])//支付金额
- ->setTitle($param['title'])
- ->setOrderNo($param['order_id'])
- ->setService($param['server'])
- ->setSignType($param['signtype'])
- ->setPayMethod("wap")
- ->setTable("supersign")
- ->setPayWay($param['payway'])
- ->setCallback($param['callback'])
- ->setNotifyUrl($param['notifyurl'])
- ->setGameName(get_game_name($param['game_id']))
- ->setServerId(0)
- ->setUserId($param['user_id'])
- ->setSdkVersion($param['sdk_version']);
- $pay_['url']= $pay->buildRequestForm($vo);
- //$pay_['out_trade_no']= $out_trade_no;
- return $pay_;
-
- }
-
-
- /**
- * 用户点击安装
- */
- public function install() {
- $user = session("user_auth");
- if (!$user ) {
- //$this->error("请登入", "/mobile.php/ssg/login");
- redirect(U("ssg/login"));
- }
- $userId = $user['user_id'];
- $gameId = I('game_id', 0);
- $orderId = I('order_id', 0);
- if (!$userId || !$gameId || !$orderId) {
- //$this->error("参数有误!");
- $this->assign("error","参数有误~");
- $this->display('blank');
- exit();
- }
- M()->startTrans();
- // 获取支付记录
- $gamesign = M('game_supersign', 'tab_')->where(array(
- 'order_id' => $orderId,
- 'user_id' => $userId,
- 'game_id' => $gameId,
- 'pay_status' => 1,
- ))->find();
- if (!$gamesign) {
- //$this->error("支付记录不存在");
- $this->assign("error","支付记录不存在~");
- $this->display('blank');
- exit();
- }
- if ($gamesign['url']) {
- redirect($gamesign['url']);
- }
-
- $token = $gamesign['token'];
- $ipa365 = new Ipa365();
-
- $i = 1;
- while (1) {
- // 获取授权码
- $list = $ipa365->ticketList(array(
- 'token' => $token,
- 'limit' => $i,
- )); // @todo: 并发授权码已分配的情况
- $code = $list['data']['list'][$i-1]['code'];
- $codeExists = M('game_supersign', 'tab_')->field('id')->where(array(
- 'ticket' => $code,
- ))->find();
- if (!$codeExists) {
- break;
- }
- $i ++;
- }
-
- $game = M('game', 'tab_')->where(array(
- 'id' => $gameId,
- ))->find();
- $url = $game['supersign_url']."?code={$code}";
- $r = M('game_supersign', 'tab_')->where(array(
- 'user_id' => $userId,
- 'game_id' => $gameId,
- 'pay_status' => 1
- ))->save(array(
- 'ticket' => $code, // 调用安装的时候分配
- 'url' => $url,
- ));
- if (!$r) {
- pp(M('game_supersign', 'tab_')->_sql());
- M()->rollback();
- return -1;
- }
- M()->commit();
- redirect($url);
- }
-
- /**
- * 下载页面 判断订单是否支付成功
- */
- public function install_show() {
- $orderId = I('order_id', 0);
- $gameId = I('game_id', 0);
-
- $user = session("user_auth");
- if (!$user ) {
- //$this->error("请登入", "/mobile.php/ssg/login");
- redirect(U("ssg/login"));
- }
-
- $userId = $user['user_id'];
- if (!$userId ) {
- //$this->error("请登入", "/mobile.php/ssg/login");
- redirect(U("ssg/login"));
- }
- if (!$orderId || !$gameId || !$userId) {
- //$this->error("参数校验失败,请重试");
- $this->assign("error","参数校验失败,请重试~");
- $this->display('blank');
- exit();
- }
-
- $supersign = M('game_supersign', 'tab_')->where(array('order_id' => $orderId,"game_id"=>$gameId))->find();
- if (!$supersign) {
- //$this->error("订单不存在");
- $this->assign("error","订单不存在");
- $this->display('blank');
- exit();
- }
- if ($supersign['pay_status'] != 1) {
- //$this->error("订单未支付");
- $this->assign("error","订单未支付");
- $this->display('blank');
- exit();
- }
- $game = M('game', 'tab_')->where(array('id' => $gameId))->find();
-
- $this->assign('game', $game);
- $this->assign('url', U('Ssg/install', array(
- 'order_id' => $orderId,
- 'user_id' => $userId,
- 'game_id' => $gameId
- )));
- //获取礼包码
- $giftbag = M('giftbag', 'tab_')->field("*")->where(array("game_id"=>$gameId,"giftbag_version"=>3))->find();
- if(empty($giftbag)){
- $giftbag = false;
- }else{
- $desribe = $giftbag['desribe'];
- $mygif = $this->checkAccountGiftExist($userId,$giftbag['id']);
- if(!empty($mygif)){
- //已经领取
- $giftbag =$mygif;
- }else{
- if($giftbag['novice_num']>0){
- //领取
- $giftbag = $this->getNovice($userId,$user['account'],$giftbag['id']);
- }
- }
- $giftbag['desribe'] = $desribe;
-
- }
- //验证是否领取
- $this->assign('giftbag', $giftbag);
- $this->display();
- }
-
- /*
- * 打包列表
- */
- public function pay_list() {
- $user = session("user_auth");
- if (!$user ) {
- //$this->error("请登入", "/mobile.php/ssg/login");
- redirect(U("ssg/login"));
- }
- $userId = $user['user_id'];
- $list = M('game_supersion', 'tab_')->where(array(
- 'user_id' => $userId,
- ))->select();
- $this->assign("list", $list);
- $this->display();
- }
-
- //领取礼包码
- public function getNovice($user_id,$account,$gift_id){
- $data =M("giftbag",'tab_')->find($gift_id);
- $novice_str = $data['novice'];
- $novice_arr = str2arr($novice_str,",");
- if (empty($novice_arr)){
- return "";
- }
- $novice_arr = array_filter($novice_arr);
- $novice = array_pop($novice_arr);
- $data['novice_num'] = count($novice_arr);
- $data['novice'] = arr2str($novice_arr,",");
- M("giftbag",'tab_')->startTrans();
- $novice_result = M("giftbag",'tab_')->save($data);
- if(!empty($novice)){
- //记录领取
- $record['game_id'] = $data['game_id'];
- $record['game_name'] = $data['game_name'];//get_game_name($data['game_id']);
- $record['gift_id'] = $gift_id;
- $record['gift_name'] = $data['giftbag_name'];
- $record['status'] = 0;
- $record['novice'] = $novice;
- $record['user_id'] = $user_id;
- $record['user_account'] = $account;
- $record['create_time'] = time();
- $record['start_time'] = $data['start_time'];
- $record['end_time'] = $data['end_time'];
- $record_result = M("gift_record",'tab_')->add($record);
- }else{
- $novice_result = false;
- }
-
- if($novice_result === false || $record_result === false){
- M("giftbag",'tab_')->rollback();
- return "";
- }else{
- M("giftbag",'tab_')->commit();
- return $record;
- }
- }
-
- public function checkAccountGiftExist($user_id,$gift_id){
- $map['user_id'] = $user_id;
- $map['gift_id'] = $gift_id;
- return M("gift_record",'tab_')->field('*')->where($map)->find();
- }
}
diff --git a/Public/Mobile/js/ssg/flexible.min.js b/Public/Mobile/js/ssg/flexible.min.js
index 0e8f568ad..64e088904 100644
--- a/Public/Mobile/js/ssg/flexible.min.js
+++ b/Public/Mobile/js/ssg/flexible.min.js
@@ -13,8 +13,8 @@
docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / 1536), 22.5), 17.5) * 5 + 'px';
}else{
- /* 8.55:小于320px不再缩小,11.2:大于420px不再放大 */
- docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / docWidth), 11.2), 8.55) * 5 + 'px';
+ /* 8.55:小于320px不再缩小,11.2:大于420px不再放大 ,17.2 大于667不再放大*/
+ docEl.style.fontSize = Math.max(Math.min(20 * (clientWidth / docWidth), 17.2), 8.55) * 5 + 'px';
}
return refreshRem;
})();