panlumeng 3 years ago
parent
commit
d6d71fea84

+ 2 - 2
app/admin/controller/Activity.php

@@ -100,9 +100,9 @@ class Activity extends BaseController
         $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) : "1";
         $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) : "10";
         $where = [["a.is_del", "=", 0]];
-        $good_code = isset($this->post['good_code']) && $this->post['good_codee'] !== "" ? trim($this->post['good_codee']) : "";
+        $good_code = isset($this->post['good_code']) && $this->post['good_code'] !== "" ? trim($this->post['good_code']) : "";
         if ($good_code != "") {
-            $where[] = ['a.good_codee', "like", "%$good_code%"];
+            $where[] = ['a.good_code', "like", "%$good_code%"];
         }
         $good_name = isset($this->post['good_name']) && $this->post['good_name'] !== "" ? trim($this->post['good_name']) : "";
         if ($good_name != "") {

+ 19 - 0
app/admin/controller/Brand.php

@@ -160,4 +160,23 @@ class Brand extends BaseController
             return error_show(1002,"删除失败");
         }
     }
+    public function info(){
+        $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id不能为空");
+        }
+        $info =  Db::name("brand")->where([["id","=",$id]])->find();
+        if(!$info) {
+            return error_show(1002, "未找到对应数据");
+        }
+        $data = Db::name("brand_book")->alias('a')
+            ->join("brand b","a.brand_id=b.id")->field("a.*,b.brand_name")
+            ->join("supplier c","c.code= a.gyscode","left")
+            ->field("a.creater,a.addtime,c.code,c.name,c.status")->where(['brand_id'=>$info['id']])->find();
+        if($data){
+            return error_show(0,"获取成功");
+        }else{
+            return error_show(1002,"获取失败");
+        }
+    }
 }

+ 12 - 8
app/admin/controller/Business.php

