|
|
|
@ -274,19 +274,15 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
*/
|
|
|
|
|
public function ali_pay($user_id,$game_id){
|
|
|
|
|
#获取SDK上POST方式传过来的数据 然后base64解密 然后将json字符串转化成数组
|
|
|
|
|
//echo json_encode(['code'=>0,'msg'=> $user_id."game:".$game_id]);exit;
|
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
|
$request = $this->get_sdk_request($game_id);
|
|
|
|
|
$request['pay_order_number'] = "SP_".date('Ymd').date('His').sp_random_string(4);
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['pay_way'] = C("PAY_WAY.ALIPAY");
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
/* $file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
|
$request = json_decode(think_decrypt($file),true); */
|
|
|
|
|
C(api('Config/lists'));
|
|
|
|
|
/*
|
|
|
|
|
$request['user_id'] = 1;
|
|
|
|
|
$request['game_id'] = 1;
|
|
|
|
|
$request['price'] = 1.01;
|
|
|
|
|
$request['extend'] = 21111184;
|
|
|
|
|
$request['pay_order_number'] = 21111183;
|
|
|
|
|
$request['sdk_version'] = 2;
|
|
|
|
|
$request['code'] =1;
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
if (empty($request)) {
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'登录数据不能为空']);exit;
|
|
|
|
|
}
|
|
|
|
@ -296,7 +292,6 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
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();
|
|
|
|
|
if($game['pay_status'] == 0){
|
|
|
|
|
echo json_encode(['code'=>0,'msg'=>'该游戏暂时无法充值,请联系客服!']);exit;
|
|
|
|
@ -320,15 +315,14 @@ class PayH5Controller extends BaseController{
|
|
|
|
|
$request['signtype']= "MD5";
|
|
|
|
|
$request['server'] = "alipay.wap.create.direct.pay.by.user";
|
|
|
|
|
$request['payway'] = 1;
|
|
|
|
|
$request['title']=$request['price'];
|
|
|
|
|
$request['body']=$request['price'];
|
|
|
|
|
$request['title'] = "消费-".$request["pay_order_number"];
|
|
|
|
|
$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);
|
|
|
|
|
$request['pay_url'] = $pay_url['url']."&tx_client=hideopen";
|
|
|
|
|
$orderno = $pay_url['out_trade_no'];
|
|
|
|
|
// pp($request['pay_url']); todo: 又问提 死循环。。。
|
|
|
|
|
//echo json_encode(['code'=>200,'msg'=>'','data'=>['url'=>$pay_url['url'],'wap'=>1]]);exit;
|
|
|
|
|
} else {/* app */
|
|
|
|
|
$game_set_data = get_game_set_info($request['game_id']);
|
|
|
|
@ -635,12 +629,7 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
|
|
|
|
|
// redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
}elseif(get_wx_pay_type() == 1){
|
|
|
|
|
$request['pay_way'] = 4; // 威富通wx
|
|
|
|
|
if($request['code']==1){
|
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
|
}else{
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
}
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.WFT_PAY'); // 威富通wx
|
|
|
|
|
|
|
|
|
|
$pay['agent_id'] = C('heepay.partner');//商户号
|
|
|
|
|
$pay['order_no'] = $request['pay_order_number'];
|
|
|
|
@ -649,16 +638,17 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
|
|
|
|
|
$pay['amount'] = $request['price'];
|
|
|
|
|
$pay['user_ip'] = get_client_ip();
|
|
|
|
|
$pay['sign_key'] = C('heepay.key');//密钥
|
|
|
|
|
$pay['payerName'] = "cs";
|
|
|
|
|
$pay['payerName'] = "万盟天下";
|
|
|
|
|
$pay['number'] = 1;
|
|
|
|
|
$pay['goods_note']="cs";
|
|
|
|
|
$pay['goods_note']= "消费-".$request["pay_order_number"];
|
|
|
|
|
$pay['device'] = "wap";
|
|
|
|
|
$pay['bank_card_type'] = 0;
|
|
|
|
|
$pay['return_url'] ='http://' . $_SERVER ['HTTP_HOST'] . "/sdk.php/Spend/pay_success/orderno/".$pay['order_no'].'/game_id/'.$request['game_id'];
|
|
|
|
|
$pay['return_url'] = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$heepay = new Heepay();
|
|
|
|
|
$url = $heepay->wxh5_pay($pay);
|
|
|
|
|
$json_data['url'] = $url;
|
|
|
|
|
|
|
|
|
|
$request['pay_url'] = $url."&tx_client=hideopen";
|
|
|
|
|
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
}elseif(get_wx_pay_type() == 2){
|
|
|
|
|
|
|
|
|
|
if($request['code']==1){
|
|
|
|
@ -842,8 +832,8 @@ ADD COLUMN `pay_url` text NULL AFTER `check_sign`;
|
|
|
|
|
$data['order_no'] = $request['pay_order_number'];
|
|
|
|
|
$data['paymenttype'] = "UNION";
|
|
|
|
|
$data['MerRemark'] = "mark";
|
|
|
|
|
$data['subject'] = "游戏充值";
|
|
|
|
|
$data['notifyurl'] = "http://"."api.wmtxkj.com"."/callback.php/Notify/sq_callback";//通知
|
|
|
|
|
$data['subject'] = "消费-".$request["pay_order_number"];
|
|
|
|
|
$data['notifyurl'] = C("PAY_DOMAIN")."/callback.php/Notify/sq_callback";//通知
|
|
|
|
|
$data['returnurl'] = $returl;
|
|
|
|
|
$data['mchAppId'] = "wmtxkj.com";
|
|
|
|
|
$data['mchAppName'] = "mchAppName";
|
|
|
|
@ -1226,17 +1216,15 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
public function weixin_pay($user_id,$game_id) {
|
|
|
|
|
$file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
|
$request = json_decode(think_decrypt($file),true);
|
|
|
|
|
// Log::write("wxpay:".serialize($request));
|
|
|
|
|
/*$request['user_id'] = 1;
|
|
|
|
|
$request['game_id'] = 1;
|
|
|
|
|
$request['price'] = 157.01;
|
|
|
|
|
$request['extend'] = 21111178;
|
|
|
|
|
$request['pay_order_number'] = 21111178;
|
|
|
|
|
$request['sdk_version'] = 2;
|
|
|
|
|
$request['code'] =1;fd
|
|
|
|
|
*/
|
|
|
|
|
/* $file=file_get_contents("./Application/Sdk/OrderNo/".$user_id."-".$game_id.".txt");
|
|
|
|
|
$request = json_decode(think_decrypt($file),true); */
|
|
|
|
|
|
|
|
|
|
$request = $this->get_sdk_request($game_id);
|
|
|
|
|
$request['pay_order_number'] = "SP_".date('Ymd').date('His').sp_random_string(4);
|
|
|
|
|
$request['pay_status'] = 0;
|
|
|
|
|
$request['pay_way'] = C("PAY_WAY.WEIXIN");
|
|
|
|
|
$request['spend_ip'] = get_client_ip();
|
|
|
|
|
|
|
|
|
|
if (empty($request)) {
|
|
|
|
|
// $this->set_message(0, "fail", "登录数据不能为空");
|
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'登录数据不能为空', 'user_token' => $this->userToken)));exit;
|
|
|
|
@ -1278,7 +1266,7 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER
|
|
|
|
|
//0 官方 1威富通 2俊付通
|
|
|
|
|
if (get_wx_pay_type() == 0) {
|
|
|
|
|
$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(isset($request['title']) ? $request['title']: "充值", $request['pay_order_number'], $pay_amount, 'MWEB'), true);
|
|
|
|
|
|
|
|
|
|
if($is_pay['status']==1){
|
|
|
|
|
|
|
|
|
@ -1295,30 +1283,26 @@ ADD COLUMN `pay_url` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL AFTER
|
|
|
|
|
redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit;
|
|
|
|
|
}
|
|
|
|
|
}elseif(get_wx_pay_type() == 1){
|
|
|
|
|
$request['pay_way'] = 4; // 威富通wx
|
|
|
|
|
if($request['code']==1){
|
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
|
}else{
|
|
|
|
|
$this->add_deposit($request, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$pay['agent_id'] = C('heepay.partner');//商户号
|
|
|
|
|
$pay['order_no'] = $request['pay_order_number'];
|
|
|
|
|
$pay['time'] = date('YmdHis', time());
|
|
|
|
|
$pay['pay_type'] = 30;
|
|
|
|
|
$pay['amount'] = $request['price'];
|
|
|
|
|
$pay['user_ip'] = get_client_ip();
|
|
|
|
|
$pay['sign_key'] = C('heepay.key');//密钥
|
|
|
|
|
$pay['payerName'] = "cs";
|
|
|
|
|
$pay['number'] = 1;
|
|
|
|
|
$pay['goods_note']="cs";
|
|
|
|
|
$pay['device'] = "wap";
|
|
|
|
|
$pay['bank_card_type'] = 0;
|
|
|
|
|
$pay['return_url'] ='http://' . $_SERVER ['HTTP_HOST'] . "/sdk.php/Spend/pay_success/orderno/".$pay['order_no'].'/game_id/'.$request['game_id'];
|
|
|
|
|
$heepay = new Heepay();
|
|
|
|
|
$url = $heepay->wxh5_pay($pay);
|
|
|
|
|
$json_data['url'] = $url;
|
|
|
|
|
|
|
|
|
|
$request['pay_way'] = C('PAY_WAY.WFT_PAY'); // 威富通wx
|
|
|
|
|
|
|
|
|
|
$pay['agent_id'] = C('heepay.partner');//商户号
|
|
|
|
|
$pay['order_no'] = $request['pay_order_number'];
|
|
|
|
|
$pay['time'] = date('YmdHis', time());
|
|
|
|
|
$pay['pay_type'] = 30;
|
|
|
|
|
$pay['amount'] = $request['price'];
|
|
|
|
|
$pay['user_ip'] = get_client_ip();
|
|
|
|
|
$pay['sign_key'] = C('heepay.key');//密钥
|
|
|
|
|
$pay['payerName'] = "万盟天下";
|
|
|
|
|
$pay['number'] = 1;
|
|
|
|
|
$pay['goods_note']= "消费-".$request["pay_order_number"];
|
|
|
|
|
$pay['device'] = "wap";
|
|
|
|
|
$pay['bank_card_type'] = 0;
|
|
|
|
|
$pay['return_url'] = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
|
|
|
|
|
$heepay = new Heepay();
|
|
|
|
|
$url = $heepay->wxh5_pay($pay);
|
|
|
|
|
$request['pay_url'] = $url."&tx_client=hideopen";
|
|
|
|
|
|
|
|
|
|
$this->add_spend($request,1);
|
|
|
|
|
}elseif(get_wx_pay_type() == 2){
|
|
|
|
|
|
|
|
|
|
if($request['code']==1){
|
|
|
|
|