|
|
|
@ -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);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//领取礼包码
|
|
|
|
|