ayHaru 4 gadi atpakaļ
vecāks
revīzija
24d507981c
1 mainītis faili ar 24 papildinājumiem un 15 dzēšanām
  1. 24 15
      application/index/controller/Index.php

+ 24 - 15
application/index/controller/Index.php

@@ -1,61 +1,70 @@
 <?php
 namespace app\index\controller;
 
-
 class Index
 {
-//    const admin_url = 'host.docker.internal';
-    const admin_url = 'http://docker.hostip:8080';
-
-    protected function request($params)
+    private $mAdminUrl = '';
+    public function __construct()
     {
-
+//        $this->mAdminUrl = 'http://host.docker.internal:8080';
+        $this->mAdminUrl = 'http://docker.hostip:8080';
     }
 
     public function index()
     {
         echo 'index';
     }
+    //检查订单号码
     public function CheckOrder(){
         $order_sn = input('param.order_sn');
-        $result = http_get(self::admin_url . '/CheckOrder' ,['order_sn' => $order_sn]);
+        $result = http_get($this->mAdminUrl . '/CheckOrder' ,['order_sn' => $order_sn]);
         if($result == false){
             json_return(500,[],'网络错误');
         }
-        if($result['code'] != 0){
+
+        if($result['code'] != 0) {
             json_return($result['code'],[],$result['msg']);
         }
-        json_success($result['data']);
+        else {
+            json_success($result['data']);
+        }
     }
 
     public function CheckFcode(){
         $code = input('param.code');
-        $result = http_get(self::admin_url . ':8080/CheckFcode' ,['code' => $code]);
+        $result = http_get($this->mAdminUrl . '/CheckFcode' ,['code' => $code]);
         if($result == false){
             json_return(500,[],'网络错误');
         }
         if($result['code'] != 0){
             json_return($result['code'],[],$result['msg']);
         }
-        json_success($result['data']);
+        else {
+            json_success($result['data']);
+        }
     }
-    public function RecordStore(){
+    //上报存柜
+    public function RecordStore()
+    {
         $order_sn = input('param.order_sn');
         $trunk = input('param.trunk');
         $cabinet = input('param.cabinet');
-        $result = http_get(self::admin_url . ':8080/RecordStore' ,['order_sn' => $order_sn , 'trunk' => $trunk , 'cabinet' => $cabinet]);
+        $result = http_get($this->mAdminUrl . '/RecordStore' ,['order_sn' => $order_sn , 'trunk' => $trunk , 'cabinet' => $cabinet]);
         if($result == false){
             json_return(500,[],'网络错误');
         }
         if($result['code'] != 0){
             json_return($result['code'],[],$result['msg']);
+        } else {
+            json_success($result['data']);
         }
-        json_success($result['data']);
     }
+
+    //检查订单号码
     public function RecordFetch(){
         $trunk = input('param.trunk');
         $cabinet = input('param.cabinet');
-        $result = http_get(self::admin_url . ':8080/RecordFetch' ,['trunk' => $trunk , 'cabinet' => $cabinet]);
+        $result = http_get($this->mAdminUrl . '/RecordFetch' ,['trunk' => $trunk , 'cabinet' => $cabinet]);
         if($result == false){
             json_return(500,[],'网络错误');
         }