123456789101112131415161718192021222324252627282930313233343536373839404142 |
- <?php
- namespace refill\fetch_lingzh;
- require_once(BASE_HELPER_RAPI_PATH . '/fetch_lingzh/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- return true;
- }
- public function notify($params)
- {
- $order_sn = $params['order_sn'];
- $state = $params['state'];
- $official_sn = $params['official_sn'] ?? '';
- $order_info = Model('vr_order')->getOrderInfo(['order_sn' => $order_sn]);
- if (empty($order_info)) {
- return [false, false, false,false];
- }
- $order_id = $order_info['order_id'];
- if ($state === 'SUCCESS') {
- Model('refill_order')->edit($order_id, ['official_sn' => $official_sn]);
- return [$order_id, true, false,true];
- }
- elseif ($state === 'CANCEL') {
- return [$order_id, false, true,true];
- }
- else {
- return [$order_id, false, false,false];
- }
- }
- }
|