master
“‘ 5 years ago
parent 96ca80221b
commit 9316dedc6c

@ -103,69 +103,69 @@ class Ipa365Controller extends BaseController{
* 发起支付
*/
public function pay() {
// $userId = $this->userinfo['user_id'];
// if (!$userId ) {
// $this->error("请登入", "/mobile.php/ssg/login");
// }
// $gameId = I("game_id", 0);
// $price = self::signprice;
// if (!$userId || !$gameId) {
// $this->error("参数有误!");
// }
// $payLog = M('game_supersign', 'tab_')->where(array(
// 'user_id' => $userId,
// 'game_id' => $gameId,
// 'pay_status' => 0
// ))->find();
// if ($payLog) {
// $orderId = $payLog['order_id'];
// } else {
// $orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签
// $gameInfo = M('game', 'tab_')->field('supersign_token')->where(array(
// 'id' => $gameId,
// ))->find();
// 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;
// }
// $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";
// $ret = $this->alipay($param);
// $this->assign("price", self::signprice);
// $this->assign("url", $ret['url']);
// $this->assign("order_id", $orderId);
$userId = $this->userinfo['user_id'];
if (!$userId ) {
$this->error("请登入", "/mobile.php/ssg/login");
}
$gameId = I("game_id", 0);
$price = self::signprice;
if (!$userId || !$gameId) {
$this->error("参数有误!");
}
$payLog = M('game_supersign', 'tab_')->where(array(
'user_id' => $userId,
'game_id' => $gameId,
'pay_status' => 0
))->find();
if ($payLog) {
$orderId = $payLog['order_id'];
} else {
$orderId = "SS_" . date('Ymd') . date('His') . sp_random_string(4); // 超级签
$gameInfo = M('game', 'tab_')->field('supersign_token')->where(array(
'id' => $gameId,
))->find();
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;
}
$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";
$ret = $this->alipay($param);
$this->assign("price", self::signprice);
$this->assign("url", $ret['url']);
$this->assign("order_id", $orderId);
// pp($orderId);
// redirect($ret['url']);

Loading…
Cancel
Save