sign($input); if ($params['sign'] == $sign) { return true; } else { return false; } } private function sign($params) { $content = ''; ksort($params); foreach ($params as $key => $val) { if(false === $this->check_empty($val)) { $content .= "{$key}={$val}&"; } } $content .= "key=".config::KEY; return strtoupper(md5($content)); } protected function check_empty($value) { if (!isset($value)) return true; if ($value === null) return true; if (trim($value) === "") return true; return false; } public function notify($params) { $order_sn = $params['orderId']; $order_info = Model('vr_order')->getOrderInfoForNotify(['order_sn' => $order_sn]); if (empty($order_info)) { return [false, false, false,false]; } $order_id = $order_info['order_id']; $status = $params['status']; if ($status === 'SUCCESS') { return [$order_id, true, false, true]; } elseif ($status === 'FAIL') { return [$order_id, false, true, true]; } else { return [$order_id, false, false, false]; } } }