Merge remote-tracking branch 'origin/dev' into dev

master
zhengchanglong 5 years ago
commit 622ef0571e

@ -384,7 +384,7 @@
<tr> <tr>
<td class="l">超级签URL</td> <td class="l">超级签URL</td>
<td class="r" > <td class="r" >
<input type="text" class="txt " name="supersign_URL" value="{$data['supersign_url']}" placeholder="请输入超级签URL" > <input type="text" class="txt " name="supersign_url" value="{$data['supersign_url']}" placeholder="请输入超级签URL" >
</td> </td>
</tr> </tr>
</tbody> </tbody>

@ -25,6 +25,19 @@
height:26px;line-height:26px;font-size:12px; height:26px;line-height:26px;font-size:12px;
} }
.select2-results__option[aria-selected] {font-size:12px;} .select2-results__option[aria-selected] {font-size:12px;}
.badge {
position: relative;
display: inline-block;
padding: 0 6px;
font-size: 12px;
text-align: center;
background-color: #1E9FFF;
color: #fff;
border-radius: 2px;
height: 18px;
line-height: 18px;
margin-right: 10px;
}
</style> </style>
<!-- 标题栏 --> <!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list"> <div class="cf main-place top_nav_list navtab_list">
@ -69,8 +82,10 @@
<tr> <tr>
<th class="">查询时间</th> <th class="">查询时间</th>
<th class="">玩家账号</th> <th class="">玩家账号</th>
<th class="">游戏名称</th> <th class="">游戏名称</th>
<th class="">游戏区服</th> <th class="">游戏区服ID</th>
<th class="">游戏区服</th>
<th class="">角色ID</th>
<th class="">角色名</th> <th class="">角色名</th>
<th class="">游戏等级</th> <th class="">游戏等级</th>
<th class="">最后登录时间</th> <th class="">最后登录时间</th>
@ -87,8 +102,10 @@
<?php $gamename = trim($data['game_name']); <?php $gamename = trim($data['game_name']);
$servername = trim($data['server_name']); $servername = trim($data['server_name']);
$rolename = trim($data['role_name']);?> $rolename = trim($data['role_name']);?>
<td><notempty name="gamename">{$gamename}<else /></notempty></td> <td><notempty name="gamename">{$gamename}<else /></notempty></td>
<td><notempty name="servername">{$servername}<else /></notempty></td> <td><span class="badge">{$data['server_id']}</span></td>
<td><notempty name="servername">{$servername}<else /></notempty></td>
<td><span class="badge">{$data['role_id']}</span></td>
<td><notempty name="rolename">{$rolename}<else /></notempty></td> <td><notempty name="rolename">{$rolename}<else /></notempty></td>
<td>{$data.role_level}</td> <td>{$data.role_level}</td>
<td>{$data.play_time|date='Y-m-d H:i:s',###}</td> <td>{$data.play_time|date='Y-m-d H:i:s',###}</td>

@ -55,6 +55,11 @@ class BaseController extends Controller {
$map['pay_order_number'] = $data['out_trade_no']; $map['pay_order_number'] = $data['out_trade_no'];
$d = $spend->where($map)->find(); $d = $spend->where($map)->find();
if(empty($d)){$this->record_logs("数据异常");return false;} if(empty($d)){$this->record_logs("数据异常");return false;}
// 支付金额判断 by zgc
if ($d['pay_amount'] != $data['money']) {
$this->record_logs("支付金额不一致".$data['out_trade_no'].":".$data['money']);return false;
}
if($d['pay_status'] == 0){ if($d['pay_status'] == 0){
$data_save['pay_status'] = 1; $data_save['pay_status'] = 1;
$data_save['order_number'] = $data['trade_no']; $data_save['order_number'] = $data['trade_no'];
@ -166,6 +171,30 @@ class BaseController extends Controller {
} }
} }
/*
* 超级签支付成功通知验证后调用
* return 1订单不存在 2已支付 0成功 -1数据错误
*/
protected function supersign_pay_notify($data) {
$order = M('game_supersign', 'tab_')->where(array(
'order_id' => $data['order_id']
))->find();
if (!$order) return 0;
if ($order['pay_status'] == 1) return 0;
$r = M('game_supersign', 'tab_')->where(array(
'order_id' => $data['order_id'],
'pay_status' => 0,
))->save(array(
'trade_id' => $data['trade_id'],
'pay_status' => 1,
'pay_time' => time()
));
if (!$r) return -1;
return 1;
}
/** /**
* 绑币充值回调 * 绑币充值回调

@ -63,7 +63,6 @@ class NotifyController extends BaseController
} }
$pay = new \Think\Pay($pay_way, C($apitype)); $pay = new \Think\Pay($pay_way, C($apitype));
if ($pay->verifyNotify($notify)) { if ($pay->verifyNotify($notify)) {
//获取回调订单信息 //获取回调订单信息
@ -75,7 +74,6 @@ class NotifyController extends BaseController
$result = false; $result = false;
switch ($pay_where) { switch ($pay_where) {
case 'SP': case 'SP':
@ -102,12 +100,17 @@ class NotifyController extends BaseController
break; break;
case 'BR': case 'BR':
$result = $this->set_bind_recharge($order_info);
$result = $this->set_bind_recharge($order_info); break;
break; case 'SI':
case 'SI': $result = $this->set_order($order_info);
$result = $this->set_order($order_info); break;
break; case 'SS': // 超级签
$this->supersign_pay_notify(array(
'trade_id' => $order_info['trade_no'],
'order_id' => $order_info['out_trade_no']
));
break;
default: default:
exit('accident order data'); exit('accident order data');
@ -456,12 +459,6 @@ class NotifyController extends BaseController
case 'AG': case 'AG':
$result = $this->set_agent($order_info); $result = $this->set_agent($order_info);
break; break;
case 'SS': // 超级签
$ipa365 = new Ipa365Controller();
$result = $ipa365->pay_notify(array(
'trade_id' => $orderNo,
'order_id' => $billNo
));
default: default:
exit('accident order data'); exit('accident order data');
break; break;

@ -129,7 +129,7 @@
<div class="tr"> <div class="tr">
<label class="detailed-title detailed-label mr-300">订单金额:</label> <label class="detailed-title detailed-label mr-300">订单金额:</label>
<div class="detailed-content-box"> <div class="detailed-content-box">
<span>{$order_info.pay_amount}</span> <span>{$order_info.real_amount}</span>
</div> </div>
</div> </div>
</div> </div>
@ -138,7 +138,7 @@
<div class="tr"> <div class="tr">
<label class="detailed-title detailed-label mr-300">实付金额:</label> <label class="detailed-title detailed-label mr-300">实付金额:</label>
<div class="detailed-content-box"> <div class="detailed-content-box">
<span>{$order_info.real_amount}</span> <span>{$order_info.pay_amount}</span>
</div> </div>
</div> </div>
</div> </div>

@ -75,7 +75,7 @@
</a> </a>
</div> </div>
<div class="footer"> <div class="footer">
<p class="footer-up">闽ICP备19003775号-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;闽网文{2019} 1554-099</p> <p class="footer-up">琼ICP备19000556号-1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;琼网文20192354-200</p>
<p class="footer-down">抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。<br>适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。</p> <p class="footer-down">抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。<br>适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。</p>
</div> </div>
</div> </div>

@ -30,8 +30,7 @@ class AppleController extends BaseController{
*/ */
public function test() { public function test() {
$sqpay=new Sqpay(); $sqpay=new Sqpay();
var_dump(C("sqpay.partner")); $returl = C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
$returl = 'http://' . $_SERVER ['HTTP_HOST'] . "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
$data['secret'] = C("sqpay.key"); $data['secret'] = C("sqpay.key");
$data['merno'] = C("sqpay.partner"); $data['merno'] = C("sqpay.partner");
$data['amount'] = 0.01; $data['amount'] = 0.01;
@ -39,7 +38,7 @@ class AppleController extends BaseController{
$data['paymenttype'] = "ZFBZF"; $data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark"; $data['MerRemark'] = "mark";
$data['subject'] = "subject"; $data['subject'] = "subject";
$data['notifyurl'] = "http://"."api.wmtxkj.com"."/callback.php/Notify/sq_callback";//通知 $data['notifyurl'] = C('pay_header')."/callback.php/Notify/sq_callback";//通知
$data['returnurl'] = $returl; $data['returnurl'] = $returl;
$data['mchAppId'] = "wmtxkj.com"; $data['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName"; $data['mchAppName'] = "mchAppName";
@ -189,7 +188,7 @@ class AppleController extends BaseController{
$this->add_deposit($request); $this->add_deposit($request);
} }
$sqpay=new Sqpay(); $sqpay=new Sqpay();
$returl = 'http://' .C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id']; $returl = C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
$data['secret'] = C("sqpay.key"); $data['secret'] = C("sqpay.key");
$data['merno'] = C("sqpay.partner"); $data['merno'] = C("sqpay.partner");
$data['amount'] = $request['price']; $data['amount'] = $request['price'];
@ -197,7 +196,7 @@ class AppleController extends BaseController{
$data['paymenttype'] = "ZFBZF"; $data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark"; $data['MerRemark'] = "mark";
$data['subject'] = "subject"; $data['subject'] = "subject";
$data['notifyurl'] = "http://".C('pay_header')."/callback.php/Notify/sq_callback";//通知 $data['notifyurl'] =C('pay_header')."/callback.php/Notify/sq_callback";//通知
$data['returnurl'] = $returl; $data['returnurl'] = $returl;
$data['mchAppId'] = "wmtxkj.com"; $data['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName"; $data['mchAppName'] = "mchAppName";

@ -385,6 +385,8 @@ class BaseController extends RestController{
$data_spned['pay_order_number'] = $param["pay_order_number"]; $data_spned['pay_order_number'] = $param["pay_order_number"];
$data_spned['props_name'] = $param["title"]; $data_spned['props_name'] = $param["title"];
$data_spned['cost'] = $param["price"];//原价 $data_spned['cost'] = $param["price"];//原价
$data_spned['deduction_amount'] = $param["deduction_amount"];// 抵扣价格
$data_spned['discount_amount'] = $param["discount_amount"];// 折扣价格
$data_spned['pay_time'] = NOW_TIME; $data_spned['pay_time'] = NOW_TIME;
$data_spned['pay_status'] = $param["pay_status"]; $data_spned['pay_status'] = $param["pay_status"];
$data_spned['pay_game_status'] = 0; $data_spned['pay_game_status'] = 0;
@ -398,6 +400,8 @@ class BaseController extends RestController{
$data_spned['pay_amount'] = $param["price"]; $data_spned['pay_amount'] = $param["price"];
$data_spned['discount_type'] = 0; $data_spned['discount_type'] = 0;
} }
if (isset($param['actual_amount']) && $param['actual_amount'])
$data_spned['pay_amount'] = $param['actual_amount']; // 实际支付价格
$data_spned['spend_ip'] = $param["spend_ip"]; $data_spned['spend_ip'] = $param["spend_ip"];
$data_spned['sdk_version'] = $param["sdk_version"]; $data_spned['sdk_version'] = $param["sdk_version"];
if($param['small_user_id'] != $param['user_id']) { if($param['small_user_id'] != $param['user_id']) {

@ -67,29 +67,7 @@ class Ipa365Controller extends BaseController{
'game_id' => 1, 'game_id' => 1,
)); ));
} }
/*
* 支付成功通知验证后调用
* return 1订单不存在 2已支付 0成功 -1数据错误
*/
public function pay_notify($data) {
$order = M('game_supersign', 'tab_')->where(array(
'order_id' => $data['order_id']
))->find();
if (!$order) return 1;
if ($order['pay_status'] == 1) return 2;
$r = M('game_supersign', 'tab_')->where(array(
'order_id' => $data['order_id'],
'pay_status' => 0,
))->save(array(
'trade_id' => $data['trade_id'],
'pay_status' => 1,
'pay_time' => time()
));
if (!$r) return -1;
return 0;
}
/* /*
* 发起支付 * 发起支付
@ -121,7 +99,7 @@ class Ipa365Controller extends BaseController{
'id' => $gameId, 'id' => $gameId,
))->find(); ))->find();
if (!$gameInfo['supersign_token']) { if (!$gameInfo['supersign_token']) {
return "超级签token未填写"; $this->error("超级签token未填写");
} }
$r = M('game_supersign', 'tab_')->add(array( $r = M('game_supersign', 'tab_')->add(array(
@ -150,9 +128,8 @@ class Ipa365Controller extends BaseController{
$param['payway'] = 1; $param['payway'] = 1;
$param['title'] = $price; $param['title'] = $price;
$param['body'] = $price; $param['body'] = $price;
$param['callback'] = "http://192.168.11.14:8088/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}"; $param['callback'] = "https://api.wmtxkj.com/sdk.php/Ipa365/install_show/user_id/{$userId}/game_id/{$gameId}/order_id/{$orderId}";
$param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/sq_callback"; $param['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/notify/apitype/alipay";
$this->alipay($param);
$ret = $this->alipay($param); $ret = $this->alipay($param);

@ -1169,6 +1169,7 @@ class UserController extends BaseController
$res = $data = $user_play -> where($map) -> find(); $res = $data = $user_play -> where($map) -> find();
$user = M('user', 'tab_'); $user = M('user', 'tab_');
$user_data = $user -> find($user_id); $user_data = $user -> find($user_id);
$data['promote_id'] = $request['promote_id']; $data['promote_id'] = $request['promote_id'];
$data['promote_account'] = get_promote_account($request['promote_id']); $data['promote_account'] = get_promote_account($request['promote_id']);
$data['game_id'] = $request['game_id']; $data['game_id'] = $request['game_id'];
@ -1176,7 +1177,7 @@ class UserController extends BaseController
$data['server_id'] = $request['server_id']; $data['server_id'] = $request['server_id'];
$data['server_name'] = $request['server_name']; $data['server_name'] = $request['server_name'];
$data['role_name'] = $request['game_player_name']; $data['role_name'] = $request['game_player_name'];
// $data['role_name'] = $request['role_name']; $data['role_id'] = $request['game_player_id'];
$data['role_level'] = $request['role_level']; $data['role_level'] = $request['role_level'];
$data['user_id'] = $user_id; $data['user_id'] = $user_id;
$data['user_account'] = $user_data['account']; $data['user_account'] = $user_data['account'];
@ -1770,6 +1771,24 @@ class UserController extends BaseController
if (isset($r['union']) && $r['union'] == 1) if (isset($r['union']) && $r['union'] == 1)
$squnion_pay = 1; $squnion_pay = 1;
} }
// 双乾银联快捷支付
$shortcut_pay = 0;
$sqpay = M('tool','tab_')->field('status, config')->where(array('name'=>'sqpay'))->find();
if ($sqpay['status'] == 1) {
$r = json_decode($sqpay['config'], true);
if (isset($r['shortcut']) && $r['shortcut'] == 1)
$shortcut_pay = 1;
}
$user_id = $request['user_id'];
$game_id = $request['game_id'];
$balance = M ('user', 'tab_')->where (array(
'id' => $user_id
))->getField('balance');
$bind_balance = M('user_play', 'tab_')->where(array(
'user_id' => $user_id,
'game_id' => $game_id
))->getField('bind_balance');
// pp($squnion_pay); // pp($squnion_pay);
//0:APP 1:WAP //0:APP 1:WAP
$zfb_type = pay_set_status('alipay') == 1 ? (empty(C('alipay.way')) ? 0 : C('alipay.way')) : 1; $zfb_type = pay_set_status('alipay') == 1 ? (empty(C('alipay.way')) ? 0 : C('alipay.way')) : 1;
@ -1782,7 +1801,11 @@ class UserController extends BaseController
'zfb_type' => $zfb_type, 'zfb_type' => $zfb_type,
'ptb_game' => $ptb_game, 'ptb_game' => $ptb_game,
'bind_game' => $bind_game, 'bind_game' => $bind_game,
'squnion_pay' => $squnion_pay, 'squnion_pay' => $squnion_pay, // 银联0关 1开
'platform_coin' => $balance,
'bind_coin' => $bind_balance,
'wx_type' => 0, // 0微信 1 微信小程序 双乾
'shortcut_pay' => 0, // 快捷支付 0关 1开
))); )));
} }

@ -83,6 +83,28 @@ class WapPayController extends BaseController{
$prefix = $request['code'] == 1 ? "SP_" : "PF_"; $prefix = $request['code'] == 1 ? "SP_" : "PF_";
$out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4); $out_trade_no = $prefix.date('Ymd').date('His').sp_random_string(4);
// 优先扣除绑定币平台币
$deductionAmount = 0;
$user_id = $request['user_id'];
$game_id = $request['game_id'];
$balance = M ('user', 'tab_')->where (array(
'id' => $user_id
))->getField('balance');
$bind_balance = M('user_play', 'tab_')->where(array(
'user_id' => $user_id,
'game_id' => $game_id
))->getField('bind_balance');
// 够抵扣的情况 不走这个接口
$deductionAmount = $bind_balance + $balance;
if ($deductionAmount > $pay_amount) {
$this->set_message(1089,"fail","平台币足够,请关闭支付页面重新支付");
}
// 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额
$request['actual_amount'] = $request['price'] - $discountAmount - $deductionAmount;
$pay_amount = $request['actual_amount'];
$request['discount_amount'] = $discountAmount;
$request['deduction_amount'] = $deductionAmount;
if(get_zfb_type()==0){ if(get_zfb_type()==0){
$game_set_data = get_game_set_info($request['game_id']); $game_set_data = get_game_set_info($request['game_id']);
@ -103,7 +125,7 @@ class WapPayController extends BaseController{
"url" => $pay_url, "url" => $pay_url,
); );
} elseif (get_zfb_type() == 2) { } elseif (get_zfb_type() == 2) { // 双乾支付H5
$request['pay_order_number'] = $out_trade_no; $request['pay_order_number'] = $out_trade_no;
$request['pay_way'] = C('PAY_WAY.SQ_ALIPAY'); $request['pay_way'] = C('PAY_WAY.SQ_ALIPAY');
$request['pay_status'] = 0; $request['pay_status'] = 0;
@ -115,7 +137,7 @@ class WapPayController extends BaseController{
$this->add_deposit($request); $this->add_deposit($request);
} }
$sqpay=new Sqpay(); $sqpay=new Sqpay();
$returl = 'http://' .C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id']; $returl = C('pay_header'). "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
$data['secret'] = C("sqpay.key"); $data['secret'] = C("sqpay.key");
$data['merno'] = C("sqpay.partner"); $data['merno'] = C("sqpay.partner");
$data['amount'] = $request['price']; $data['amount'] = $request['price'];
@ -123,7 +145,7 @@ class WapPayController extends BaseController{
$data['paymenttype'] = "ZFBZF"; $data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark"; $data['MerRemark'] = "mark";
$data['subject'] = "subject"; $data['subject'] = "subject";
$data['notifyurl'] = "http://".C('pay_header')."/callback.php/Notify/sq_callback";//通知 $data['notifyurl'] = C('pay_header')."/callback.php/Notify/sq_callback";//通知
$data['returnurl'] = $returl; $data['returnurl'] = $returl;
$data['mchAppId'] = "wmtxkj.com"; $data['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName"; $data['mchAppName'] = "mchAppName";
@ -232,8 +254,9 @@ class WapPayController extends BaseController{
if ($payInfo['status'] == 'payed') { if ($payInfo['status'] == 'payed') {
$this->error("订单已支付"); $this->error("订单已支付");
} }
// 发起支付
if (IS_POST && $param['smsCode']) { if (IS_POST && $param['smsCode']) {
echo "发起支付==》".time()."<br>";
$rsp = $sqpay->shortcut_pay(array( $rsp = $sqpay->shortcut_pay(array(
'merNo' => C('sqpay.partner'), 'merNo' => C('sqpay.partner'),
'merOrderNo' => $payInfo['order_id'], 'merOrderNo' => $payInfo['order_id'],
@ -247,7 +270,7 @@ class WapPayController extends BaseController{
'smsCode' => $param['smsCode'], 'smsCode' => $param['smsCode'],
'secret' => C('sqpay.key'), 'secret' => C('sqpay.key'),
)); ));
echo "发起支付==》".time()."<br>";
sleep(5); sleep(5);
if ($rsp['responseCode'] == '88') { if ($rsp['responseCode'] == '88') {
redirect(U('Spend/pay_success',array('orderno' => $payInfo['order_id'], 'user_id'=>$param['user_id'],'game_id'=>$param['game_id'])));exit; redirect(U('Spend/pay_success',array('orderno' => $payInfo['order_id'], 'user_id'=>$param['user_id'],'game_id'=>$param['game_id'])));exit;
@ -260,6 +283,7 @@ class WapPayController extends BaseController{
// 发送短信 // 发送短信
if (IS_POST && !isset($param['smsCode'])) { if (IS_POST && !isset($param['smsCode'])) {
// 查看是否签约 // 查看是否签约
echo "查看是否签约==》".time()."<br>";
$rcs = $sqpay->contract_status(array( $rcs = $sqpay->contract_status(array(
'merNo' => C('sqpay.partner'), 'merNo' => C('sqpay.partner'),
'custName' => $param['custName'], 'custName' => $param['custName'],
@ -269,6 +293,7 @@ class WapPayController extends BaseController{
'payAmount' => $payInfo['price'], 'payAmount' => $payInfo['price'],
'secret' => C('sqpay.key'), 'secret' => C('sqpay.key'),
)); ));
echo "查看是否签约==》".time()."<br>";
if ($rcs['respCode'] == 4) { if ($rcs['respCode'] == 4) {
$this->error($rcs['respMessage'], '', true); $this->error($rcs['respMessage'], '', true);
pp($rcs); pp($rcs);
@ -276,6 +301,7 @@ class WapPayController extends BaseController{
} }
// 调用认证 签约 // 调用认证 签约
if ($rcs['respCode'] == 1 || $rcs['respCode'] == 2 || $rcs['respCode'] == 3) { if ($rcs['respCode'] == 1 || $rcs['respCode'] == 2 || $rcs['respCode'] == 3) {
echo "调用认证 签约==》".time()."<br>";
$rsign = $sqpay->sign_contract(array( $rsign = $sqpay->sign_contract(array(
'merNo' => C('sqpay.partner'), 'merNo' => C('sqpay.partner'),
'custName' => $param['custName'], 'custName' => $param['custName'],
@ -287,6 +313,7 @@ class WapPayController extends BaseController{
'custType' => '01', 'custType' => '01',
'secret' => C('sqpay.key'), 'secret' => C('sqpay.key'),
)); ));
echo "调用认证 签约==》".time()."<br>";
if ($rsign['respCode'] == 'success') { // 认证成功 接着签约 if ($rsign['respCode'] == 'success') { // 认证成功 接着签约
$rauth = $sqpay->sign_contract(array( $rauth = $sqpay->sign_contract(array(
'merNo' => C('sqpay.partner'), 'merNo' => C('sqpay.partner'),
@ -310,6 +337,7 @@ class WapPayController extends BaseController{
} }
// 无需签约 发送短信 // 无需签约 发送短信
if ($rcs['respCode'] == 0 || $rcs['respCode'] == 10) { if ($rcs['respCode'] == 0 || $rcs['respCode'] == 10) {
echo "发送短信==》".time()."<br>";
$ret = $sqpay->protocol_pay_send_sms(array( $ret = $sqpay->protocol_pay_send_sms(array(
'merNo' => C('sqpay.partner'), 'merNo' => C('sqpay.partner'),
'custName' => $param['custName'], 'custName' => $param['custName'],
@ -322,6 +350,7 @@ class WapPayController extends BaseController{
'NotifyURL' => "http://api.wmtxkj.com"."/callback.php?Notify/sq_callback", 'NotifyURL' => "http://api.wmtxkj.com"."/callback.php?Notify/sq_callback",
'purpose' => 'aaaa' 'purpose' => 'aaaa'
)); ));
echo "发送短信==》".time()."<br>";
if ($ret['resFlag'] == 'success') { if ($ret['resFlag'] == 'success') {
M('pay_info', 'tab_')->where(array( M('pay_info', 'tab_')->where(array(
'id' => $payInfo['id'], 'id' => $payInfo['id'],
@ -516,9 +545,8 @@ class WapPayController extends BaseController{
public function weixin_pay() public function weixin_pay()
{ {
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组 #获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$request = json_decode(base64_decode(file_get_contents("php://input")), true); $request = json_decode(base64_decode(file_get_contents("php://input")), true);
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
if (empty($request)) { if (empty($request)) {
$this->set_message(1001, "fail", "登录数据不能为空"); $this->set_message(1001, "fail", "登录数据不能为空");
@ -545,15 +573,36 @@ class WapPayController extends BaseController{
$user = get_user_entity($request['user_id']); $user = get_user_entity($request['user_id']);
$discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']); $discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']);
$discount = $discount['discount']; $discount = $discount['discount'];
$discountAmount = 0;
if($prefix=='PF_'){ if($prefix=='PF_'){
$pay_amount = $request['price']; $pay_amount = $request['price'];
}else{ }else{
$pay_amount = $discount * $request['price'] / 10; $pay_amount = $discount * $request['price'] / 10;
$discountAmount = $request['price'] - $pay_amount;
} }
if(!empty($request['scheme'])) { if(!empty($request['scheme'])) {
file_put_contents("./Application/Sdk/Scheme/".$request['game_id'].".txt",$request['scheme']); file_put_contents("./Application/Sdk/Scheme/".$request['game_id'].".txt",$request['scheme']);
} }
$deductionAmount = 0;
$user_id = $request['user_id'];
$game_id = $request['game_id'];
$balance = M ('user', 'tab_')->where (array(
'id' => $user_id
))->getField('balance');
$bind_balance = M('user_play', 'tab_')->where(array(
'user_id' => $user_id,
'game_id' => $game_id
))->getField('bind_balance');
// 够抵扣的情况 不走这个接口
$deductionAmount = $bind_balance + $balance;
if ($deductionAmount > $pay_amount) {
$this->set_message(1089,"fail","平台币足够,请关闭支付页面重新支付");
}
// 实际支付金额 = 支付总金额 - 折扣抵扣价格 - 绑币和平台币抵扣金额
$request['actual_amount'] = $request['price'] - $discountAmount - $deductionAmount;
$pay_amount = $request['actual_amount'];
$request['discount_amount'] = $discountAmount;
$request['deduction_amount'] = $deductionAmount;
$game_set_data = get_game_set_info($request['game_id']); $game_set_data = get_game_set_info($request['game_id']);
//$request['game_name'] //$request['game_name']

@ -7,33 +7,33 @@ use Think\Log;
class Sqpay class Sqpay
{ {
// H5 支付 双乾 // H5 支付 双乾 PaymentType "UNION","ZFBZF"
public function sq_pay($order_no,$amount=0.01,$merno="204121",$paymenttype="UNION", $subject="测试产品1", $ip=0,$returnurl=""){ public function sq_pay($data){
$returnurl = empty($returnurl)?"http://".$_SERVER['HTTP_HOST']:$returnurl;//成功跳转 /* $returnurl = empty($returnurl)?"http://".$_SERVER['HTTP_HOST']:$returnurl;//成功跳转
$notifyurl = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/sq_callback";//通知 $notifyurl = "http://".$_SERVER['HTTP_HOST']."/callback.php/Notify/sq_callback";//通知
$ordertime =date("Ymdhms",time()); $ordertime =date("Ymdhms",time());
// 168885 12345678 // 168885 12345678 */
$sign = md5("Amount={$amount}&BillNo={$order_no}&MerNo={$merno}&PayType=SMZF&".strtoupper(md5("NsyJOE!e"))); $sign = md5("Amount={$data['amount']}&BillNo={$data['order_no']}&MerNo={$data['merno']}&PayType=SMZF&".strtoupper(md5($data['secret'])));
$sign = strtoupper($sign); $sign = strtoupper($sign);
$params=[ $params=[
'MerNo' => $merno, 'MerNo' => $data['merno'],
'Amount'=>$amount, 'Amount'=>$data['amount'],
'BillNo'=>$order_no, 'BillNo'=>$data['order_no'],
'TranCode'=>"SMZF012", 'TranCode'=>"SMZF012",
'PayType'=> "SMZF", 'PayType'=> "SMZF",
'PaymentType'=> $paymenttype,//"UNION","ZFBZF", 'PaymentType'=> $data['paymenttype'],//"UNION","ZFBZF",
'MerRemark' => 'MerRemark', 'MerRemark' => $data['MerRemark'],
'subject' => $subject, 'subject' => $data['subject'],
'NotifyURL' => $notifyurl, 'NotifyURL' => $data['notifyurl'],
'ReturnURL' => $returnurl, 'ReturnURL' => $data['returnurl'],
'mchAppId' => 'https://www.95epay.cn', 'mchAppId' => $data['mchAppId'],
'mchAppName' => '追梦', 'mchAppName' => $data['mchAppName'],
'deviceInfo' => 'iOS_WAP', 'deviceInfo' => $data['deviceInfo'],
'clientIp' => $ip, 'clientIp' => $data['clientIp'],
// MD5("Amount=0.01&BillNo=1481093236896&MerNo=168885&PayType=SMZF &"+MD5("12345678").toUpperCase()).toUpperCase();
'MD5info' => $sign, 'MD5info' => $sign,
]; ];
var_dump($params);
$ret = curl_post("https://scan.95epay.cn/ScanCodePayment.action", $params); $ret = curl_post("https://scan.95epay.cn/ScanCodePayment.action", $params);
return $ret; return $ret;
@ -210,13 +210,12 @@ class Sqpay
$data['merNo'] = 168885; $data['merNo'] = 168885;
$data['secret'] = 12345678; */ $data['secret'] = 12345678; */
$data['custType'] = '02';
$data['transDate'] = date('Ymd'); $data['transDate'] = date('Ymd');
$data['transTime'] = date('His'); $data['transTime'] = date('His');
$bankInfo = $this->getbankinfo($data['cardNo']); $bankInfo = $this->getbankinfo($data['cardNo']);
$data['cardType'] = $bankInfo['cardType'] == 'CC' ? 2: 1; $data['cardType'] = $bankInfo['cardType'] == 'CC' ? 2: 1;
pp($bankInfo);
$sign = md5("authMsg=&bankCode={$bankInfo['bank']}&cardNo={$data['cardNo']}&cardType={$data['cardType']}&custName={$data['custName']}&custType={$data['custType']}&idNo={$data['idNo']}&idType=0&merNo={$data['merNo']}&payType=XYPAY&phoneNo={$data['phoneNo']}&reqMsgId={$data['reqMsgId']}&".strtoupper(md5($data['secret']))); $sign = md5("authMsg=&bankCode={$bankInfo['bank']}&cardNo={$data['cardNo']}&cardType={$data['cardType']}&custName={$data['custName']}&custType={$data['custType']}&idNo={$data['idNo']}&idType=0&merNo={$data['merNo']}&payType=XYPAY&phoneNo={$data['phoneNo']}&reqMsgId={$data['reqMsgId']}&".strtoupper(md5($data['secret'])));
$sign = strtoupper($sign); $sign = strtoupper($sign);
$param = array( $param = array(

Loading…
Cancel
Save