1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace refill\shuoruan;
- require_once(BASE_HELPER_RAPI_PATH . '/shuoruan/config.php');
- use refill;
- class RefillCallBack implements refill\IRefillCallBack
- {
- public function verify($params): bool
- {
- $sign = $this->sign($params);
- if ($params['Sign'] == $sign) {
- return true;
- } else {
- return false;
- }
- }
- private function sign($params)
- {
- $key = config::KEY;
- $content = "Orderid={$params['Orderid']}&Chargeid={$params['Chargeid']}&Orderstatu_int={$params['Orderstatu_int']}&Errorcode={$params['Errorcode']}&Password={$key}";
- return md5($content);
- }
- public function notify($params)
- {
- $status = intval($params['Orderstatu_int']);
- $order_sn = $params['Orderid'];
- $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 (in_array($status, [11, 16])) {
- return [$order_id, true, false,true];
- }
- elseif (in_array($status, [20, 21, 26])) {
- return [$order_id, false, true,true];
- }
- else {
- return [$order_id, false, false,false];
- }
- }
- }
|