|
|
|
@ -3,6 +3,7 @@
|
|
|
|
|
namespace Admin\Controller;
|
|
|
|
|
use User\Api\UserApi as UserApi;
|
|
|
|
|
use Common\Api\GameApi;
|
|
|
|
|
use Callback\Controller\BaseController;
|
|
|
|
|
/**
|
|
|
|
|
* 后台首页控制器
|
|
|
|
|
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
|
|
|
@ -17,7 +18,20 @@ class RepairController extends ThinkController {
|
|
|
|
|
$result=$game->game_pay_notify($param,1);
|
|
|
|
|
}
|
|
|
|
|
$spend = M('Spend',"tab_");
|
|
|
|
|
|
|
|
|
|
if($result == "success"){
|
|
|
|
|
$auth = session('user_auth');
|
|
|
|
|
// 补单记录
|
|
|
|
|
M('repair_pay', 'tab_')->add([
|
|
|
|
|
'admin_id' => $auth['uid'],
|
|
|
|
|
'admin_name' => $auth['username'],
|
|
|
|
|
'pay_order_number' => $orderNo,
|
|
|
|
|
'ip' => get_client_ip(),
|
|
|
|
|
'tab' => 'spend',
|
|
|
|
|
'create_time' => time(),
|
|
|
|
|
'type' => 1 // 补单
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
$rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1));
|
|
|
|
|
$this->ajaxReturn(array('status'=>1,'msg'=>'补单成功'));
|
|
|
|
|
}else{
|
|
|
|
@ -97,6 +111,107 @@ class RepairController extends ThinkController {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 游戏充值补单
|
|
|
|
|
*/
|
|
|
|
|
public function noticePayed($orderNo, $second, $type) {
|
|
|
|
|
$auth = session('user_auth');
|
|
|
|
|
|
|
|
|
|
if (IS_AJAX) {
|
|
|
|
|
if ($type != 'spend' && $type != 'deposit') {
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'参数有误']);
|
|
|
|
|
}
|
|
|
|
|
$tab = $type;
|
|
|
|
|
|
|
|
|
|
if (!$orderNo || !$second) {
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'参数不足']);
|
|
|
|
|
}
|
|
|
|
|
$r = D('Member')->check_sc_pwd($second);
|
|
|
|
|
if (!$r) {
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'二级密码错误']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
M($tab, 'tab_')->startTrans();
|
|
|
|
|
$order = M($tab, 'tab_')->where(['pay_order_number' => $orderNo])->find();
|
|
|
|
|
if ($order['pay_status'] == 1) {
|
|
|
|
|
M($tab, 'tab_')->rollback();
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'支付成功,无需补单']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$r = M($tab, 'tab_')->where([
|
|
|
|
|
'pay_order_number' => $orderNo,
|
|
|
|
|
'pay_status' => 0
|
|
|
|
|
])->save([
|
|
|
|
|
'pay_status' => 1
|
|
|
|
|
]);
|
|
|
|
|
if ($r) {
|
|
|
|
|
|
|
|
|
|
$cpFlag = 0; // 0 通知cp失败 1 成功
|
|
|
|
|
// 通知cp
|
|
|
|
|
if ($tab == 'spend') {
|
|
|
|
|
$param['out_trade_no'] = $orderNo;
|
|
|
|
|
$game = new GameApi();
|
|
|
|
|
$result=$game->game_pay_notify($param,1);
|
|
|
|
|
$spend = M($tab, "tab_");
|
|
|
|
|
if($result == "success"){
|
|
|
|
|
$rr = $spend->where(array('pay_order_number'=>$orderNo))->save(array('pay_game_status'=>1));
|
|
|
|
|
if ($rr) {
|
|
|
|
|
$cpFlag = 1;
|
|
|
|
|
M('spend', 'tab_')->commit();
|
|
|
|
|
} else {
|
|
|
|
|
M($tab, 'tab_')->rollback();
|
|
|
|
|
$this->ajaxReturn(array('status'=>1,'msg'=>'补单失败.'));
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
M($tab, 'tab_')->commit();
|
|
|
|
|
}
|
|
|
|
|
} else { // deposit
|
|
|
|
|
M('spend', 'tab_')->commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 通知到账记录
|
|
|
|
|
M('repair_pay', 'tab_')->add([
|
|
|
|
|
'admin_id' => $auth['uid'],
|
|
|
|
|
'admin_name' => $auth['username'],
|
|
|
|
|
'pay_order_number' => $orderNo,
|
|
|
|
|
'ip' => get_client_ip(),
|
|
|
|
|
'tab' => $tab,
|
|
|
|
|
'create_time' => time(),
|
|
|
|
|
'type' => 0
|
|
|
|
|
]);
|
|
|
|
|
if ($tab == 'spend' && $cpFlag === 1) {
|
|
|
|
|
// 补单记录
|
|
|
|
|
M('repair_pay', 'tab_')->add([
|
|
|
|
|
'admin_id' => $auth['uid'],
|
|
|
|
|
'admin_name' => $auth['username'],
|
|
|
|
|
'pay_order_number' => $orderNo,
|
|
|
|
|
'ip' => get_client_ip(),
|
|
|
|
|
'tab' => $tab,
|
|
|
|
|
'create_time' => time(),
|
|
|
|
|
'type' => 1
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// todo: 分红 上级奖励等
|
|
|
|
|
if ($tab == 'spend' && $cpFlag == 0) {
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功,通知CP失败!']);
|
|
|
|
|
}
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'充值补单成功!']);
|
|
|
|
|
} else {
|
|
|
|
|
M('spend', 'tab_')->rollback();
|
|
|
|
|
$this->ajaxReturn(['status'=>0,'msg'=>'补单失败,请重试']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 平台币充值补单
|
|
|
|
|
*/
|
|
|
|
|
public function platform($orderNo) {
|
|
|
|
|
if (IS_AJAX) {
|
|
|
|
|
$payOrderNumber = I('request.pay_order_number');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|