Пример #1
0
 public function back()
 {
     $message = $_GET["message"];
     $signature = $_GET["signature"];
     vendor('jubaopay.jubaopay');
     $jubaopay = new \jubaopay('jubaopay.ini');
     $jubaopay->decrypt($message);
     // 校验签名,然后进行业务处理
     $result = $jubaopay->verify($signature);
     if ($result == 1) {
         // 得到解密的结果后,进行业务处理
         $payid = $jubaopay->getEncrypt("payid");
         $state = $jubaopay->getEncrypt("state");
         //		   $amount=$jubaopay->getEncrypt("amount");
         //		   $orderNo=$jubaopay->getEncrypt("orderNo");
         $db = M('account');
         $data = $db->find($payid);
         if ($data) {
             $type = (int) $data["type"];
             if ($type == 30 || $type == 1) {
                 layout(false);
                 if ($state == '2') {
                     $this->display("success");
                 } else {
                     $this->display("error");
                 }
             } else {
                 if ($type == 31 || $type == 11) {
                     if ($state == '2') {
                         $this->redirect('Home/Pay/success');
                     } else {
                         $this->redirect('Home/Pay/error');
                     }
                 }
             }
         }
     }
 }