12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- <?php
- namespace refill\lexianglt;
- require_once(BASE_HELPER_RAPI_PATH . '/lexianglt/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- return true;
- }
- public function aes_decrypt($data)
- {
- $data = str_replace(' ','+',$data);
- $data = base64_decode($data);
- $data = openssl_decrypt($data, 'AES-128-CBC', config::UserKey, OPENSSL_NO_PADDING, config::aesIV);
- return strstr($data,'}',true) . "}";
- }
- public function notify($params)
- {
- $decrypt = $this->aes_decrypt($params['PostData']);
- $data = json_decode($decrypt, true);
- $status = intval($data['Status']);
- $order_sn = $data['OrderNo'];
- $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 === 3) {
- Model('refill_order')->edit($order_id, ['official_sn' => $data['OperatorSerialNumber']]);
- return [$order_id, true, false,true];
- }
- elseif ($status === 2) {
- return [$order_id, false, true,true];
- }
- else {
- return [$order_id, false, false,false];
- }
- }
- }
|