sign($input); if ($params['sign'] == $sign) { return true; } else { return false; } } private function sign($params) { $params['appSecret'] = config::APP_SECRET; ksort($params); $content = ''; foreach ($params as $key => $value) { if($this->check_empty($value) === false) { $content .= "{$key}={$value}&"; } } $content = rtrim($content, '&'); return md5($content); } private 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) { $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]; } } }