|
|
@ -12,47 +12,7 @@ use Qiniu\json_decode;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class AppleController extends BaseController{
|
|
|
|
class AppleController extends BaseController{
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 'MerNo' => $data['merno'],
|
|
|
|
|
|
|
|
'Amount'=>$data['amount'],
|
|
|
|
|
|
|
|
'BillNo'=>$data['order_no'],
|
|
|
|
|
|
|
|
'TranCode'=>"SMZF012",
|
|
|
|
|
|
|
|
'PayType'=> "SMZF",
|
|
|
|
|
|
|
|
'PaymentType'=> $data['paymenttype'],//"UNION","ZFBZF",
|
|
|
|
|
|
|
|
'MerRemark' => 'MerRemark',
|
|
|
|
|
|
|
|
'subject' => $data['subject'],
|
|
|
|
|
|
|
|
'NotifyURL' => $data['notifyurl'],
|
|
|
|
|
|
|
|
'ReturnURL' => $data['returnurl'],
|
|
|
|
|
|
|
|
'mchAppId' => $data['mchAppId'],
|
|
|
|
|
|
|
|
'mchAppName' => $data['mchAppName'],
|
|
|
|
|
|
|
|
'deviceInfo' => $data['deviceInfo'],
|
|
|
|
|
|
|
|
'clientIp' => $data['clientIp'],
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
public function test() {
|
|
|
|
|
|
|
|
$sqpay=new Sqpay();
|
|
|
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
$data['order_no'] = '111111';
|
|
|
|
|
|
|
|
$data['paymenttype'] = "ZFBZF";
|
|
|
|
|
|
|
|
$data['MerRemark'] = "mark";
|
|
|
|
|
|
|
|
$data['subject'] = "subject";
|
|
|
|
|
|
|
|
$data['notifyurl'] = C('pay_header')."/callback.php/Notify/sq_callback";//通知
|
|
|
|
|
|
|
|
$data['returnurl'] = $returl;
|
|
|
|
|
|
|
|
$data['mchAppId'] = "wmtxkj.com";
|
|
|
|
|
|
|
|
$data['mchAppName'] = "mchAppName";
|
|
|
|
|
|
|
|
$data['deviceInfo'] = "AND_WAP";
|
|
|
|
|
|
|
|
$data['clientIp'] = get_client_ip();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$ret = $sqpay->sq_pay($data);
|
|
|
|
|
|
|
|
$ret = json_decode($ret, true);
|
|
|
|
|
|
|
|
pp($ret);
|
|
|
|
|
|
|
|
$json_data['url']=$ret[0]['payHtml'];
|
|
|
|
|
|
|
|
echo ($json_data['url']);
|
|
|
|
|
|
|
|
exit();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
*ios移动支付
|
|
|
|
*ios移动支付
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -70,6 +30,11 @@ class AppleController extends BaseController{
|
|
|
|
if(!is_array(find_uc_account($request['account']))){
|
|
|
|
if(!is_array(find_uc_account($request['account']))){
|
|
|
|
$this->set_message(0,"fail","Uc用户暂不支持");
|
|
|
|
$this->set_message(0,"fail","Uc用户暂不支持");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 支付验证 是否让支付
|
|
|
|
|
|
|
|
$payCheck = pay_check($request['user_id']);
|
|
|
|
|
|
|
|
if (!$payCheck['code']) {
|
|
|
|
|
|
|
|
$this->set_message(1088, "fail", $payCheck['msg']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id'],'pay_status'=>1))->find();
|
|
|
|
$extend_data = M('spend','tab_')->where(array('extend'=>$request['extend'],'game_id'=>$request['game_id'],'pay_status'=>1))->find();
|
|
|
|
if($extend_data){
|
|
|
|
if($extend_data){
|
|
|
@ -126,9 +91,18 @@ class AppleController extends BaseController{
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
C(api('Config/lists'));
|
|
|
|
C(api('Config/lists'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($request)) {
|
|
|
|
if (empty($request)) {
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'登录数据不能为空']);exit;
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'登录数据不能为空']);exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 支付验证 是否让支付
|
|
|
|
|
|
|
|
$payCheck = pay_check($request['user_id']);
|
|
|
|
|
|
|
|
if (!$payCheck['code']) {
|
|
|
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=> $payCheck['msg']]);exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'该游戏暂时无法充值,请联系客服!']);exit;
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'该游戏暂时无法充值,请联系客服!']);exit;
|
|
|
@ -152,7 +126,10 @@ class AppleController extends BaseController{
|
|
|
|
$request['payway'] = 1;
|
|
|
|
$request['payway'] = 1;
|
|
|
|
$request['title']=$request['price'];
|
|
|
|
$request['title']=$request['price'];
|
|
|
|
$request['body']=$request['price'];
|
|
|
|
$request['body']=$request['price'];
|
|
|
|
|
|
|
|
$request['callback'] = 'http://'.$_SERVER['HTTP_HOST']. "/sdk.php/Spend/pay_success/orderno/".$request['pay_order_number'].'/game_id/'.$request['game_id'];
|
|
|
|
|
|
|
|
$request['notifyurl'] = 'http://'.$_SERVER['HTTP_HOST']. "/callback.php/Notify/notify/apitype/alipay/method/notify";
|
|
|
|
$pay_url=$this->pay($request);
|
|
|
|
$pay_url=$this->pay($request);
|
|
|
|
|
|
|
|
//echo $pay_url['url'];die;
|
|
|
|
//redirect($pay_url['url']);
|
|
|
|
//redirect($pay_url['url']);
|
|
|
|
echo json_encode(['code'=>200,'msg'=>'','data'=>['url'=>$pay_url['url'],'wap'=>1]]);exit;
|
|
|
|
echo json_encode(['code'=>200,'msg'=>'','data'=>['url'=>$pay_url['url'],'wap'=>1]]);exit;
|
|
|
|
} else {/* app */
|
|
|
|
} else {/* app */
|
|
|
@ -339,6 +316,8 @@ class AppleController extends BaseController{
|
|
|
|
->setGameName(get_game_name($param['game_id']))
|
|
|
|
->setGameName(get_game_name($param['game_id']))
|
|
|
|
->setGameAppid($param['game_appid'])
|
|
|
|
->setGameAppid($param['game_appid'])
|
|
|
|
->setServerId(0)
|
|
|
|
->setServerId(0)
|
|
|
|
|
|
|
|
->setCallback($param['callback'])
|
|
|
|
|
|
|
|
->setNotifyUrl($param['notifyurl'])
|
|
|
|
->setGameplayerName($param['game_player_name'])
|
|
|
|
->setGameplayerName($param['game_player_name'])
|
|
|
|
->setServerName($param['server_name'])
|
|
|
|
->setServerName($param['server_name'])
|
|
|
|
->setUserId($param['user_id'])
|
|
|
|
->setUserId($param['user_id'])
|
|
|
@ -366,10 +345,23 @@ class AppleController extends BaseController{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
|
|
|
|
/*$request['user_id'] = 1;
|
|
|
|
|
|
|
|
$request['game_id'] = 1;
|
|
|
|
|
|
|
|
$request['price'] = 0.01;
|
|
|
|
|
|
|
|
$request['extend'] = 21111177;
|
|
|
|
|
|
|
|
$request['pay_order_number'] = 21111177;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$request['code'] =1;
|
|
|
|
|
|
|
|
*/
|
|
|
|
if (empty($request)) {
|
|
|
|
if (empty($request)) {
|
|
|
|
// $this->set_message(0, "fail", "登录数据不能为空");
|
|
|
|
// $this->set_message(0, "fail", "登录数据不能为空");
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空')));exit;
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空')));exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 支付验证 是否让支付
|
|
|
|
|
|
|
|
$payCheck = pay_check($request['user_id']);
|
|
|
|
|
|
|
|
if (!$payCheck['code']) {
|
|
|
|
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=> $payCheck['msg'])));exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
C(api('Config/lists'));
|
|
|
|
C(api('Config/lists'));
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
@ -400,6 +392,7 @@ class AppleController extends BaseController{
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
$weixn = new Weixin();
|
|
|
|
$weixn = new Weixin();
|
|
|
|
$is_pay = json_decode($weixn->weixin_pay("充值", $request['pay_order_number'], $pay_amount, 'MWEB'), true);
|
|
|
|
$is_pay = json_decode($weixn->weixin_pay("充值", $request['pay_order_number'], $pay_amount, 'MWEB'), true);
|
|
|
|
|
|
|
|
|
|
|
|
if($is_pay['status']==1){
|
|
|
|
if($is_pay['status']==1){
|
|
|
|
if($request['code']==1){
|
|
|
|
if($request['code']==1){
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
$this->add_spend($request,1);
|
|
|
@ -550,6 +543,11 @@ class AppleController extends BaseController{
|
|
|
|
if (empty($request)) {
|
|
|
|
if (empty($request)) {
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空')));exit;
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空')));exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 支付验证 是否让支付
|
|
|
|
|
|
|
|
$payCheck = pay_check($request['user_id']);
|
|
|
|
|
|
|
|
if (!$payCheck['code']) {
|
|
|
|
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$payCheck['msg'])));exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
$game = M('Game','tab_')->where(['id'=>$request['game_id']])->field('pay_status')->find();
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'该游戏暂时无法充值,请联系客服!')));exit;
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'该游戏暂时无法充值,请联系客服!')));exit;
|
|
|
@ -628,6 +626,11 @@ class AppleController extends BaseController{
|
|
|
|
if (empty($request)) {
|
|
|
|
if (empty($request)) {
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'参数错误')));exit;
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'参数错误')));exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 支付验证 是否让支付
|
|
|
|
|
|
|
|
$payCheck = pay_check($request['user_id']);
|
|
|
|
|
|
|
|
if (!$payCheck['code']) {
|
|
|
|
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=> $payCheck['msg'])));exit;
|
|
|
|
|
|
|
|
}
|
|
|
|
C(api('Config/lists'));
|
|
|
|
C(api('Config/lists'));
|
|
|
|
$user_info = get_user_entity($request['user_id']);
|
|
|
|
$user_info = get_user_entity($request['user_id']);
|
|
|
|
if($user_info['lock_status'] == 0 || $user_info['check_status'] == 0){
|
|
|
|
if($user_info['lock_status'] == 0 || $user_info['check_status'] == 0){
|
|
|
|