SdkPayment.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756
  1. <?php
  2. namespace app\common\components\alipay\Web;
  3. use app\common\events\finance\AlipayWithdrawEvent;
  4. use app\common\events\PayLog;
  5. use app\common\exceptions\AppException;
  6. use app\common\facades\Setting;
  7. use app\common\helpers\Url;
  8. use app\common\models\PayWithdrawOrder;
  9. use app\common\services\finance\Withdraw;
  10. use app\common\services\alipay\AopClient;
  11. use app\common\services\alipay\request\AlipayFundTransToaccountTransferRequest;
  12. use app\common\services\alipay\WebAlipay;
  13. use app\common\services\Utils;
  14. class SdkPayment
  15. {
  16. private $__gateway_new = 'https://mapi.alipay.com/gateway.do?';
  17. private $__https_verify_url = 'https://mapi.alipay.com/gateway.do?service=notify_verify&';
  18. private $__http_verify_url = 'http://notify.alipay.com/trade/notify_query.do?';
  19. private $service = 'create_direct_pay_by_user';
  20. private $partner;
  21. private $_input_charset = 'UTF-8';
  22. private $sign_type = 'MD5';
  23. private $notify_url;
  24. private $return_url;
  25. private $out_trade_no;
  26. private $payment_type = 1;
  27. private $seller_id;
  28. private $total_fee;
  29. private $subject;
  30. private $body;
  31. private $it_b_pay;
  32. private $show_url;
  33. private $anti_phishing_key;
  34. private $exter_invoke_ip;
  35. private $key;
  36. private $transport;
  37. private $cacert;
  38. private $qr_pay_mode;
  39. private $paymethod = "bankPay"; //付款方式, 用于网银支付时为bankPay
  40. private $defaultbank; //银行简码,用于网银支付
  41. private $payee_type = 'ALIPAY_LOGONID';
  42. public function __construct()
  43. {
  44. $this->cacert = getcwd() . '/../cacert.pem';
  45. }
  46. /**
  47. * 取得支付链接
  48. */
  49. public function getPayLink()
  50. {
  51. $parameter = array(
  52. 'service' => $this->service,
  53. 'partner' => $this->partner,
  54. 'payment_type' => $this->payment_type,
  55. 'notify_url' => $this->notify_url,
  56. 'return_url' => $this->return_url,
  57. 'seller_email' => $this->seller_id,
  58. 'out_trade_no' => $this->out_trade_no,
  59. 'subject' => $this->subject,
  60. 'total_fee' => $this->total_fee,
  61. 'body' => $this->body,
  62. 'it_b_pay' => $this->it_b_pay,
  63. 'show_url' => $this->show_url,
  64. 'anti_phishing_key' => $this->anti_phishing_key,
  65. 'exter_invoke_ip' => $this->exter_invoke_ip,
  66. '_input_charset' => strtolower($this->_input_charset),
  67. 'qr_pay_mode' => $this->qr_pay_mode
  68. );
  69. //请求数据日志
  70. event(new PayLog($parameter, new WebAlipay()));
  71. $para = $this->buildRequestPara($parameter);
  72. return $this->__gateway_new . $this->createLinkstringUrlencode($para);
  73. }
  74. /**
  75. * 取得网银支付链接
  76. */
  77. public function getBankPayLink()
  78. {
  79. $parameter = array(
  80. 'service' => $this->service,
  81. 'partner' => $this->partner,
  82. 'payment_type' => $this->payment_type,
  83. 'notify_url' => $this->notify_url,
  84. 'return_url' => $this->return_url,
  85. 'seller_email' => $this->seller_id,
  86. 'out_trade_no' => $this->out_trade_no,
  87. 'subject' => $this->subject,
  88. 'total_fee' => $this->total_fee,
  89. 'body' => $this->body,
  90. 'it_b_pay' => $this->it_b_pay,
  91. 'show_url' => $this->show_url,
  92. 'anti_phishing_key' => $this->anti_phishing_key,
  93. 'exter_invoke_ip' => $this->exter_invoke_ip,
  94. '_input_charset' => strtolower($this->_input_charset),
  95. 'qr_pay_mode' => $this->qr_pay_mode,
  96. // 网银支付额外配置
  97. 'paymethod' => $this->paymethod,
  98. 'defaultbank' => $this->defaultbank
  99. );
  100. $para = $this->buildRequestPara($parameter);
  101. return $this->__gateway_new . $this->createLinkstringUrlencode($para);
  102. }
  103. /**
  104. * 验证消息是否是支付宝发出的合法消息
  105. */
  106. public function verify()
  107. {
  108. // 判断请求是否为空
  109. if (empty($_POST) && empty($_GET)) {
  110. return false;
  111. }
  112. $data = $_POST ?: $_GET;
  113. // 生成签名结果
  114. $is_sign = $this->getSignVeryfy($data, $data['sign']);
  115. // 获取支付宝远程服务器ATN结果(验证是否是支付宝发来的消息)
  116. $response_txt = 'true';
  117. if (!empty($data['notify_id'])) {
  118. $response_txt = $this->getResponse($data['notify_id']);
  119. }
  120. // 验证
  121. // $response_txt的结果不是true,与服务器设置问题、合作身份者ID、notify_id一分钟失效有关
  122. // isSign的结果不是true,与安全校验码、请求时的参数格式(如:带自定义参数等)、编码格式有关
  123. if ($is_sign) {
  124. return true;
  125. } else {
  126. return false;
  127. }
  128. }
  129. public function setPayMethod($paymethod)
  130. {
  131. $this->paymethod = $paymethod;
  132. return $this;
  133. }
  134. public function getPayMethod()
  135. {
  136. return $this->paymethod;
  137. }
  138. public function setDefaultBank($bank)
  139. {
  140. $this->defaultbank = $bank;
  141. return $this;
  142. }
  143. public function setPartner($partner)
  144. {
  145. $this->partner = $partner;
  146. return $this;
  147. }
  148. public function getPartner()
  149. {
  150. return $this->partner;
  151. }
  152. public function setNotifyUrl($notify_url)
  153. {
  154. $this->notify_url = $notify_url;
  155. return $this;
  156. }
  157. public function getNotifyUrl()
  158. {
  159. return $this->notify_url;
  160. }
  161. public function setReturnUrl($return_url)
  162. {
  163. $this->return_url = $return_url;
  164. return $this;
  165. }
  166. public function getReturnUrl()
  167. {
  168. return $this->return_url;
  169. }
  170. public function setOutTradeNo($out_trade_no)
  171. {
  172. $this->out_trade_no = $out_trade_no;
  173. return $this;
  174. }
  175. public function getOutTradeNo()
  176. {
  177. return $this->out_trade_no;
  178. }
  179. public function setKey($key)
  180. {
  181. $this->key = $key;
  182. return $this;
  183. }
  184. public function setSellerId($seller_id)
  185. {
  186. $this->seller_id = $seller_id;
  187. return $this;
  188. }
  189. public function getSellerId()
  190. {
  191. return $this->seller_id;
  192. }
  193. public function setTotalFee($total_fee)
  194. {
  195. $this->total_fee = $total_fee;
  196. return $this;
  197. }
  198. public function getTotalFee()
  199. {
  200. return $this->total_fee;
  201. }
  202. public function setSubject($subject)
  203. {
  204. $this->subject = $subject;
  205. return $this;
  206. }
  207. public function getSubject()
  208. {
  209. return $this->subject;
  210. }
  211. public function setBody($body)
  212. {
  213. $this->body = $body;
  214. return $this;
  215. }
  216. public function getBody()
  217. {
  218. return $this->body;
  219. }
  220. public function setItBPay($it_b_pay)
  221. {
  222. $this->it_b_pay = $it_b_pay;
  223. return $this;
  224. }
  225. public function getItBPay()
  226. {
  227. return $this->it_b_pay;
  228. }
  229. public function setShowUrl($show_url)
  230. {
  231. $this->show_url = $show_url;
  232. return $this;
  233. }
  234. public function setSignType($sign_type)
  235. {
  236. $this->sign_type = $sign_type;
  237. return $this;
  238. }
  239. public function setExterInvokeIp($exter_invoke_ip)
  240. {
  241. $this->exter_invoke_ip = $exter_invoke_ip;
  242. return $this;
  243. }
  244. public function getExterInvokeIp()
  245. {
  246. return $this->exter_invoke_ip;
  247. }
  248. public function setQrPayMode($qr_pay_mode)
  249. {
  250. $this->qr_pay_mode = $qr_pay_mode;
  251. return $this;
  252. }
  253. public function getQrPayMode()
  254. {
  255. $this->qr_pay_mode;
  256. }
  257. /**
  258. * 生成要请求给支付宝的参数数组
  259. * @param $para_temp 请求前的参数数组
  260. * @return 要请求的参数数组
  261. */
  262. private function buildRequestPara($para_temp)
  263. {
  264. //除去待签名参数数组中的空值和签名参数
  265. $para_filter = $this->paraFilter($para_temp);
  266. //对待签名参数数组排序
  267. $para_sort = $this->argSort($para_filter);
  268. //生成签名结果
  269. $mysign = $this->buildRequestMysign($para_sort);
  270. //签名结果与签名方式加入请求提交参数组中
  271. $para_sort['sign'] = $mysign;
  272. $para_sort['sign_type'] = strtoupper(trim($this->sign_type));
  273. return $para_sort;
  274. }
  275. /**
  276. * 除去数组中的空值和签名参数
  277. * @param $para 签名参数组
  278. * return 去掉空值与签名参数后的新签名参数组
  279. */
  280. private function paraFilter($para)
  281. {
  282. $para_filter = array();
  283. while ((list ($key, $val) = each($para)) == true) {
  284. if ($key == 'sign' || $key == 'sign_type' || $val == '') {
  285. continue;
  286. } else {
  287. $para_filter[$key] = $para[$key];
  288. }
  289. }
  290. return $para_filter;
  291. }
  292. /**
  293. * 对数组排序
  294. * @param $para 排序前的数组
  295. * return 排序后的数组
  296. */
  297. private function argSort($para)
  298. {
  299. ksort($para);
  300. reset($para);
  301. return $para;
  302. }
  303. /**
  304. * 生成签名结果
  305. * @param $para_sort 已排序要签名的数组
  306. * return 签名结果字符串
  307. */
  308. private function buildRequestMysign($para_sort)
  309. {
  310. //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
  311. $prestr = $this->createLinkstring($para_sort);
  312. $mysign = '';
  313. switch (strtoupper(trim($this->sign_type))) {
  314. case 'MD5':
  315. $mysign = $this->md5Sign($prestr, $this->key);
  316. break;
  317. default:
  318. $mysign = '';
  319. }
  320. return $mysign;
  321. }
  322. /**
  323. * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
  324. * @param $para 需要拼接的数组
  325. * return 拼接完成以后的字符串
  326. */
  327. private function createLinkstring($para)
  328. {
  329. $arg = '';
  330. while ((list ($key, $val) = each($para)) == true) {
  331. $arg .= $key . '=' . $val . '&';
  332. }
  333. //去掉最后一个&字符
  334. $arg = substr($arg, 0, count($arg) - 2);
  335. //如果存在转义字符,那么去掉转义
  336. if (get_magic_quotes_gpc()) {
  337. $arg = stripslashes($arg);
  338. }
  339. return $arg;
  340. }
  341. /**
  342. * 把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串,并对字符串做urlencode编码
  343. * @param $para 需要拼接的数组
  344. * return 拼接完成以后的字符串
  345. */
  346. private function createLinkstringUrlencode($para)
  347. {
  348. $arg = '';
  349. while ((list ($key, $val) = each($para)) == true) {
  350. $arg .= $key . '=' . urlencode($val) . '&';
  351. }
  352. //去掉最后一个&字符
  353. $arg = substr($arg, 0, count($arg) - 2);
  354. //如果存在转义字符,那么去掉转义
  355. if (get_magic_quotes_gpc()) {
  356. $arg = stripslashes($arg);
  357. }
  358. return $arg;
  359. }
  360. /**
  361. * 签名字符串
  362. * @param $prestr 需要签名的字符串
  363. * @param $key 私钥
  364. * return 签名结果
  365. */
  366. private function md5Sign($prestr, $key)
  367. {
  368. $prestr = $prestr . $key;
  369. return md5($prestr);
  370. }
  371. /**
  372. * 验证签名
  373. * @param $prestr 需要签名的字符串
  374. * @param $sign 签名结果
  375. * @param $key 私钥
  376. * return 签名结果
  377. */
  378. private function md5Verify($prestr, $sign, $key)
  379. {
  380. $prestr = $prestr . $key;
  381. $mysgin = md5($prestr);
  382. if ($mysgin == $sign) {
  383. return true;
  384. } else {
  385. return false;
  386. }
  387. }
  388. /**
  389. * 获取返回时的签名验证结果
  390. * @param $para_temp 通知返回来的参数数组
  391. * @param $sign 返回的签名结果
  392. * @return 签名验证结果
  393. */
  394. private function getSignVeryfy($para_temp, $sign)
  395. {
  396. //除去待签名参数数组中的空值和签名参数
  397. $para_filter = $this->paraFilter($para_temp);
  398. //对待签名参数数组排序
  399. $para_sort = $this->argSort($para_filter);
  400. //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
  401. $prestr = $this->createLinkstring($para_sort);
  402. $is_sgin = false;
  403. switch (strtoupper(trim($this->sign_type))) {
  404. case 'MD5':
  405. $is_sgin = $this->md5Verify($prestr, $sign, $this->key);
  406. break;
  407. default:
  408. $is_sgin = false;
  409. }
  410. return $is_sgin;
  411. }
  412. /**
  413. * 获取远程服务器ATN结果,验证返回URL
  414. * @param $notify_id 通知校验ID
  415. * @return 服务器ATN结果
  416. * 验证结果集:
  417. * invalid命令参数不对 出现这个错误,请检测返回处理中partner和key是否为空
  418. * true 返回正确信息
  419. * false 请检查防火墙或者是服务器阻止端口问题以及验证时间是否超过一分钟
  420. */
  421. private function getResponse($notify_id)
  422. {
  423. $transport = strtolower(trim($this->transport));
  424. $partner = trim($this->partner);
  425. $veryfy_url = '';
  426. if ($transport == 'https') {
  427. $veryfy_url = $this->__https_verify_url;
  428. } else {
  429. $veryfy_url = $this->__http_verify_url;
  430. }
  431. $veryfy_url = $veryfy_url . 'partner=' . $partner . '&notify_id=' . $notify_id;
  432. $response_txt = $this->getHttpResponseGET($veryfy_url, $this->cacert);
  433. return $response_txt;
  434. }
  435. /**
  436. * 远程获取数据,GET模式
  437. * 注意:
  438. * 1.使用Crul需要修改服务器中php.ini文件的设置,找到php_curl.dll去掉前面的";"就行了
  439. * 2.文件夹中cacert.pem是SSL证书请保证其路径有效,目前默认路径是:getcwd().'\\cacert.pem'
  440. * @param $url 指定URL完整路径地址
  441. * @param $cacert_url 指定当前工作目录绝对路径
  442. * return 远程输出的数据
  443. */
  444. private function getHttpResponseGET($url, $cacert_url)
  445. {
  446. $curl = curl_init($url);
  447. curl_setopt($curl, CURLOPT_HEADER, 0); // 过滤HTTP头
  448. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // 显示输出结果
  449. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, true); //SSL证书认证
  450. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2); //严格认证
  451. curl_setopt($curl, CURLOPT_CAINFO, $cacert_url); //证书地址
  452. $responseText = curl_exec($curl);
  453. //var_dump( curl_error($curl) );//如果执行curl过程中出现异常,可打开此开关,以便查看异常内容
  454. curl_close($curl);
  455. return $responseText;
  456. }
  457. /**
  458. * 统一退款
  459. *
  460. * @return string
  461. */
  462. public function refund($out_refund_no)
  463. {
  464. $service = 'refund_fastpay_by_platform_pwd';
  465. $notify_url = Url::shopSchemeUrl('payment/alipay/refundNotifyUrl.php');
  466. $parameter = array(
  467. 'service' => $service,
  468. 'partner' => $this->partner,
  469. 'seller_user_id' => $this->partner,
  470. 'notify_url' => $notify_url,
  471. 'seller_email' => $this->seller_id,
  472. 'refund_date' => date('Y-m-d H:i:s', time()),
  473. 'batch_no' => $out_refund_no,
  474. 'batch_num' => 1,
  475. 'detail_data' => $this->out_trade_no . '^' . $this->total_fee . '^退款订单',
  476. '_input_charset' => strtolower($this->_input_charset),
  477. );
  478. $para = $this->buildRequestPara($parameter);
  479. return ['url' => $this->__gateway_new . $this->createLinkstringUrlencode($para), 'batch_no' => $out_refund_no];
  480. }
  481. /**
  482. * 单次提现
  483. *
  484. * @param $collectioner_account
  485. * @param $collectioner_name
  486. * @return string
  487. */
  488. public function withdraw($collectioner_account, $collectioner_name, $out_trade_no, $batch_no)
  489. {
  490. $pay = Setting::get('shop.pay');
  491. Utils::dataDecrypt($pay);
  492. \Log::debug('----支付宝提现----');
  493. return $this->withdraw_v2($pay, $collectioner_account, $collectioner_name, $out_trade_no, $batch_no);
  494. }
  495. private function withdraw_v1($pay, $collectioner_account, $collectioner_name, $out_trade_no, $batch_no)
  496. {
  497. $service = 'batch_trans_notify';
  498. $notify_url = Url::shopSchemeUrl('payment/alipay/withdrawNotifyUrl.php');
  499. $parameter = array(
  500. 'service' => $service,
  501. 'partner' => $this->partner,
  502. 'notify_url' => $notify_url,
  503. 'email' => $pay['alipay_number'],
  504. 'account_name' => $pay['alipay_name'],
  505. 'pay_date' => date('Ymd', time()),
  506. 'batch_no' => $batch_no,
  507. 'batch_fee' => $this->total_fee,
  508. 'batch_num' => 1,
  509. 'detail_data' => $out_trade_no . '^' . $collectioner_account . '^' . $collectioner_name . '^' . $this->total_fee . '^佣金提现_' . \YunShop::app()->uniacid,
  510. '_input_charset' => strtolower($this->_input_charset),
  511. );
  512. $para = $this->buildRequestPara($parameter);
  513. return $this->__gateway_new . $this->createLinkstringUrlencode($para);
  514. }
  515. private function withdraw_v2($pay, $collectioner_account, $collectioner_name, $out_trade_no, $batch_no)
  516. {
  517. $res['errno'] = 1;
  518. $res['message'] = '系统异常,提现失败';
  519. $aop = new AopClient();
  520. $aop->appId = $pay['alipay_app_id'];
  521. $aop->rsaPrivateKey = $pay['rsa_private_key'];
  522. $aop->alipayrsaPublicKey= $pay['rsa_public_key'];
  523. $aop->signType = 'RSA2';
  524. $request = new AlipayFundTransToaccountTransferRequest();
  525. $data = [
  526. 'out_biz_no' => $out_trade_no,
  527. 'payee_type' => $this->payee_type,
  528. 'payee_account' => $collectioner_account,
  529. 'amount' => $this->total_fee,
  530. 'payer_show_name' => $pay['alipay_name'],
  531. 'payee_real_name' => $collectioner_name,
  532. 'remark' => '佣金提现'
  533. ];
  534. $request->setBizContent(json_encode($data));
  535. $result = $aop->execute ( $request);
  536. $result = json_decode($result);
  537. $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
  538. $resultCode = $result->$responseNode->code;
  539. \Log::debug('-----返回参数code----', [$resultCode]);
  540. \Log::debug('-----返回参数sub_code----', [$result->$responseNode->sub_code]);
  541. if(!empty($resultCode) && $resultCode == 10000){
  542. \Log::debug('-----成功----');
  543. $out_biz_no = $result->$responseNode->out_biz_no;
  544. $data[] = [
  545. 'trade_no' => $out_biz_no,
  546. 'unit' => 'yuan',
  547. 'pay_type' => '支付宝'
  548. ];
  549. $this->withdrawResutl($data);
  550. $res['errno'] = 0;
  551. $res['message'] = '提现成功';
  552. return $res;
  553. }
  554. \Log::debug('-----失败----');
  555. if (isset($result->$responseNode)) {
  556. throw new AppException($result->$responseNode->sub_msg . '[' . $result->$responseNode->msg . ']');
  557. }
  558. return $res;
  559. }
  560. /**
  561. * 批量打款
  562. *
  563. * @param $collectioner_account
  564. * @param $collectioner_name
  565. * @param $out_trade_no
  566. * @param $batch_no
  567. * @return string
  568. */
  569. public function batchWithdraw($collectioner_account, $collectioner_name, $withdraws, $batch_no)
  570. {
  571. $service = 'batch_trans_notify';
  572. $pay = Setting::get('shop.pay');
  573. Utils::dataDecrypt($pay);
  574. $notify_url = Url::shopSchemeUrl('payment/alipay/withdrawNotifyUrl.php');
  575. $total_fee = 0;
  576. $detail_data = '';
  577. $batch_num = 0;
  578. foreach ($withdraws as $key => $withdraw) {
  579. $total_fee += $withdraw->actual_amounts;
  580. $batch_num++;
  581. $detail_data .= $withdraw->withdraw_sn . '^' . $collectioner_account[$key] . '^' . $collectioner_name[$key] . '^' . $withdraw->actual_amounts . '^佣金提现_' . \YunShop::app()->uniacid . '|';
  582. }
  583. $parameter = array(
  584. 'service' => $service,
  585. 'partner' => $this->partner,
  586. 'notify_url' => $notify_url,
  587. 'email' => $pay['alipay_number'],
  588. 'account_name' => $pay['alipay_name'],
  589. 'pay_date' => date('Ymd', time()),
  590. 'batch_no' => $batch_no,
  591. 'batch_fee' => $total_fee,
  592. 'batch_num' => $batch_num,
  593. 'detail_data' => rtrim($detail_data, '|'),
  594. '_input_charset' => strtolower($this->_input_charset),
  595. );
  596. $para = $this->buildRequestPara($parameter);
  597. return $this->__gateway_new . $this->createLinkstringUrlencode($para);
  598. }
  599. /**
  600. * 支付宝提现回调操作
  601. *
  602. * @param $data
  603. */
  604. public function withdrawResutl($params)
  605. {
  606. if (!empty($params)) {
  607. foreach ($params as $data ) {
  608. $pay_refund_model = PayWithdrawOrder::getOrderInfo($data['trade_no']);
  609. if ($pay_refund_model) {
  610. $pay_refund_model->status = 2;
  611. $pay_refund_model->trade_no = $data['trade_no'];
  612. $pay_refund_model->save();
  613. }
  614. \Log::debug('提现操作', 'withdraw.succeeded');
  615. Withdraw::paySuccess($data['trade_no']);
  616. event(new AlipayWithdrawEvent($data['trade_no']));
  617. }
  618. }
  619. }
  620. }