sign($params); if ($params['sign'] == $sign) { return true; } else { return false; } } protected function check_empty($value) { if (!isset($value)) return true; if ($value === null) return true; if (trim($value) === "") return true; return false; } private function sign($params) { $content = ''; ksort($params); foreach ($params as $key => $val){ if (false === $this->check_empty($val) && "@" != substr($val, 0, 1)) { $content .= "{$key}={$val}&"; } } $content .= "appSecret=".config::APP_SECRET; return md5($content); } public function notify($params) { $status = $params['status']; $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']; $data['official_sn'] = strtolower($params['operatorId']) == 'null' ? '' : $params['operatorId']; if ($status === 3) { Model('refill_order')->edit($order_id, $data); return [$order_id, true, false,true]; } elseif ($status === 2) { return [$order_id, false, false,true]; } else { return [$order_id, false, false,false]; } } }