You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
530 lines
21 KiB
PHP
530 lines
21 KiB
PHP
<?php
|
|
|
|
namespace App\Helper\Baofu;
|
|
|
|
use app\base\helper\Str;
|
|
use App\Helper\Redis;
|
|
use App\Helper\RedisKey;
|
|
use App\Helper\StringHelper;
|
|
use think\Env;
|
|
|
|
class Baofu
|
|
{
|
|
use Common;
|
|
|
|
const OK = 'OK';
|
|
const FAIL = 'FAIL';
|
|
const PEYMENT_PAID_TYPE = [
|
|
'WECHAT_JSGZH' => 2,//'微信公众号支付',
|
|
// 'WECHAT_JSXCX' => '微信小程序支付',
|
|
// 'ALIPAY_ALSHH' => '支付宝生活号支付',
|
|
// 'ALIPAY_ALXCX' => '支付宝小程序支付',
|
|
'ALIPAY_NATIVE' => 1 //'支付宝主扫'
|
|
];
|
|
|
|
public function apply($loginNo, $email, $returnUrl = 'apply'){
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['email'] = $email;
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl('apply');
|
|
return $this->pc($returnUrl, $data);
|
|
}
|
|
|
|
public function register($loginNo, $token)
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['dataContent'] = NotifyList::getNotifyUrl('register', $token);
|
|
return $this->h5('register', $data, $token);
|
|
}
|
|
|
|
public function cardBind($loginNo, $token)
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['dataContent'] = NotifyList::getNotifyUrl('cardBind', $token);
|
|
return $this->h5('cardBind', $data);
|
|
}
|
|
|
|
public function cardUnbind($loginNo, $agreementNo, $requestNo = '')
|
|
{
|
|
if (empty($requestNo)) {
|
|
$requestNo = StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_UNBIND_CARD);
|
|
}
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['requestNo'] = $requestNo;
|
|
$data['agreementNo'] = $agreementNo;
|
|
return $this->api('unbindCard', $data);
|
|
}
|
|
|
|
public function getBalance($loginNo)
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['accountType'] = 'BALANCE';
|
|
return $this->api('getBalanceNew', $data);
|
|
}
|
|
|
|
public function withdraw($params, $returnUrl = 'withdraw')
|
|
{
|
|
$data = [];
|
|
$data['amount'] = $params['amount'];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['agreementNo'] = Rsa::encryptByCERFile($params['agreementNo'], $this->getCerFilePath());
|
|
$data['outOrderNo'] = $params['outOrderNo'];
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl($params['notifyUrl']);
|
|
return $this->withReturnUrl($this->api($params['notifyUrl'], $data), $returnUrl);
|
|
}
|
|
|
|
public function assurePaymentSplit($params, $returnUrl = 'assurePaymentSplit')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['amount'] = $params['amount'];
|
|
$data['outOrderNo'] = $params['outOrderNo'];
|
|
$data['paidType'] = $params['paidType'] ?: 'CARD';
|
|
$data['agreementNo'] = Rsa::encryptByCERFile($params['agreementNo'], $this->getCerFilePath());
|
|
$data['splitInfoList'] = json_encode($params['splitInfoList']);
|
|
$data['expireDate'] = date('YmdHis', time() + 15*60);
|
|
$data['validDate'] = date('Ymd');
|
|
$data['notifyUrl'] = $params['notifyUrl'];
|
|
return $this->withReturnUrl($this->api('assurePaymentSplit', $data), $returnUrl, ['oid' => $params['oid']]);
|
|
}
|
|
|
|
public function unifyPay($params){
|
|
$dataContent = [
|
|
'goodsName' => $params['goodsName'],
|
|
'amount' => $params['amount'],
|
|
'outOrderNo' => $params['outOrderNo'],
|
|
'expireDate' => date('YmdHis', time() + 15*60),
|
|
'notifyUrl' => $params['notifyUrl'],
|
|
'splitInfoList' => $params['splitInfoList'],
|
|
'paidType' => $params['paidType'],
|
|
'validDate' => date('Ymd'),
|
|
];
|
|
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['orderType'] = 'SPLIT_PAY';
|
|
$data['dataContent'] = json_encode($dataContent);
|
|
// 1.微信支付(公众号、小程序)需填公众号授权获取微信用户openid
|
|
// 2.支付宝支付(生活号、小程序)需填生活号授权获取支付宝用户userid
|
|
// 3.支付宝主扫可不填写
|
|
$data['channelId'] = $params['channelId'] ?: '';
|
|
$data['forbidCredit'] = $params['forbidCredit'] ? 1 : 0;
|
|
$data['simId'] = $params['simId'] ?: $this->getSimID($params['paidType']);
|
|
$data['isRaw'] = 0;
|
|
$data['appId'] = $params['appId'] ?: '';
|
|
$data['anonymityPayRemark'] = $params['anonymityPayRemark'];
|
|
|
|
$res = base64_decode($this->api('unifyPay', $data)['data']);
|
|
if(self::PEYMENT_PAID_TYPE[$params['paidType']]){
|
|
$res = json_decode($res, true);
|
|
if($res['body']){
|
|
return $res['body'];
|
|
}
|
|
}
|
|
}
|
|
|
|
public function cloudB2cAssureRecharge($params){
|
|
$dataContent = [
|
|
'goodsName' => $params['goodsName'],
|
|
'amount' => $params['amount'],
|
|
'outOrderNo' => $params['outOrderNo'],
|
|
'notifyUrl' => $params['notifyUrl'],
|
|
'splitInfoList' => $params['splitInfoList'],
|
|
'expireDate' => date('YmdHis', time() + 15*60),
|
|
'validDate' => date('Ymd'),
|
|
];
|
|
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['payId'] = $params['payId'];
|
|
$data['dataContent'] = json_encode($dataContent);
|
|
return $this->api('cloudB2cAssureRecharge', $data);
|
|
}
|
|
|
|
public function payment($params, $type = 'ASSURE_PAYMENT')
|
|
{
|
|
$dataContent = [
|
|
'goodsName' => $params['goodsName'],
|
|
'amount' => $params['amount'],
|
|
'outOrderNo' => $params['outOrderNo'],
|
|
'expireDate' => date('YmdHis', time() + 15*60),
|
|
'notifyUrl' => $params['notifyUrl'],
|
|
'splitInfoList' => $params['splitInfoList'],
|
|
'paidType' => $params['paidType'],
|
|
'validDate' => date('Ymd'),
|
|
];
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['simId'] = $this->getSimID($params['paidType']);
|
|
// 1.微信支付(公众号、小程序)需填公众号授权获取微信用户openid
|
|
// 2.支付宝支付(生活号、小程序)需填生活号授权获取支付宝用户userid
|
|
// 其余时间不传
|
|
$data['chanalId'] = $params['chanalId'] ?: '';
|
|
$data['dataContent'] = json_encode($dataContent);
|
|
// 1.微信支付(公众号、小程序)需填公众号授权获取微信的appid
|
|
// 2.支付宝支付(生活号、小程序)需填生活号授权获取支付宝的appid
|
|
// 支付宝主扫 不需要
|
|
$data['appId'] = $params['appId'] ?: '';
|
|
$data['isRaw'] = 0;
|
|
$data['callType'] = $type;
|
|
|
|
$res = base64_decode($this->api('payment', $data));
|
|
if(self::PEYMENT_PAID_TYPE[$params['paidType']]){
|
|
$res = json_decode($res, true);
|
|
if($res['body']){
|
|
return $res['body'];
|
|
}
|
|
}
|
|
}
|
|
|
|
public function recharge($params, $returnUrl = 'recharge')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['amount'] = $params['amount'];
|
|
$data['outOrderNo'] = $params['outOrderNo'];
|
|
$data['agreementNo'] = Rsa::encryptByCERFile($params['agreementNo'], $this->getCerFilePath());
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl('recharge');
|
|
return $this->withReturnUrl($this->api('recharge', $data), $returnUrl);
|
|
}
|
|
|
|
public function merchantTransferRecharge($params, $returnUrl = 'recharge')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['amount'] = $params['amount'];
|
|
$data['outOrderNo'] = $params['outOrderNo'];
|
|
$data['agreementNo'] = Rsa::encryptByCERFile($params['agreementNo'], $this->getCerFilePath());
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl('recharge');
|
|
return $this->api('merchantTransferRecharge', $data);
|
|
}
|
|
|
|
public function confirmAssurePay($params)
|
|
{
|
|
$dataContent = [
|
|
'amount' => $params['amount'],
|
|
'outOrderNo' => $params['outOrderNo'],
|
|
'assureConfirmSplitInfoList' => $params['assureConfirmSplitInfoList'],
|
|
'oldOutOrderNo' => $params['oldOutOrderNo'],
|
|
];
|
|
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['dataContent'] = json_encode($dataContent);
|
|
$data['notifyUrl'] = $params['notifyUrl'];
|
|
return $this->api('confirmAssurePay', $data);
|
|
}
|
|
|
|
public function findBindBankCards($params)
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['contractNo'] = $params['contractNo'];
|
|
$data['tradeType'] = 'BASE_LIST';
|
|
return $this->api('findBindBankCards', $data);
|
|
}
|
|
|
|
public function queryCustomerInfo($loginNo, $customerType = 'PERSON')
|
|
{
|
|
$requestNo = StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_QUERY_CUSTOMER_INFO);
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['customerType'] = $customerType;
|
|
$data['requestNo'] = $requestNo;
|
|
$result = $this->api('queryCustomerInfo', $data);
|
|
return json_decode($result, true);
|
|
}
|
|
|
|
public function pwdModify($loginNo, $returnUrl = 'pwdModify')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
return $this->h5($returnUrl, $data);
|
|
}
|
|
|
|
public function mEnterprisePwdModify($loginNo, $returnUrl = 'mEnterprisePwdModify')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
return $this->h5($returnUrl, $data);
|
|
}
|
|
|
|
public function pwdForget($loginNo, $returnUrl = 'pwdForget')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
return $this->h5($returnUrl, $data);
|
|
}
|
|
|
|
public function mPwReset($loginNo, $returnUrl = 'mPwReset')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
return $this->h5($returnUrl, $data);
|
|
}
|
|
|
|
public function refund($params, $returnUrl = 'refund')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['refundTradeId'] = $params['refundTradeId'];
|
|
$data['orgTradeId'] = $params['orgTradeId'];
|
|
$data['refundMoney'] = $params['refundMoney'];
|
|
$data['refundReason'] = $params['refundReason'];
|
|
$data['oldSubOutOrderNo'] = $params['oldSubOutOrderNo'];
|
|
// $data['refundSplitInfoList'] = json_encode($params['refundSplitInfoList']);
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl($returnUrl);
|
|
return $this->api('refundRequest', $data);
|
|
}
|
|
|
|
public function modifyLoginNo($origLoginNo, $loginNo)
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['origLoginNo'] = $origLoginNo;
|
|
return $this->api('modifyLoginNo', $data);
|
|
}
|
|
|
|
public function mEnterpriseUnbindCard($loginNo, $agreementNo, $returnUrl = 'mEnterpriseUnbindCard')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['agreementNo'] = $agreementNo;
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl($returnUrl);
|
|
return $this->api($returnUrl,$data);
|
|
}
|
|
|
|
public function sendBindCardEmail($loginNo, $returnUrl = 'sendBindCardEmail')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
return $this->api($returnUrl,$data);
|
|
}
|
|
|
|
public function applyBindCard($loginNo, $info, $returnUrl = 'applyBindCard')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['cardNo'] = BFRSA::encryptByCERFile($info['cardNo'], EXTEND_PATH . Env::get('BAOFOO_CER_FILE_PATH'));
|
|
$data['cardName'] = $info['cardName'];
|
|
$data['bankName'] = $info['bankName'];
|
|
$data['branchName'] = $info['branchName'];
|
|
$data['provinceName'] = $info['provinceName'];
|
|
$data['cityName'] = $info['cityName'];
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl($returnUrl);
|
|
return $this->api($returnUrl,$data);
|
|
}
|
|
|
|
public function openAccount($loginNo, $info, $returnUrl = 'openAccount')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['customerName'] = BFRSA::encryptByCERFile($info['customerName'], EXTEND_PATH . Env::get('BAOFOO_CER_FILE_PATH'));
|
|
$data['certificateNo'] = BFRSA::encryptByCERFile($info['certificateNo'], EXTEND_PATH . Env::get('BAOFOO_CER_FILE_PATH'));
|
|
$data['base64imageFront'] = $info['imageFront'];
|
|
$data['base64imageBack'] = $info['imageBack'];
|
|
return $this->api($returnUrl,$data);
|
|
}
|
|
|
|
public function shortMessage($loginNo, $info, $returnUrl = 'bindCard')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['cardNo'] = BFRSA::encryptByCERFile($info['cardNo'], EXTEND_PATH . Env::get('BAOFOO_CER_FILE_PATH'));
|
|
$data['bankMobile'] = BFRSA::encryptByCERFile($info['bankMobile'], EXTEND_PATH . Env::get('BAOFOO_CER_FILE_PATH'));
|
|
$data['notifyUrl'] = NotifyList::getNotifyUrl('cardBind');
|
|
return $this->api($returnUrl,$data);
|
|
}
|
|
|
|
public function fixedBinding($loginNo, $info, $returnUrl = 'bindCardCheck')
|
|
{
|
|
$data = [];
|
|
$data['loginNo'] = $loginNo;
|
|
$data['requestNo'] = $info['requestNo'];
|
|
$data['verifyCode'] = $info['verifyCode'];
|
|
$res = $this->api('bindCardCheck', $data);
|
|
return $this->withReturnUrl($res['url'], $returnUrl);
|
|
}
|
|
|
|
// 分账后退款-退款申请-请求示例
|
|
// {
|
|
// "merchantNo": "100026136",
|
|
// "terminalNo": "200001259",
|
|
// "orgNo": "100026136",
|
|
// "refundTradeId": "TID16317806300773",
|
|
// "refundTradeType": "REFUND_APPLY",
|
|
// "refundReason": "默认退款",
|
|
// "requestDate": "20210916162350",
|
|
// "loginNo": "13111111111",
|
|
// "refundSplitInfoList": [{
|
|
// "orgSubOutOrderNo": "subAH66EXyRAYP2SwGZ8663",
|
|
// "refundAmount": "250"
|
|
// }, {
|
|
// "orgSubOutOrderNo": "sub5dAfxGcncXPfD5AmRYDr",
|
|
// "refundAmount": "250"
|
|
// }],
|
|
// "orgTradeId": "TID16317805680623",
|
|
// "refundAmount": "500",
|
|
// "signData": "414875aa3a2c4c8ed4ded198ea1f4025277ab239a73c3d7d4f1a8aed2d918f7fb660328bd54c47770579e181cf76fa7ab653c8d0b28bad8bfdf161bc8dfb32184d1b9ce041baa2395761e70267d7f4a56721ae509510a5293237e8a93614ad25227e146c8a4d16097db852fb216841f50c43aaaaca3cdd33effc283f33bfc6ab"
|
|
// }
|
|
public function profitShareRefundApply($params){
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'] ?: "";// 匿名支付不需要传
|
|
$data['refundTradeId'] = $params['refundTradeId'];
|
|
$data['refundTradeType'] = 'REFUND_APPLY';
|
|
$data['orgTradeId'] = $params['orgTradeId'];
|
|
$data['refundAmount'] = $params['refundAmount']; // 单位:分
|
|
$data['refundReason'] = $params['refundReason'];
|
|
$data['refundSplitInfoList'] = $params['refundSplitInfoList'];
|
|
|
|
// 响应示例
|
|
// {
|
|
// "success": true,
|
|
// "result": {
|
|
// "refundOrderId": "21091600000002659",
|
|
// "refundTradeId": "TID16317806300773",
|
|
// "refundAmount": "500",
|
|
// "refundSplitResultList": [{
|
|
// "orgSubOutOrderNo": "subAH66EXyRAYP2SwGZ8663",
|
|
// "status": "P",
|
|
// "message": null
|
|
// }, {
|
|
// "orgSubOutOrderNo": "sub5dAfxGcncXPfD5AmRYDr",
|
|
// "status": "P",
|
|
// "message": null
|
|
// }]
|
|
// },
|
|
// "errorCode": null,
|
|
// "errorMsg": null
|
|
// }
|
|
return $this->api('profitShareRefundApply', $data);
|
|
}
|
|
|
|
// 分账后退款-退款确认-请求示例
|
|
// {
|
|
// "merchantNo": "100026136",
|
|
// "terminalNo": "200001259",
|
|
// "orgNo": "100026136",
|
|
// "refundTradeId": "TID16317806300773",
|
|
// "refundTradeType": "REFUND_CONFIRM",
|
|
// "requestDate": "20210916163026",
|
|
// "notifyUrl": "http://10.0.60.55:8080/BF_BHT_DEMO_V1/notifyUrl.action?ct=profitShareRefundConfirm",
|
|
// "loginNo": "13111111111",
|
|
// "orgTradeId": "TID16317805680623",
|
|
// "refundAmount": "500",
|
|
// "signData": "b5d1d2fe99cdafd24cb77aabc29a4b361a5c83fcd218d98b729220dc720a0479e8ffe1a362074cb8b1cf3ad0bd843c52c54a1e44299f8b6e1d5cbaf140b9d4ac356e271b5ad56551a996271d23075a2637daf35376486d0623a884273d45dfcb50596d124a47cbda4f52d204daf25dddc274239f98c010b6a980d074064fd2ab"
|
|
// }
|
|
public function profitShareRefundConfirm($params){
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'] ?: "";// 匿名支付不需要传
|
|
$data['refundTradeId'] = $params['refundTradeId']; // 与退款申请中的退款请求订单号一致
|
|
$data['refundTradeType'] = 'REFUND_CONFIRM';
|
|
$data['orgTradeId'] = $params['orgTradeId']; // 原始支付商户订单号
|
|
$data['refundAmount'] = $params['refundAmount']; // 单位:分
|
|
$data['notifyUrl'] = $params['notifyUrl'];
|
|
|
|
// 响应示例
|
|
// {
|
|
// "success": true,
|
|
// "result": {
|
|
// "refundOrderId": "21091600000002659",
|
|
// "refundTradeId": "TID16317806300773",
|
|
// "refundMoney": "500",
|
|
// "refundStatus": "P",
|
|
// "refundType": "BALANCE",
|
|
// "message": null
|
|
// },
|
|
// "errorCode": null,
|
|
// "errorMsg": null
|
|
// }
|
|
return $this->api('profitShareRefundConfirm', $data);
|
|
}
|
|
|
|
// 分账后退款-退款撤销-请求示例
|
|
// {
|
|
// "merchantNo": "100026136",
|
|
// "terminalNo": "200001259",
|
|
// "refundTradeId": "TID16317811945423",
|
|
// "orgNo": "100026136",
|
|
// "refundTradeType": "REFUND_CANCEL",
|
|
// "requestDate": "20210916163400",
|
|
// "loginNo": "13111111111",
|
|
// "signData": "618d70be82967ff6b7b8821446df9476b32ea8442fae4283f3bbfa80034fbb2c42a7f0098522a4729a75182ba51e176401279f0a702a7e0b2a3581f62238ed9cb8e7cbc1295a640506d0fbce5d98b20536c9a46994d5a8f590d7492d9f10b561183307798630ddf74669cddbdf45bcc3c090b28925a4ed1b1353b4c3c798a2af"
|
|
// }
|
|
public function profitShareRefundCancel($params){
|
|
$data = [];
|
|
$data['loginNo'] = $params['loginNo'] ?: "";// 匿名支付不需要传
|
|
$data['refundTradeId'] = $params['refundTradeId']; // 与退款申请中的退款请求订单号一致
|
|
$data['refundTradeType'] = 'REFUND_CANCEL';
|
|
|
|
// 响应示例
|
|
// {
|
|
// "success": true,
|
|
// "result": true,
|
|
// "errorCode": null,
|
|
// "errorMsg": null
|
|
// }
|
|
return $this->api('profitShareRefundCancel', $data);
|
|
}
|
|
|
|
public function merchantReportCreate($params){
|
|
$data = [];
|
|
$data['uniqueId'] = $params['uniqueId'];
|
|
$data['loginNo'] = $params['loginNo'];
|
|
$data['reportType'] = $params['reportType'];
|
|
$data['bizContent'] = json_encode([
|
|
"servicePhone" => $params['servicePhone'],
|
|
"businessLicense" => $params['businessLicense'],
|
|
"businessLicenseType" => $params['businessLicenseType'],
|
|
"merchantName" => $params['merchantName'],
|
|
"merchantShortName" => $params['merchantShortName'],
|
|
"channelId" => $this->getChannelId(),
|
|
"channelName" => $this->getChannelName(),
|
|
"business" => $params['business'],
|
|
"contactWechatIdType" => $params['contactWechatIdType'],
|
|
"contactWechatId" => $params['contactWechatId'],
|
|
"serviceCodes" => $params['serviceCodes'],
|
|
"addressInfo" => $params['addressInfo'],
|
|
"bankCardInfo" => $params['bankCardInfo']
|
|
]);
|
|
|
|
// 响应示例(成功)
|
|
// {"success":true,"result":{"state":"SUCCESS","simId":"472688640"},"errorCode":null,"errorMsg":null}
|
|
// 响应示例(失败)
|
|
// {"success":false,"result":null,"errorCode":"PARAMETER_VALID","errorMsg":"uniqueId格式不合法"}
|
|
return $this->api('merchantReportCreate', $data);
|
|
}
|
|
|
|
public function authBind($params){
|
|
$data = [];
|
|
$data['simId'] = $params['simId'];
|
|
$data['authType'] = $params['authType'];
|
|
$data['authContent'] = $params['authContent'];
|
|
|
|
// 响应示例(成功)
|
|
// {"success":true,"result":{"state":"SUCCESS"},"errorCode":null,"errorMsg":null}
|
|
// 响应示例(失败)
|
|
// {"success":false,"result":null,"errorCode":"FAILED","errorMsg":"商户报备记录不存在"}
|
|
return $this->api('authBind', $data);
|
|
}
|
|
|
|
public function setToken($token, $apiName, $params) {
|
|
$key = RedisKey::getRequestTokenKey($token);
|
|
Redis::set($key, json_encode([
|
|
'appName' => $apiName,
|
|
'params' => $params,
|
|
]));
|
|
Redis::expire($key, 60 * 60);
|
|
}
|
|
|
|
public function getToken($token) {
|
|
$key = RedisKey::getRequestTokenKey($token);
|
|
Redis::set($key);
|
|
Redis::expire($key, 15 * 60);
|
|
}
|
|
}
|