Ver Fonte

优化接口

huangsanjia há 1 ano atrás
pai
commit
90cfb7e59d
2 ficheiros alterados com 14 adições e 3 exclusões
  1. 1 1
      application/api/config.php
  2. 13 2
      application/api/controller/Custom.php

+ 1 - 1
application/api/config.php

@@ -3,5 +3,5 @@
 //配置文件
 return [
     'exception_handle'        => '\\app\\api\\library\\ExceptionHandle',
-    'product_code_digit'    => 4,//成品编码位数
+    'product_code_digit'    => 5,//成品编码位数
 ];

+ 13 - 2
application/api/controller/Custom.php

@@ -33,8 +33,19 @@ class Custom extends Api
             $this->error('非法请求');
         }
         $field = 'rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称';
-        $list = db('产品_基本资料')->distinct(true)->field($field)->order('客户编号 asc')->select();
-        $this->success('请求成功',$list);
+        $list = db('产品_基本资料')->where('客户名称','not null')->distinct(true)->field($field)->order('客户编号 asc')->select();
+        $Ydata = [];
+        $Jdata = [];
+        foreach ($list as $key => $value){
+            if (substr($value['客户编号'],0,1) == 'Y'){
+                array_push($Ydata,$value);
+            }else{
+                array_push($Jdata,$value);
+            }
+        }
+        $data['印刷产品'] = $Ydata;
+        $data['糊盒产品'] = $Jdata;
+        $this->success('请求成功',$data);
     }
     /**
      * 客户资料管理