master
elf 2 years ago
parent 22996d03e8
commit 573b1ce862

@ -9,7 +9,8 @@ use Think\Log;
use Qiniu\json_decode;
use Sdk\Controller\Ipa365Controller;
use Base\Tool\Redis;
use Org\SumaPay\Notify as FFNotify;
use Org\SumaPay\Log as FFLog;
/**
* 支付回调控制器
@ -927,4 +928,37 @@ class NotifyController extends BaseController
echo "SUCCESS";
}
/**
* 酷点回调
*/
public function ff_callback() {
$params = file_get_contents('php://input');
FFLog::write('NOTIFY_INPUT:' . json_encode($_POST));
FFLog::write('NOTIFY_INPUT:' . file_get_contents('php://input'));
$notify = new FFNotify($params);
if (!$notify->verify()) {
echo 'SIGN_VERIFY_FAIL';
return;
}
/* $payWhere = substr($orderInfo['out_trade_no'], 0, 2);
switch ($payWhere) {
case 'SP':
$result = $this->set_spend($orderInfo);
break;
case 'PF':
$result = $this->set_deposit($orderInfo);
break;
case 'AG':
$result = $this->set_agent($orderInfo);
break;
default:
exit('accident order data');
break;
}
echo 'SUCCESS'; */
}
}

@ -14,7 +14,7 @@ use Sdk\Model\ValueDetailLogModel;
use Sdk\Model\PayLimitConfModel;
use Sdk\Model\PayChannelInterntionModel;
use Sdk\Model\PayChannelIntentionModel;
use Org\SumaPay\Api as FFApi;
class PayH5Controller extends BaseController{
const ALI_PAY = 1;
@ -518,8 +518,44 @@ class PayH5Controller extends BaseController{
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
}
} elseif($pay_info['channel'] == 7) { // 丰付
$request['pay_way'] = 12;
$request['pay_status'] = 0;
$request['spend_ip'] = get_client_ip();
$request['merchant_id'] = $pay_info['id'];
$request['merchant_way'] = 1;
$request['main_id'] = $main_id;
} else{ // 支付宝第三方
$ordercheck = M("spend","tab_")->where(array('pay_order_number'=>$request["pay_order_number"]))->find();
if ($ordercheck) {
$returl = U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!'));
echo json_encode(['code'=>0,'msg'=>'订单已经存在,请刷新充值页面重新下单!','wap'=>1]);
exit;
}
$this->add_spend($request,1);
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/ff_callback";
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
$body = '消费-' . $request["pay_order_number"];
$response = FFApi::h5Pay($request['pay_order_number'], $request['price'], $notifyUrl, $backUrl, FFApi::TYPE_ALIPAY, $body, get_client_ip());
if($response->isSuccess()){
// 存入pay_url 继续支付
M("spend", "tab_")->where([
'extend' => $request['extend'],
'game_id' => $request['game_id'],
'pay_order_number' => $request["pay_order_number"]
])->save([
'pay_url' => $response->getResult('url')
]);
$orderno = $request['pay_order_number'];
} else {
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$response->getMsg()}】,请选择其他支付方式或联系客服"]);exit;
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
}
} else { // 支付宝第三方
if( empty(C('goldpig.partner'))||empty(C('goldpig.wooolid'))){
// $this->set_message(1009, "fail", "支付参数未配置");
//redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>'支付参数未配置')));exit;
@ -1574,7 +1610,43 @@ class PayH5Controller extends BaseController{
echo json_encode(['code'=>0,'msg'=> '支付失败,请重试'.$json_data['ret_msg']]);
exit;
}
} elseif($pay_info['channel'] == 7) { // 丰付
$request['pay_way'] = 12;
$request['pay_status'] = 0;
$request['spend_ip'] = get_client_ip();
$request['merchant_id'] = $pay_info['id'];
$request['merchant_way'] = 2;
$request['main_id'] = $main_id;
$ordercheck = M("spend","tab_")->where(array('pay_order_number'=>$request["pay_order_number"]))->find();
if ($ordercheck) {
$returl = U('Spend/notice',array('user_id'=>$ordercheck['user_id'],'game_id'=>$ordercheck['game_id'],'msg'=>'订单已经存在,请刷新充值页面重新下单!'));
echo json_encode(['code'=>0,'msg'=>'订单已经存在,请刷新充值页面重新下单!','wap'=>1]);
exit;
}
$this->add_spend($request,1);
$notifyUrl = C('PAY_DOMAIN')."/callback.php/Notify/kd_callback";
$backUrl = C('PAY_DOMAIN')."sdk.php/Spend/paycallback/orderno/{$request['pay_order_number']}/user_token/".$this->userToken."/paytype/weixinpay/game_id/{$game_id}";
$body = '消费-' . $request["pay_order_number"];
$response = FFApi::h5Pay($request['pay_order_number'], $request['price'], $notifyUrl, $backUrl, FFApi::TYPE_WECHAT, $body, get_client_ip());
if($response->isSuccess()){
// 存入pay_url 继续支付
M("spend", "tab_")->where([
'extend' => $request['extend'],
'game_id' => $request['game_id'],
'pay_order_number' => $request["pay_order_number"]
])->save([
'pay_url' => $response->getResult('url')
]);
$orderno = $request['pay_order_number'];
} else {
echo json_encode(['code'=>1001,'msg'=> "请求发起失败【{$response->getMsg()}】,请选择其他支付方式或联系客服"]);exit;
// redirect(U('Spend/notice',array('user_id'=>$user_id,'game_id'=>$game_id,'msg'=>$ret[0]['respMess'], 'user_token' => $this->userToken)));exit;
}
}elseif(get_wx_pay_type() == 2){
if($request['code']==1){

@ -2,7 +2,6 @@
namespace Org\SumaPay;
use Org\SumaPay\Request\H5PayRequest;
use Org\SumaPay\Request\Request;
class Api
{
@ -20,7 +19,7 @@ class Api
}
public static function h5Pay($orderNumber, $amount, $notifyUrl, $backUrl, $payType, $body, $clientIp) {
$request = new H5payRequest(Config::get('merchantCode'), Config::get('secretKey'));
$request = new H5payRequest(Config::get('merchantCode'), Config::get('totalBizType'), Config::get('secretKey'));
$request->setParams([
'requestType' => $payType,
'requestId' => $orderNumber,

@ -5,8 +5,9 @@ class Config
{
private static $params = [
'baseUrl' => 'https://www.sumapay.com',
'merchantCode' => '',
'secretKey' => '',
'merchantCode' => 'HGJ_TEST',
'secretKey' => 'HENG-KEY',
'totalBizType' => 'BIZ01106',
];
public static function get($key, $default = null)

@ -9,7 +9,7 @@ class Request
protected $url;
protected $merchantCode;
protected $totalBizType = 'BIZ01101';
protected $totalBizType;
protected $params;
protected $secretKey;
protected $signFields = [
@ -24,10 +24,11 @@ class Request
'passThrough'
];
public function __construct($merchantCode, $secretKey)
public function __construct($merchantCode, $totalBizType, $secretKey)
{
$this->merchantCode = $merchantCode;
$this->secretKey = $secretKey;
$this->totalBizType = $totalBizType;
}
public function setParams(array $params)

Loading…
Cancel
Save