Sfoglia il codice sorgente

提交 api的基础数据

lvhao 7 ore fa
parent
commit
e61e1663a8

+ 21 - 0
core/CoreApp/controllers/Lyerpapi/v1/Commontools.php

@@ -0,0 +1,21 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Commontools extends Lyapi_Controller{
+    // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
+    public function __construct() {
+        // 这里不执行登录校验,只加载缓存驱动
+        parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
+        // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
+       // $this->load->driver('cache'); // 加载缓存驱动
+    }
+    public function checklogin() {
+        if($this->input->method(TRUE) != 'POST'){
+
+            $this->_json_error('请求方式错误','500');
+        }
+        $json_str = $this->input->raw_input_stream;
+        $data = json_decode($json_str,true);
+        $this->_json_error('完成校验','200');
+    }
+}

+ 55 - 0
core/CoreApp/controllers/Lyerpapi/v1/Order.php

@@ -0,0 +1,55 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Order extends Lyapi_Controller{
+    // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
+    public function __construct() {
+        // 这里不执行登录校验,只加载缓存驱动
+        parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
+        // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
+       // $this->load->driver('cache'); // 加载缓存驱动
+       $this->load->_model("Model_logic_order","logic_order");
+    }
+
+    public function getinfo(){
+        if($this->input->method(TRUE) != 'POST'){
+
+            $this->_json_error('请求方式错误','500');
+        }
+        $json_str = $this->input->raw_input_stream;
+        $data = json_decode($json_str,true);
+        if(empty($data['scancode'])){
+            $this->_json_error('参数错误','500');
+        }
+        $number = $data['scancode'];
+        if(stripos($number,'-') === false){
+            if(substr($number,0,3) == '788' && substr($number,-4,4) == '0430')//Fedex联邦
+            {
+                $number = substr($number,0,12);
+            }
+            if(strlen($number) == '34')//联邦杭州超长运单截取
+            {
+                $str  = substr($number, 0,3);
+                if($str == "420"){
+                    $number = substr($number,12);
+                }else{
+                    $number = substr($number,22,12);
+                }
+            }
+            $info = $this->logic_order->getInfo("waybill = '".$number."'");
+        }else{
+            $info = $this->logic_order->getInfo("number = '".$data['scancode']."'");
+        }
+        if(empty($info)){
+            $this->_json_error('未查询到订单信息','500');
+        }
+        $this->_json_error('成功',200,[
+            'orderinfo'=>$info['orderinfo'],
+            'number'=>$info['number'],
+            'waybill'=>$info['waybill'],
+            'printtime'=>date("Y-m-d H:i",$info['printtime']),
+        ]);
+        
+    }
+    
+}

+ 15 - 0
core/CoreApp/controllers/Lyerpapi/v1/Outwarehouse.php

@@ -0,0 +1,15 @@
+<?php
+defined('BASEPATH') OR exit('No direct script access allowed');
+
+class Outwarehouse extends Lyapi_Controller{
+    // 注意:登录接口不能受基础控制器的登录校验,可以覆盖构造方法或单独处理
+    public function __construct() {
+        // 这里不执行登录校验,只加载缓存驱动
+        parent::__construct(); // 暂时注释,或者使用一个新的不校验的基类
+        // 简便做法:复制 Lyapi_Controller 的部分代码但不调用 _check_api_auth
+       // $this->load->driver('cache'); // 加载缓存驱动
+    }
+    public function ckct() {
+        $this->_json_error("获取成功",200,[]);
+    }
+}

+ 3 - 1
core/CoreApp/core/Lin_Controller.php

@@ -199,7 +199,9 @@ abstract class Lyapi_Controller extends CI_Controller {
 		}
 		$power_name = $this->input->get('p',true);
 		if(!in_array($power_name, $cache_info['power'])){
-			$this->_json_error('没有权限',403);
+			if($power_name != "gy"){
+				$this->_json_error('没有权限',403);
+			}
 		}
 	}