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

master
zhengchanglong 5 years ago
commit 622ef0571e

@ -384,7 +384,7 @@
<tr>
<td class="l">超级签URL</td>
<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>
</tr>
</tbody>

@ -25,6 +25,19 @@
height:26px;line-height:26px;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>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
@ -69,8 +82,10 @@
<tr>
<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>
@ -87,8 +102,10 @@
<?php $gamename = trim($data['game_name']);
$servername = trim($data['server_name']);
$rolename = trim($data['role_name']);?>
<td><notempty name="gamename">{$gamename}<else /></notempty></td>
<td><notempty name="servername">{$servername}<else /></notempty></td>
<td><notempty name="gamename">{$gamename}<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>{$data.role_level}</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'];
$d = $spend->where($map)->find();
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){
$data_save['pay_status'] = 1;
$data_save['order_number'] = $data['trade_no'];
@ -165,6 +170,30 @@ class BaseController extends Controller {
return true;
}
}
/*
* 超级签支付成功通知验证后调用
* 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;
}
/**

@ -23,7 +23,7 @@ class NotifyController extends BaseController
public function notify()
{
C(api('Config/lists'));
$apitype = I('get.apitype');#获取支付api类型
@ -63,19 +63,17 @@ class NotifyController extends BaseController
}
$pay = new \Think\Pay($pay_way, C($apitype));
if ($pay->verifyNotify($notify)) {
//获取回调订单信息
$order_info = $pay->getInfo();
if ($order_info['status']) {
$pay_where = substr($order_info['out_trade_no'], 0, 2);
$result = false;
switch ($pay_where) {
case 'SP':
@ -102,12 +100,17 @@ class NotifyController extends BaseController
break;
case 'BR':
$result = $this->set_bind_recharge($order_info);
break;
case 'SI':
$result = $this->set_order($order_info);
break;
$result = $this->set_bind_recharge($order_info);
break;
case 'SI':
$result = $this->set_order($order_info);
break;
case 'SS': // 超级签
$this->supersign_pay_notify(array(
'trade_id' => $order_info['trade_no'],
'order_id' => $order_info['out_trade_no']
));
break;
default:
exit('accident order data');
@ -456,12 +459,6 @@ class NotifyController extends BaseController
case 'AG':
$result = $this->set_agent($order_info);
break;
case 'SS': // 超级签
$ipa365 = new Ipa365Controller();
$result = $ipa365->pay_notify(array(
'trade_id' => $orderNo,
'order_id' => $billNo
));
default:
exit('accident order data');
break;

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

@ -75,7 +75,7 @@
</a>
</div>
<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>
</div>
</div>

@ -30,8 +30,7 @@ class AppleController extends BaseController{
*/
public function test() {
$sqpay=new Sqpay();
var_dump(C("sqpay.partner"));
$returl = 'http://' . $_SERVER ['HTTP_HOST'] . "/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['merno'] = C("sqpay.partner");
$data['amount'] = 0.01;
@ -39,7 +38,7 @@ class AppleController extends BaseController{
$data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark";
$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['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName";
@ -189,7 +188,7 @@ class AppleController extends BaseController{
$this->add_deposit($request);
}
$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['merno'] = C("sqpay.partner");
$data['amount'] = $request['price'];
@ -197,7 +196,7 @@ class AppleController extends BaseController{
$data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark";
$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['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName";

@ -385,6 +385,8 @@ class BaseController extends RestController{
$data_spned['pay_order_number'] = $param["pay_order_number"];
$data_spned['props_name'] = $param["title"];
$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_status'] = $param["pay_status"];
$data_spned['pay_game_status'] = 0;
@ -398,6 +400,8 @@ class BaseController extends RestController{
$data_spned['pay_amount'] = $param["price"];
$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['sdk_version'] = $param["sdk_version"];
if($param['small_user_id'] != $param['user_id']) {

@ -67,29 +67,7 @@ class Ipa365Controller extends BaseController{
'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,
))->find();
if (!$gameInfo['supersign_token']) {
return "超级签token未填写";
$this->error("超级签token未填写");
}
$r = M('game_supersign', 'tab_')->add(array(
@ -150,9 +128,8 @@ class Ipa365Controller extends BaseController{
$param['payway'] = 1;
$param['title'] = $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['notifyurl'] = "https://api.wmtxkj.com/callback.php/Notify/sq_callback";
$this->alipay($param);
$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/notify/apitype/alipay";
$ret = $this->alipay($param);

@ -1169,6 +1169,7 @@ class UserController extends BaseController
$res = $data = $user_play -> where($map) -> find();
$user = M('user', 'tab_');
$user_data = $user -> find($user_id);
$data['promote_id'] = $request['promote_id'];
$data['promote_account'] = get_promote_account($request['promote_id']);
$data['game_id'] = $request['game_id'];
@ -1176,7 +1177,7 @@ class UserController extends BaseController
$data['server_id'] = $request['server_id'];
$data['server_name'] = $request['server_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['user_id'] = $user_id;
$data['user_account'] = $user_data['account'];
@ -1770,6 +1771,24 @@ class UserController extends BaseController
if (isset($r['union']) && $r['union'] == 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);
//0:APP 1:WAP
$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,
'ptb_game' => $ptb_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开
)));
}

@ -82,6 +82,28 @@ class WapPayController extends BaseController{
$prefix = $request['code'] == 1 ? "SP_" : "PF_";
$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){
$game_set_data = get_game_set_info($request['game_id']);
@ -103,7 +125,7 @@ class WapPayController extends BaseController{
"url" => $pay_url,
);
} elseif (get_zfb_type() == 2) {
} elseif (get_zfb_type() == 2) { // 双乾支付H5
$request['pay_order_number'] = $out_trade_no;
$request['pay_way'] = C('PAY_WAY.SQ_ALIPAY');
$request['pay_status'] = 0;
@ -115,7 +137,7 @@ class WapPayController extends BaseController{
$this->add_deposit($request);
}
$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['merno'] = C("sqpay.partner");
$data['amount'] = $request['price'];
@ -123,7 +145,7 @@ class WapPayController extends BaseController{
$data['paymenttype'] = "ZFBZF";
$data['MerRemark'] = "mark";
$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['mchAppId'] = "wmtxkj.com";
$data['mchAppName'] = "mchAppName";
@ -232,8 +254,9 @@ class WapPayController extends BaseController{
if ($payInfo['status'] == 'payed') {
$this->error("订单已支付");
}
// 发起支付
if (IS_POST && $param['smsCode']) {
echo "发起支付==》".time()."<br>";
$rsp = $sqpay->shortcut_pay(array(
'merNo' => C('sqpay.partner'),
'merOrderNo' => $payInfo['order_id'],
@ -247,7 +270,7 @@ class WapPayController extends BaseController{
'smsCode' => $param['smsCode'],
'secret' => C('sqpay.key'),
));
echo "发起支付==》".time()."<br>";
sleep(5);
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;
@ -260,6 +283,7 @@ class WapPayController extends BaseController{
// 发送短信
if (IS_POST && !isset($param['smsCode'])) {
// 查看是否签约
echo "查看是否签约==》".time()."<br>";
$rcs = $sqpay->contract_status(array(
'merNo' => C('sqpay.partner'),
'custName' => $param['custName'],
@ -269,6 +293,7 @@ class WapPayController extends BaseController{
'payAmount' => $payInfo['price'],
'secret' => C('sqpay.key'),
));
echo "查看是否签约==》".time()."<br>";
if ($rcs['respCode'] == 4) {
$this->error($rcs['respMessage'], '', true);
pp($rcs);
@ -276,6 +301,7 @@ class WapPayController extends BaseController{
}
// 调用认证 签约
if ($rcs['respCode'] == 1 || $rcs['respCode'] == 2 || $rcs['respCode'] == 3) {
echo "调用认证 签约==》".time()."<br>";
$rsign = $sqpay->sign_contract(array(
'merNo' => C('sqpay.partner'),
'custName' => $param['custName'],
@ -287,6 +313,7 @@ class WapPayController extends BaseController{
'custType' => '01',
'secret' => C('sqpay.key'),
));
echo "调用认证 签约==》".time()."<br>";
if ($rsign['respCode'] == 'success') { // 认证成功 接着签约
$rauth = $sqpay->sign_contract(array(
'merNo' => C('sqpay.partner'),
@ -310,6 +337,7 @@ class WapPayController extends BaseController{
}
// 无需签约 发送短信
if ($rcs['respCode'] == 0 || $rcs['respCode'] == 10) {
echo "发送短信==》".time()."<br>";
$ret = $sqpay->protocol_pay_send_sms(array(
'merNo' => C('sqpay.partner'),
'custName' => $param['custName'],
@ -322,6 +350,7 @@ class WapPayController extends BaseController{
'NotifyURL' => "http://api.wmtxkj.com"."/callback.php?Notify/sq_callback",
'purpose' => 'aaaa'
));
echo "发送短信==》".time()."<br>";
if ($ret['resFlag'] == 'success') {
M('pay_info', 'tab_')->where(array(
'id' => $payInfo['id'],
@ -516,9 +545,8 @@ class WapPayController extends BaseController{
public function weixin_pay()
{
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
/* file_put_contents(dirname(__FILE__) . '/weixin_paywap.txt',json_encode($request)); */
if (empty($request)) {
$this->set_message(1001, "fail", "登录数据不能为空");
@ -545,15 +573,36 @@ class WapPayController extends BaseController{
$user = get_user_entity($request['user_id']);
$discount = $this->get_discount($request['game_id'],$user['promote_id'],$request['user_id']);
$discount = $discount['discount'];
$discountAmount = 0;
if($prefix=='PF_'){
$pay_amount = $request['price'];
}else{
$pay_amount = $discount * $request['price'] / 10;
$discountAmount = $request['price'] - $pay_amount;
}
if(!empty($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']);
//$request['game_name']

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

Loading…
Cancel
Save