123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace refill\bailian;
- require_once(BASE_HELPER_RAPI_PATH . '/bailian/config.php');
- use Log;
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $input = $params;
- unset($input['sign']);
- $sign = config::sign($input);
- if ($params['sign'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- public function notify($params)
- {
- $status = intval($params['orderStatus']);
- $order_sn = $params['outOrderId'];
- $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 ($status === 2) {
- Log::record("mengu sms:{$params['ext1']}",Log::DEBUG);
- Model('')->table('refill_ext')->insert(['order_id' => $order_id, 'sms' => $params['ext1']]);
- $official_sn = config::official_sn($params['ext1']);
- Model('refill_order')->edit($order_id, ['official_sn' => $official_sn]);
- return [$order_id, true, false,true];
- }
- elseif ($status === 3) {
- return [$order_id, false, true,true];
- }
- else {
- return [$order_id, false, false,false];
- }
- }
- }
|