sign($params); if ($params['sign'] == $sign) { return true; } else { return false; } } private function sign($params) { $params['price'] = number_format($params['price'], 3); $mchid = config::MCHID; $key = config::KEY; $content = "mchid={$mchid}&orderid={$params['orderid']}&oid={$params['oid']}&status={$params['status']}&price={$params['price']}&key={$key}"; return md5($content); } public function notify($params) { $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']; $status = intval($params['status']); if ($status === 1) { $data['official_sn'] = strtolower($params['voucher']) == 'null' ? '' : $params['voucher']; Model('refill_order')->edit($order_id, $data); return [$order_id, true, false, true]; } elseif ($status === 2) { return [$order_id, false, true, true]; } else { return [$order_id, false, false, false]; } } }