超级签购买错误信息页面

master
zhengchanglong 5 years ago
parent 7863eb1be3
commit 86040c88c6

@ -125,9 +125,16 @@ class Ipa365Controller extends BaseController{
))->find(); ))->find();
if($payLog && $payLog['pay_status']==1){ if($payLog && $payLog['pay_status']==1){
$this->assign("msg","亲~您已购买过了~请到【订单查询】查看订单信息哟~"); $this->assign("error","亲~您已购买过了~请到【订单查询】查看订单信息哟~");
$this->display('blank'); $this->display('blank');
}else{ }else{
if (!$gameInfo['supersign_token']) {
//$this->error("超级签token未填写");
$this->assign("error","超级签token未配置~");
$this->display('blank');
exit();
}
$this->assign("price", self::signprice); $this->assign("price", self::signprice);
//$this->assign("order_id", $orderId); //$this->assign("order_id", $orderId);
$this->assign("game_id",$gameId); $this->assign("game_id",$gameId);
@ -151,7 +158,10 @@ class Ipa365Controller extends BaseController{
$price = self::signprice; $price = self::signprice;
if (!$userId || !$gameId) { if (!$userId || !$gameId) {
$this->error("参数有误!"); //$this->error("参数有误!");
$this->assign("error","参数有误~");
$this->display('blank');
exit();
} }
$payLog = M('game_supersign', 'tab_')->where(array( $payLog = M('game_supersign', 'tab_')->where(array(
@ -172,13 +182,16 @@ class Ipa365Controller extends BaseController{
}else{ }else{
redirect("https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId"); redirect("https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
}*/ }*/
$this->assign("msg","亲~您已购买过了~请到【订单查询】查看订单信息哟~"); $this->assign("error","亲~您已购买过了~请到【订单查询】查看订单信息哟~");
$this->display('blank'); $this->display('blank');
//$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~"); //$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~");
} else { } else {
$orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签 $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签
if (!$gameInfo['supersign_token']) { if (!$gameInfo['supersign_token']) {
$this->error("超级签token未填写"); //$this->error("超级签token未填写");
$this->assign("error","超级签token未配置~");
$this->display('blank');
exit();
} }
$r = M('game_supersign', 'tab_')->add(array( $r = M('game_supersign', 'tab_')->add(array(
@ -219,26 +232,16 @@ class Ipa365Controller extends BaseController{
$ali_pay = $this->alipay($param); $ali_pay = $this->alipay($param);
redirect($ali_pay); redirect($ali_pay);
//var_dump($ali_pay);
}else{ }else{
$weixn = new Weixin(); $weixn = new Weixin();
$wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true); $wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true);
if($wx_pay['status']==1){ if($wx_pay['status']==1){
redirect($wx_pay['mweb_url']); redirect($wx_pay['mweb_url']);
}else{
$this->assign("error",$wx_pay['return_msg']);
$this->display('blank');
} }
//var_dump($wx_pay);
//$this->assign("wxurl", $wx_pay['mweb_url']);
} }
//$this->assign("url", $ret['url']);
//$this->assign("price", self::signprice);
//$this->assign("order_id", $orderId);
//$this->assign("game_name",$gameInfo['game_name']);
//$this->assign("callback",$param['callback']);
//$this->display();
} }
@ -393,200 +396,200 @@ class Ipa365Controller extends BaseController{
* 下载页面 判断订单是否支付成功 * 下载页面 判断订单是否支付成功
*/ */
public function install_show() { public function install_show() {
$orderId = I('order_id', 0); $orderId = I('order_id', 0);
$gameId = I('game_id', 0); $gameId = I('game_id', 0);
/* $userId = I('user_id', 0); /* $userId = I('user_id', 0);
$user = M('user', 'tab_')->where(array( $user = M('user', 'tab_')->where(array(
'id' => $userId 'id' => $userId
))->find(); */ ))->find(); */
$userId = $this->userinfo['user_id']; $userId = $this->userinfo['user_id'];
if (!$userId ) { if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login"); $this->error("请登入", "/mobile.php/ssg/login");
} }
// $userId = $_SESSION['user_id']; // $userId = $_SESSION['user_id'];
if (!$userId ) { if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login"); $this->error("请登入", "/mobile.php/ssg/login");
} }
if (!$orderId || !$gameId || !$userId) { if (!$orderId || !$gameId || !$userId) {
$this->error("参数校验失败,请重试"); $this->error("参数校验失败,请重试");
} }
$supersign = M('game_supersign', 'tab_')->where(array('order_id' => $orderId,"game_id"=>$gameId))->find(); $supersign = M('game_supersign', 'tab_')->where(array('order_id' => $orderId,"game_id"=>$gameId))->find();
if (!$supersign) { if (!$supersign) {
$this->error("订单不存在"); $this->error("订单不存在");
} }
if ($supersign['pay_status'] != 1) { if ($supersign['pay_status'] != 1) {
$this->error("订单未支付"); $this->error("订单未支付");
} }
$game = M('game', 'tab_')->where(array('id' => $gameId))->find(); $game = M('game', 'tab_')->where(array('id' => $gameId))->find();
$this->assign('game', $game); $this->assign('game', $game);
$this->assign('url', U('Ipa365/install', array( $this->assign('url', U('Ipa365/install', array(
'order_id' => $orderId, 'order_id' => $orderId,
'user_id' => $userId, 'user_id' => $userId,
'game_id' => $gameId 'game_id' => $gameId
))); )));
//获取礼包码 //获取礼包码
$giftbag = M('giftbag', 'tab_')->field("*")->where(array("game_id"=>$gameId,"giftbag_version"=>3))->find(); $giftbag = M('giftbag', 'tab_')->field("*")->where(array("game_id"=>$gameId,"giftbag_version"=>3))->find();
if(empty($giftbag)){ if(empty($giftbag)){
$giftbag = false; $giftbag = false;
}else{ }else{
$desribe = $giftbag['desribe']; $desribe = $giftbag['desribe'];
$mygif = $this->checkAccountGiftExist($userId,$giftbag['id']); $mygif = $this->checkAccountGiftExist($userId,$giftbag['id']);
if(!empty($mygif)){ if(!empty($mygif)){
//已经领取 //已经领取
$giftbag =$mygif; $giftbag =$mygif;
}else{ }else{
if($giftbag['novice_num']>0){ if($giftbag['novice_num']>0){
//领取 //领取
$giftbag = $this->getNovice($userId,$this->userinfo['account'],$giftbag['id']); $giftbag = $this->getNovice($userId,$this->userinfo['account'],$giftbag['id']);
} }
} }
$giftbag['desribe'] = $desribe; $giftbag['desribe'] = $desribe;
} }
//验证是否领取 //验证是否领取
$this->assign('giftbag', $giftbag); $this->assign('giftbag', $giftbag);
$this->display(); $this->display();
} }
/** /**
* 获取用户安装历史url * 获取用户安装历史url
*/ */
public function get_install_list() { public function get_install_list() {
/* $gameId = I('game_id', 0); /* $gameId = I('game_id', 0);
$where = array( $where = array(
'pay_status' => 1, 'pay_status' => 1,
'ticket' => array('neq', '') 'ticket' => array('neq', '')
); );
if ($id) $where['game_id'] = $gameId; if ($id) $where['game_id'] = $gameId;
$list = M('game_supersign', 'tab_')->where($where)->select(); $list = M('game_supersign', 'tab_')->where($where)->select();
// pp($list); // pp($list);
$url = $game['supersign_url']."?code={$code}"; $url = $game['supersign_url']."?code={$code}";
pp($url); pp($url);
redirect($url); */ redirect($url); */
} }
/** /**
* 用户点击安装 * 用户点击安装
*/ */
public function install() { public function install() {
$userId = $this->userinfo['user_id']; $userId = $this->userinfo['user_id'];
if (!$userId ) { if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login"); $this->error("请登入", "/mobile.php/ssg/login");
} }
$gameId = I('game_id', 0); $gameId = I('game_id', 0);
$orderId = I('order_id', 0); $orderId = I('order_id', 0);
if (!$userId || !$gameId || !$orderId) { if (!$userId || !$gameId || !$orderId) {
$this->error("参数有误!"); $this->error("参数有误!");
} }
M()->startTrans(); M()->startTrans();
// 获取支付记录 // 获取支付记录
$gamesign = M('game_supersign', 'tab_')->where(array( $gamesign = M('game_supersign', 'tab_')->where(array(
'order_id' => $orderId, 'order_id' => $orderId,
'user_id' => $userId, 'user_id' => $userId,
'game_id' => $gameId, 'game_id' => $gameId,
'pay_status' => 1, 'pay_status' => 1,
))->find(); ))->find();
if (!$gamesign) { if (!$gamesign) {
// pp(M('game_supersign', 'tab_')->_sql()); // pp(M('game_supersign', 'tab_')->_sql());
$this->error("支付记录不存在"); $this->error("支付记录不存在");
} }
if ($gamesign['url']) { if ($gamesign['url']) {
redirect($gamesign['url']); redirect($gamesign['url']);
} }
$token = $gamesign['token']; $token = $gamesign['token'];
$ipa365 = new Ipa365(); $ipa365 = new Ipa365();
$i = 1; $i = 1;
while (1) { while (1) {
// 获取授权码 // 获取授权码
$list = $ipa365->ticketList(array( $list = $ipa365->ticketList(array(
'token' => $token, 'token' => $token,
'limit' => $i, 'limit' => $i,
)); // @todo: 并发授权码已分配的情况 )); // @todo: 并发授权码已分配的情况
$code = $list['data']['list'][$i-1]['code']; $code = $list['data']['list'][$i-1]['code'];
$codeExists = M('game_supersign', 'tab_')->field('id')->where(array( $codeExists = M('game_supersign', 'tab_')->field('id')->where(array(
'ticket' => $code, 'ticket' => $code,
))->find(); ))->find();
if (!$codeExists) { if (!$codeExists) {
break; break;
} }
$i ++; $i ++;
} }
$game = M('game', 'tab_')->where(array( $game = M('game', 'tab_')->where(array(
'id' => $gameId, 'id' => $gameId,
))->find(); ))->find();
$url = $game['supersign_url']."?code={$code}"; $url = $game['supersign_url']."?code={$code}";
$r = M('game_supersign', 'tab_')->where(array( $r = M('game_supersign', 'tab_')->where(array(
'user_id' => $userId, 'user_id' => $userId,
'game_id' => $gameId, 'game_id' => $gameId,
'pay_status' => 1 'pay_status' => 1
))->save(array( ))->save(array(
'ticket' => $code, // 调用安装的时候分配 'ticket' => $code, // 调用安装的时候分配
'url' => $url, 'url' => $url,
)); ));
if (!$r) { if (!$r) {
pp(M('game_supersign', 'tab_')->_sql()); pp(M('game_supersign', 'tab_')->_sql());
M()->rollback(); M()->rollback();
return -1; return -1;
} }
M()->commit(); M()->commit();
// 调用第三方连接 // 调用第三方连接
// pp($url); // pp($url);
redirect($url); redirect($url);
} }
/* /*
* 打包列表 * 打包列表
*/ */
public function pay_list() { public function pay_list() {
$userId = $this->userinfo['user_id']; $userId = $this->userinfo['user_id'];
if (!$userId ) { if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login"); $this->error("请登入", "/mobile.php/ssg/login");
} }
$list = M('game_supersion', 'tab_')->where(array( $list = M('game_supersion', 'tab_')->where(array(
'user_id' => $userId, 'user_id' => $userId,
))->select(); ))->select();
$this->assign("list", $list); $this->assign("list", $list);
$this->display(); $this->display();
} }
// alipay // alipay
public function alipay($param) { public function alipay($param) {
$pay = new \Think\Pay($param['apitype'],C($param['config'])); $pay = new \Think\Pay($param['apitype'],C($param['config']));
$vo = new \Think\Pay\PayVo(); $vo = new \Think\Pay\PayVo();
$vo->setBody("超级签消费") $vo->setBody("超级签消费")
->setFee($param['price'])//支付金额 ->setFee($param['price'])//支付金额
->setTitle($param['title']) ->setTitle($param['title'])
->setOrderNo($param['order_id']) ->setOrderNo($param['order_id'])
->setService($param['server']) ->setService($param['server'])
->setSignType($param['signtype']) ->setSignType($param['signtype'])
->setPayMethod("wap") ->setPayMethod("wap")
->setTable("supersign") ->setTable("supersign")
->setPayWay($param['payway']) ->setPayWay($param['payway'])
->setCallback($param['callback']) ->setCallback($param['callback'])
->setNotifyUrl($param['notifyurl']) ->setNotifyUrl($param['notifyurl'])
->setGameName(get_game_name($param['game_id'])) ->setGameName(get_game_name($param['game_id']))
->setServerId(0) ->setServerId(0)
->setUserId($param['user_id']) ->setUserId($param['user_id'])
->setSdkVersion($param['sdk_version']); ->setSdkVersion($param['sdk_version']);
$pay_['url']= $pay->buildRequestForm($vo); $pay_['url']= $pay->buildRequestForm($vo);
//$pay_['out_trade_no']= $out_trade_no; //$pay_['out_trade_no']= $out_trade_no;
return $pay_; return $pay_;
} }
//领取礼包码 //领取礼包码
public function getNovice($user_id,$account,$gift_id){ public function getNovice($user_id,$account,$gift_id){
$data =M("giftbag",'tab_')->find($gift_id); $data =M("giftbag",'tab_')->find($gift_id);
$novice_str = $data['novice']; $novice_str = $data['novice'];
$novice_arr = str2arr($novice_str,","); $novice_arr = str2arr($novice_str,",");
@ -624,8 +627,8 @@ class Ipa365Controller extends BaseController{
M("giftbag",'tab_')->commit(); M("giftbag",'tab_')->commit();
return $record; return $record;
} }
} }
public function checkAccountGiftExist($user_id,$gift_id){ public function checkAccountGiftExist($user_id,$gift_id){
$map['user_id'] = $user_id; $map['user_id'] = $user_id;
$map['gift_id'] = $gift_id; $map['gift_id'] = $gift_id;
return M("gift_record",'tab_')->field('*')->where($map)->find(); return M("gift_record",'tab_')->field('*')->where($map)->find();

@ -3,26 +3,26 @@
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1,minimum-scale=1, maximum-scale=1, user-scalable=no">
<title></title> <title>错误信息</title>
<link href="__CSS__/ssg/common.css" rel="stylesheet" type="text/css"> <link href="__CSS__/ssg/common.css" rel="stylesheet" type="text/css">
</head> </head>
<body> <body>
<div class="blank-box"> <div class="blank-box">
<div class="title"> <div class="title">
<img class="gologin" src="__IMG__/ssg/alipay/back.png" onclick="javascript:history.go(-1)"> <img class="gologin" src="__IMG__/ssg/alipay/back.png" onclick="javascript:history.go(-1)">
<div class="content">充值帮助</div> <div class="content">错误信息</div>
<div class="titleright"></div> <div class="titleright"></div>
</div> </div>
<div class="cell-box"> <div class="cell-box">
<img src="__IMG__/ssg/blank/blankimg.png"> <img src="__IMG__/ssg/error.png">
</div> </div>
<p>网络似乎不太好</p> <p>{$error}</p>
<div class="resbtn"> <!--<div class="resbtn">
<a href="#"> <a href="#">
刷新页面 刷新页面
</a> </a>
</div> </div>-->
</div> </div>
@ -30,6 +30,5 @@
<script src="__JS__/jquery-1.11.1.min.js" type="text/javascript"></script> <script src="__JS__/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="__JS__/ssg/common.js" type="text/javascript"></script> <script src="__JS__/ssg/common.js" type="text/javascript"></script>
<script> <script>
</script> </script>
</html> </html>

@ -317,3 +317,50 @@ input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #
.install-box .vip-download .game-gift .gift-list li .gift-code label{ .install-box .vip-download .game-gift .gift-list li .gift-code label{
left: .28rem; left: .28rem;
} }
/* blank-page */
.blank-box{
font-size: .16rem;
color: #292929;
background-color: #fff;
min-height: 100vh;
}
.blank-box .title {
display: flex;
height: .45rem;
width: 100%;
justify-content: space-between;
align-items: center;
background-color: #21B1EB;
}
.blank-box .title img,
.blank-box .titleright {
width: .15rem;
height: .15rem;
}
.blank-box .title img{
margin-left:.12rem;
}
.blank-box .titleright {
margin-right:.12rem;
}
.blank-box .title .content{
font-size: .16rem;color: #fff;
}
.blank-box .cell-box{
width: 100%;padding:.9rem 0 0;display: flex;justify-content: center
}
.blank-box .cell-box img{
width: 2rem;height: 1.2rem;
}
.blank-box p{
width: 100%;font-size: .16rem;text-align: center;line-height: 1.5;
}
.blank-box .resbtn{
width: 100%;padding:.35rem 0 0;display: flex;justify-content: center;
}
.blank-box .resbtn a{
width: 1.1rem;height: .35rem;border-radius: 35px;text-align: center;color: #fff;background-color:#21B1EB;line-height: .35rem;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Loading…
Cancel
Save