Merge pull request 'feature/wx_share' (#15) from feature/wx_share into master

Reviewed-on: http://8.136.139.249:3000/wmtx/sdk/pulls/15
master
廖金灵 3 years ago
commit 5dac9fe864

@ -51,11 +51,15 @@ class PayService {
Vendor("WxPayPubHelper.WxPayPubHelper"); Vendor("WxPayPubHelper.WxPayPubHelper");
$orderQuery = new \OrderQuery_pub($payConf['appid'], $payConf['partner'], $payConf['key']); $orderQuery = new \OrderQuery_pub($payConf['appid'], $payConf['partner'], $payConf['key']);
$orderQuery->setParameter('out_trade_no', $orderInfo['out_trade_no']);//商户订单号 $orderQuery->setParameter('out_trade_no', $orderInfo['out_trade_no']);//商户订单号
if (C('SHARE_ID.'.$payConf['partner']) == 'y' || C('SHARE_ID.'.$payConf['partner']) == 'n') {
$orderQuery->setParameter("sub_mch_id", C('SHARE_PAIR.'.$payConf['partner']));
}
$result = $orderQuery->getResult(); $result = $orderQuery->getResult();
Log::write("wechatQUERYFAIL->".serialize($result), Log::DEBUG);
if($result['trade_state']=='SUCCESS') { if($result['trade_state']=='SUCCESS') {
return true; return true;
} }
Log::write("wechatQUERYFAIL->".serialize($result), Log::DEBUG);
return false; return false;
} }

@ -590,6 +590,7 @@ class BaseController extends RestController
$data_spned['merchant_id'] = isset($param['merchant_id']) ? $param['merchant_id'] : 0 ; $data_spned['merchant_id'] = isset($param['merchant_id']) ? $param['merchant_id'] : 0 ;
$data_spned['merchant_way'] = isset($param['merchant_way']) ? $param['merchant_way'] : 0; $data_spned['merchant_way'] = isset($param['merchant_way']) ? $param['merchant_way'] : 0;
$data_spned['partner_type'] = isset($param['main_id']) ? $param['main_id'] : 0; $data_spned['partner_type'] = isset($param['main_id']) ? $param['main_id'] : 0;
$data_spned['share_status'] = isset($param['share_status']) ? $param['share_status'] : 0;
return $data_spned; return $data_spned;
} }
@ -627,6 +628,8 @@ class BaseController extends RestController
$data_deposit['merchant_way'] = isset($param['merchant_way']) ? $param['merchant_way'] : 0; $data_deposit['merchant_way'] = isset($param['merchant_way']) ? $param['merchant_way'] : 0;
$data_deposit['partner_type'] = isset($param['main_id']) ? $param['main_id'] : 0; $data_deposit['partner_type'] = isset($param['main_id']) ? $param['main_id'] : 0;
$data_deposit['share_status'] = isset($param['share_status']) ? $param['share_status'] : 0;
return $data_deposit; return $data_deposit;
} }

@ -764,6 +764,9 @@ class PayH5Controller extends BaseController{
$request['merchant_id'] = $pay_info['id']; $request['merchant_id'] = $pay_info['id'];
$request['merchant_way'] = self::WX_PAY; $request['merchant_way'] = self::WX_PAY;
$request['main_id'] = $main_id; $request['main_id'] = $main_id;
if (C('SHARE_ID.'.$pay_conf['partner']) == 'y') {
$request['share_status'] = 1;
}
$this->add_deposit($request, 1); $this->add_deposit($request, 1);
// .(is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ; // .(is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ;
/* if (I('request.api_ver') == 1) { /* if (I('request.api_ver') == 1) {
@ -772,6 +775,8 @@ class PayH5Controller extends BaseController{
} */ } */
}else{ }else{
jsonOutput(0, "支付失败"); jsonOutput(0, "支付失败");
Log::write("platform_weixin_pay支付失败".serialize($is_pay));
exit();
// redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit; // redirect(U('Spend/notice',array('user_id'=>$user_id, 'is_platform' => 1,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit;
} }
}elseif ($pay_info['channel'] == 5) { // 汇付宝 }elseif ($pay_info['channel'] == 5) { // 汇付宝
@ -1494,13 +1499,18 @@ class PayH5Controller extends BaseController{
$request['merchant_id'] = $pay_info['id']; $request['merchant_id'] = $pay_info['id'];
$request['merchant_way'] = self::WX_PAY; $request['merchant_way'] = self::WX_PAY;
$request['main_id'] = $main_id; $request['main_id'] = $main_id;
if (C('SHARE_ID.'.$pay_conf['partner']) == 'y') {
$request['share_status'] = 1;
}
$this->add_spend($request,1); $this->add_spend($request,1);
} }
// $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}"; // $json_data['url'] = $is_pay['mweb_url'].'&redirect_url='.C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/game_id/{$request['game_id']}";
// (is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ; // (is_ssl()?'https%3A%2F%2F':'http%3A%2F%2F'). $_SERVER ['HTTP_HOST'] . "%2Fsdk.php%2FSpend%2Fpay_success%2Forderno%2F".$request['pay_order_number'].'%2Fgame_id%2F'.$request['game_id'] ;
}else{ }else{
echo json_encode(['code'=>0,'msg'=> '支付失败']);exit; echo json_encode(['code'=>0,'msg'=> '支付失败']);
Log::write("platform_weixin_pay支付失败".serialize($is_pay));
exit;
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit; // redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付失败', 'user_token' => $this->userToken)));exit;
} }
}elseif ($pay_info['channel'] == 5) { }elseif ($pay_info['channel'] == 5) {

@ -34,15 +34,17 @@ class Weixin
$unifiedOrder = new \UnifiedOrder_pub(C('wei_xin_apps.email'), C('wei_xin_apps.partner'), C('wei_xin_apps.key')); $unifiedOrder = new \UnifiedOrder_pub(C('wei_xin_apps.email'), C('wei_xin_apps.partner'), C('wei_xin_apps.key'));
} }
// $des='平台币充值';
$unifiedOrder->setParameter("body", $title);//商品描述 $unifiedOrder->setParameter("body", $title);//商品描述
//自定义订单号,此处仅作举例 if (C('SHARE_ID.'.$payConf['partner']) == 'y') {
$unifiedOrder->setParameter("profit_sharing", 'Y');//分账
$timeStamp = time(); $unifiedOrder->setParameter("sub_mch_id", C('SHARE_PAIR.'.$payConf['partner']));//
}
if (C('SHARE_ID.'.$payConf['partner']) == 'n') {
$unifiedOrder->setParameter("sub_mch_id", C('SHARE_PAIR.'.$payConf['partner']));//
}
$unifiedOrder->setParameter("out_trade_no", $order_no);//商户订单号 $unifiedOrder->setParameter("out_trade_no", $order_no);//商户订单号
$unifiedOrder->setParameter("total_fee", $pay_amount * 100);//总金额 $unifiedOrder->setParameter("total_fee", $pay_amount * 100);//总金额

Loading…
Cancel
Save