12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace refill\weisanhuo;
- require_once(BASE_HELPER_RAPI_PATH . '/weisanhuo/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $sign = config::sign($params, ['sign']);
- if ($params['sign'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- public function notify($params): array
- {
- $status = $params['status'];
- $order_sn = $params['outTradeNo'];
- $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]);
- if (empty($order_info)) {
- return [false, false, false, false, ''];
- }
- $order_id = $order_info['order_id'];
- if ($status == 'success') {
- $official_sn = $params['inTradeNo'];
- Model('refill_order')->edit($order_id, ['official_sn' => $official_sn, 'ch_trade_no' => $params['orderId']]);
- return [$order_id, true, false, true, $official_sn];
- } elseif ($status == 'failed') {
- return [$order_id, false, true, true, ''];
- } else {
- return [$order_id, false, false, false, ''];
- }
- }
- }
|