post(); $data = json_decode($post['data']); $sing = $post['sign']; $res = $this->verifySign($sing, $post['data']); if($res){ $order = strstr($data->order_no, '-', -1); $res = StoreOrder::paySuccess($order, $data->pay_channel); if ($res){ echo '200'; exit(); } }else { echo 'error'; exit(); } } public function cz_notify(Request $request) { $post = $request->post(); $data = json_decode($post['data']); $sing = $post['sign']; $res = $this->verifySign($sing, $post['data']); if($res){ $order = strstr($data->order_no, '-', -1); $res = UserRecharge::rechargeSuccess($order); if ($res){ echo '200'; exit(); } }else { echo 'error'; exit(); } } public function checkEmpty($value) { if (!isset($value)) return true; if ($value === null) return true; if (trim($value) === "") return true; return false; } public function verifySign($signature, $data){ if($this->checkEmpty($this->rsaPublicKeyFilePath)){ $pubKey=$this->rsaPublicKey; $key = "-----BEGIN PUBLIC KEY-----\n".wordwrap($pubKey, 64, "\n", true)."\n-----END PUBLIC KEY-----"; }else { $pubKey = file_get_contents($this->rsaPublicKeyFilePath); $key = openssl_get_publickey($pubKey); } if (openssl_verify($data, base64_decode($signature), $key)){ return true; }else{ return false; } } }