修改超级签充值流程

master
zhengchanglong 5 years ago
parent e4b72a1847
commit e2fc2e5128

@ -100,15 +100,143 @@ class Ipa365Controller extends BaseController{
echo "订单正在处理中.请稍后再试!";
exit();
}
/**
*支付中心
*/
public function pay(){
$userId = $this->userinfo['user_id'];
$gameId = I("game_id", 0);
//$price = self::signprice;
if (!$userId ) {
redirect("/mobile.php/ssg/login");
// $this->error("请登入", "/mobile.php/ssg/login");
}
$gameInfo = M('game', 'tab_')->field('game_name,supersign_token')->where(array(
'id' => $gameId,
))->find();
$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 pay() {
public function dopay() {
$userId = $this->userinfo['user_id'];
if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login");
redirect("/mobile.php/ssg/login");
}
$gameId = I("game_id", 0);
$paytype = I("pay_type", 'ali');
$price = self::signprice;
if (!$userId || !$gameId) {
$this->error("参数有误!");
}
$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']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
}else{
redirect("https://".$_SERVER['HTTP_HOST']."/sdk.php/Ipa365/install_show/user_id/$userId/game_id/$gameId/order_id/$orderId");
}
$this->error("亲~您已购买过了~请到【订单查询】查看订单信息哟~");
} else {
$orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签
if (!$gameInfo['supersign_token']) {
$this->error("超级签token未填写");
}
$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/sdk.php/Ipa365/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']."/sdk.php/Ipa365/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']."/sdk.php/Ipa365/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);
//var_dump($ali_pay);
}else{
$weixn = new Weixin();
$wx_pay = json_decode($weixn->weixin_pay('超级签消费', $orderId, $price, 'MWEB', 4), true);
if($wx_pay['status']==1){
redirect($wx_pay['mweb_url']);
}
//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();
}
/*
* 发起支付
*/
public function pay1() {
$userId = $this->userinfo['user_id'];
if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login");
}
$gameId = I("game_id", 0);
$price = self::signprice;
@ -185,7 +313,7 @@ class Ipa365Controller extends BaseController{
$this->assign("wxurl", $wx_pay['mweb_url']);
$this->assign("price", self::signprice);
$this->assign("order_id", $orderId);
//$this->assign("order_id", $orderId);
$this->assign("game_name",$gameInfo['game_name']);
$this->assign("callback",$param['callback']);
@ -439,9 +567,9 @@ class Ipa365Controller extends BaseController{
->setServerId(0)
->setUserId($param['user_id'])
->setSdkVersion($param['sdk_version']);
$pay_['url']= $pay->buildRequestForm($vo);
//$pay_['url']= $pay->buildRequestForm($vo);
//$pay_['out_trade_no']= $out_trade_no;
return $pay_;
return $pay->buildRequestForm($vo);
}
//领取礼包码

@ -108,7 +108,7 @@ body{
<span>{$price}</span>
</div>
<a class="order-payinfo-item"
href="#;" onclick="jump('{$url}', '{$order_id}','alipay')"
href="#;" onclick="jump('/sdk.php/Ipa365/dopay/game_id/{$game_id}/pay_type/ali')"
title="支付宝" style="padding: .3rem 0;width: 6.3rem;margin-left: .3rem;">
<div class="order-payinfo-icon" style="width: .7rem;height: .7rem;">
<img src="__IMG__/ssg/alipay/zfb-pic.jpg" style="width: 100%;height: 100%;border: 0px;" alt="支付宝">
@ -118,9 +118,8 @@ body{
<div class="pay-meta">推荐支付宝用户使用</div>
</div>
</a>
<if condition="$wxurl neq ''">
<a class="order-payinfo-item"
href="#;" onclick="jump('{$wxurl}', '{$order_id}','wxpay')"
href="#;" onclick="jump('/sdk.php/Ipa365/dopay/game_id/{$game_id}/pay_type/wx')"
title="微信支付" style="padding: .3rem 0;width: 6.3rem;margin-left: .3rem;">
<div class="order-payinfo-icon" style="width: .7rem;height: .7rem;">
<img src="__IMG__/ssg/alipay/wxpay.png" style="width: 100%;height: 100%;border: 0px;" alt="微信支付">
@ -130,7 +129,6 @@ body{
<div class="pay-meta">推荐微信用户使用</div>
</div>
</a>
</if>
</div>
</div>
<!--<div class="footer-pay">
@ -138,14 +136,15 @@ body{
</div>-->
</body>
<script>
function jump(pay_url, order_id,paytype='alipay') {
if(paytype=='alipay'){
function jump(pay_url) {
window.location.href = pay_url;
/*if(paytype=='alipay'){
window.location.href = pay_url;
}else{
showAlert();
window.location.href = pay_url;
//window.open(pay_url,"_blank");
}
}*/
/*if(isWeiXin()){
window.location.href = "/sdk.php/Ipa365/paytip/order_id/"+order_id;
}else{

Loading…
Cancel
Save