瀏覽代碼

完善信息ys的回执

lvhao 3 天之前
父節點
當前提交
ad81dddc5b
共有 1 個文件被更改,包括 59 次插入13 次删除
  1. 59 13
      core/CoreApp/controllers/Lyerpapi/v1/Yyys.php

+ 59 - 13
core/CoreApp/controllers/Lyerpapi/v1/Yyys.php

@@ -11,20 +11,66 @@ class Yyys extends Lyapi_Controller{
 
     public function lyysmsghz() {
         $ip = $this->input->ip_address();
-        $gsmc = $this->input->get('gsmc');
-        if($gsmc != 'LYERP'){
-            exit('No direct script access allowed !');
+        $json_str = $this->input->raw_input_stream;
+        $data = json_decode($json_str,true);
+        $jiami_str =  hash_hmac('sha256', 'LYERP_'.$data['timestamp'], 'ys&ly202608261549');
+        //$jiami_str.="&";
+        // if($gsmc != $jiami_str){
+        //     echo "ERROR!-".$jiami_str;
+        // }
+        $ys_no = "";
+        if(!empty($data['content'])){
+            if(!empty($data['content']['code'])){       
+                $ys_no = $data['content']['code'];
+            }
         }
-        if($ip != '59.110.247.93'){
-            exit('No direct script access allowed !!!');
+        if($jiami_str != $data['gsmc']){
+            $this->db->insert("ysnorecords",[
+                'ys_no'=>$ys_no,
+                'recept_cont'=>$json_str,
+                'addtime'=>time(),
+            ]);
+            echo "ERROR";
+            exit;
+        }else{
+            $time = time();
+            $info = $this->ysrecords->find("ys_no = '{$ys_no}'");  
+            if(empty($info)){
+                $this->db->insert("ysnorecords",[
+                    'ys_no'=>$ys_no,
+                    'recept_cont'=>$json_str,
+                    'addtime'=>time(),
+                ]);
+                echo "ERROR";
+                exit;
+            } 
+            //调拨订单审核
+            if($data['type'] == 'st_transferapply_bill_audit'){
+                $this->ysrecords->save(
+                [
+                    'recept_cont'=>$json_str,
+                    'recepttime'=>$time,
+                    'status'=>0,
+                    'dotime'=>0
+                ],$info['id']);
+           
+            }
+            //调拨订单弃审
+            if($data['st_transferapply_bill_unaudit']){
+                $this->ysrecords->save(
+                [
+                    'recept_cont'=>$json_str,
+                    'unaudit_time'=>$time,
+                    'status'=>0,
+                    'dotime'=>0
+                ],$info['id']);
+            }
+            echo "SUCCESS";
+            exit;
+
         }
-        $json_str = $this->input->raw_input_stream;
-        $this->db->insert("ysnorecords",[
-            'ys_no'=>date("YmdHis"),
-            'recept_cont'=>$json_str,
-            'addtime'=>time(),
-        ]);
-        echo "SUCCESS";
-        exit;
+        
+       
+        
     }
 }