@@ -15,6 +15,7 @@ class Business extends BaseController
         $this->post = $this->request->post();
     }
     public function create(){
+        $companyNo = makeNo("GS");
         $company = isset($this->post['company']) && $this->post['company'] !==""? trim($this->post['company']):"";
         if($company==""){
             return error_show(1002,"参数company不能为空");
@@ -83,6 +84,7 @@ class Business extends BaseController
 
            $data =[
                "company"=>$company,
+               "companyNo"=>$companyNo,
                "inv_code"=>$inv_code,
                "type"=>$type,
                "inv_legaler"=>$inv_legaler,
@@ -144,15 +146,15 @@ class Business extends BaseController
         $count = Db::name('business') ->where($where)->count();
         $total = ceil($count / $size);
         $page = $page >= $total ? $total : $page;
-        $list = Db::name('business')->where($where)->page($page,$size)->field("company,status,creater,addtime,type")->order("addtime desc")->select();
-        $data=[];
-        foreach ($list as $value){
-            $info = Db::name('company_type')->where(['id'=>$value['type'],"is_del"=>0])->find();
-            $value['companytype']=isset($info['company_type'])?$info['company_type']:"";
-            $data[]=$value;
-        }
+        $list = Db::name('business')->where($where)->page($page,$size)->field("company,companyNo,status,creater,addtime,type")->order("addtime desc")->select();
+//        $data=[];
+//        foreach ($list as $value){
+//            $info = Db::name('company_type')->where(['id'=>$value['type'],"is_del"=>0])->find();
+//            $value['companytype']=isset($info['company_type'])?$info['company_type']:"";
+//            $data[]=$value;
+//        }
 
-        return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
+        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
     }
     public function edit(){
        $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
@@ -163,6 +165,7 @@ class Business extends BaseController
        if($idinfo==""){
            return error_show(1003,"未找到数据");
        }
+       $companyNo = makeNo("GS");
         $company = isset($this->post['company']) && $this->post['company'] !==""? trim($this->post['company']):"";
         if($company==""){
             return error_show(1002,"参数company不能为空");
@@ -231,6 +234,7 @@ class Business extends BaseController
             $data = [
                 "id"=>$id,
                 "company"=>$company,
+                "companyNo"=>$companyNo,
                 "inv_code"=>$inv_code,
                 "type"=>$type,
                 "creater"=>$creater,

+ 4 - 4
app/admin/controller/Goodup.php

@@ -26,10 +26,10 @@ class Goodup extends BaseController
         if($good_name!==""){
             $where[]=['good_name',"like","$good_name"];
         }
-        $good_code = isset($this->post['good_code']) && $this->post['good_code'] !=="" ? trim($this->post['good_code']):"";
-        if($good_code!==""){
-          $where [] = ['good_code',"like",$good_code];
-         }
+//        $good_code = isset($this->post['good_code']) && $this->post['good_code'] !=="" ? trim($this->post['good_code']):"";
+//        if($good_code!==""){
+//          $where [] = ['good_code',"like",$good_code];
+//         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
         if($start!==""){
             $where[]=['addtime',">=",date('Y-m-d H:i:s',strtotime($start))];

+ 164 - 0
app/admin/controller/Keepbrand.php

@@ -0,0 +1,164 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Keepbrand extends BaseController
+{
+    public $post = "";
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post= $this->request->post();
+    }
+    public function create(){
+        $brand_book = isset($this->post['brand_book']) && $this->post['brand_book'] !=="" ? trim($this->post['brand_book']):"";
+        if($brand_book==""){
+            return error_show(1003,"参数brand_book不能为空");
+        }
+        $gyscode = isset($this->post['gyscode']) && $this->post['gyscode'] !=="" ? trim($this->post['gyscode']):"";
+        if($gyscode==""){
+            return error_show(1003,"参数gyscode不能为空");
+        }
+        $brand_id = isset($this->post['brand_id']) && $this->post['brand_id'] !=="" ? trim($this->post['brand_id']):"";
+        if($brand_id==""){
+            return error_show(1003,"参数brand_id不能为空");
+        }
+        $is_book = isset($this->post['is_book']) && $this->post['is_book'] !=="" ? trim($this->post['is_book']):"";
+        if($is_book==""){
+            return error_show(1003,"参数is_book不能为空");
+        }
+        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
+        if($token==''){
+            return error_show(1005,"参数token不能为空");
+        }
+        $user =GetUserInfo($token);
+        if(empty($user)||$user['code']!=0){
+            return error_show(1002,"创建人数据不存在");
+        }
+        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
+        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
+        $long = isset($this->post['long']) && $this->post['long'] !=="" ? intval($this->post['long']):"0";
+
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"0";
+            $data=[
+                "brand_book"=>$brand_book,
+                "gyscode"=>$gyscode,
+                "is_book"=>$is_book,
+                "brand_id"=>$brand_id,
+                "createrid"=>$createrid,
+                "creater"=>$creater,
+                "long"=>$long,
+                "is_del"=>0,
+                "status"=>$status,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+        if($long===1){
+            $starttime = isset($this->post['starttime']) && $this->post['starttime'] !=="" ?$this->post['starttime']:"";
+            if($starttime==""){
+                return error_show(1005,'参数starttime不能为空');
+            }
+            $endtime= isset($this->post['endtime']) && $this->post['endtime'] !=="" ?$this->post['endtime']:"";
+            if($endtime==""){
+                return error_show(1005,'修改时间不能为空');
+            }
+            $data['starttime']=$starttime;
+            $data['endtime']=$endtime;
+        }
+            $info = Db::name("brand_book")->insert($data);
+            if($info){
+                return error_show(0,"新建成功");
+            }else{
+                return error_show(1002,"新建失败");
+            }
+    }
+    public function list(){
+        $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
+        $size = isset($this->post['size']) && $this->post['size'] !== "" ? intval($this->post['size']) :"10";
+        $where=[['a.is_del',"=",0]];
+        $gyscode = isset($this->post['gyscode']) && $this->post['gyscode'] !=="" ? intval($this->post['gyscode']):"";
+        if($gyscode!=""){
+            $where[]=['a.gyscode',"like","%$gyscode%"];
+        }
+        $name = isset($this->post['name']) && $this->post['name'] !=="" ? intval($this->post['name']):"";
+        if($name!=""){
+            $where[]=['b.name',"like","%$name%"];
+        }
+        $registerCode = isset($this->post['registerCode']) && $this->post['registerCode'] !=="" ? intval($this->post['registerCode']):"";
+        if($registerCode!=""){
+            $where[]=['b.registerCode',"like","%$registerCode%"];
+        }
+        $count = Db::name('brand_book')
+            ->alias('a')->join("supplier b","a.gyscode=b.code","left")
+            ->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('brand_book')->alias('a')
+            ->join("supplier b","a.gyscode=b.code","left")
+            ->join("brand c","a.brand_id=c.id","left")
+            ->where($where)->page($page,$size)->field("a.*,c.brand_name")->order("addtime desc")->select();
+        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+    }
+    public function info(){
+        $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id不能为空");
+        }
+        $info =  Db::name("brand_book")->where(["id"=>$id])->find();
+        if(!$info) {
+            return error_show(1002, "未找到对应数据");
+        }
+        $data = Db::name("brand")->alias('a')
+            ->join("brand_book b","b.brand_id=a.id")
+            ->join("supplier c","b.gyscode=c.code","left")->field("b.*,a.brand_name,c.name")
+            ->where(["a.id"=>$info['brand_id']])->find();
+        if($data){
+            return app_show(0,"获取成功",$data);
+        }else{
+            return app_show(1002,"获取失败",$data);
+        }
+    }
+    public function status(){
+        $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id不能为空");
+        }
+        $info =  Db::name("brand_book")->where([["id","=",$id]])->find();
+        if(!$info){
+            return error_show(1002,"未找到对应数据");
+        }
+        $status =  isset($this->post['status']) && $this->post['status']!==""? intval($this->post['status']):"";
+        if($status===""){
+            return error_show(1002,"参数status不能为空");
+        }
+        if(!in_array($status,[0,1])){
+            return error_show(1002,"参数status无效");
+        }
+        $info['status']=$status;
+        $info['updatetime']=date("Y-m-d H:i:s");
+        $msg = $status==0?"启用":"禁用";
+        $update = Db::name("brand_book")->save($info);
+        return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
+    }
+    public function del(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id==""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $str= Db::name('brand_book')->where(['id'=>$id,'is_del'=>0])->find();
+        if(empty($str)){
+            return error_show(1002,"未找到数据");
+        }
+        $end = Db::name('brand_book')->update(['id'=>$id,'is_del'=>1]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+
+    }
+}

+ 5 - 0
app/admin/controller/Role.php

@@ -103,6 +103,10 @@ class Role extends BaseController
 //        if(empty($iteminfo) || $iteminfo['is_del']==1){
 //            return error_show(1003,"该部门不存在");
 //        }
+        $work_company = isset($post['work_company']) && $post['work_company'] !==""? intval($post['work_company']):"";
+        if($work_company==""){
+            return error_show(1002,"参数work_company不能为空");
+        }
         $level = isset($post['level']) ? intval($post['level']) : 0;
         $remark = isset($post['remark']) ? trim($post['remark']) : '';
 //        if($level==""){
@@ -123,6 +127,7 @@ class Role extends BaseController
             $list = [
                 "role_name"=>$rolename,
                 "role_code"=>$role_code,
+                "work_company"=>$work_company,
                 "status"=>1,
                 'creater'=>$username,
                 'createrId'=>$uid,

+ 9 - 1
app/admin/route/app.php

@@ -293,6 +293,7 @@ Route::rule('brandlist','admin/Brand/list');
 Route::rule('brandedit','admin/Brand/edit');
 Route::rule('brandstatus','admin/Brand/status');
 Route::rule('branddel','admin/Brand/del');
+Route::rule('brandinfo','admin/Brand/info');
 
 Route::rule('desccreate','admin/Catdesc/create');
 Route::rule('desclist','admin/Catdesc/list');
@@ -338,4 +339,11 @@ Route::rule('platformlist','admin/Platform/list');
 Route::rule('platformedit','admin/Platform/edit');
 Route::rule('platforminfo','admin/Platform/info');
 Route::rule('platformdelete','admin/Platform/del');
-Route::rule('platformstatus','admin/Platform/status');
+Route::rule('platformstatus','admin/Platform/status');
+
+Route::rule('keepbcreate','admin/Keepbrand/create');
+Route::rule('keepblist','admin/Keepbrand/list');
+Route::rule('keepbinfo','admin/Keepbrand/info');
+Route::rule('keepbstatus','admin/Keepbrand/status');
+Route::rule('keepbdelete','admin/Keepbrand/del');
+