wugg 3 years ago
parent
commit
08c72bb71b

+ 4 - 3
app/admin/controller/Attr.php

@@ -29,7 +29,7 @@ class Attr extends BaseController
         }
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-        $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"1";
         $data=[
             "createrid"=>$createrid,
             "creater"=>$creater,
@@ -56,8 +56,9 @@ class Attr extends BaseController
         if($creater!=""){
             $where[]=['creater',"like","%$creater%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($creater!=""){
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";

+ 7 - 6
app/admin/controller/Brand.php

@@ -33,7 +33,7 @@ class Brand extends BaseController
         }
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"1";
 
         $data=[
             "brand_name"=>$brand_name,
@@ -57,15 +57,16 @@ class Brand extends BaseController
         $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
         $where=[["is_del","=",0]];
         $brand_name = isset($this->post['brand_name']) && $this->post['brand_name'] !=="" ? trim($this->post['brand_name']):"";
-        if($brand_name!=""){
+        if($brand_name!==""){
             $where[]=['brand_name',"like","%$brand_name%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($status!=""){
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
-        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? intval($this->post['creater']):"";
-        if($creater!=""){
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
+        if($creater!==""){
             $where[]=['creater',"like","%$creater%"];
         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";

+ 9 - 9
app/admin/controller/Business.php

@@ -78,7 +78,7 @@ class Business extends BaseController
         }
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-        $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"1";
         Db::startTrans();
        try{
 
@@ -124,15 +124,15 @@ class Business extends BaseController
         $size = isset($this->post['size']) && $this->post['size'] !==""? intval($this->post['size']):"10";
         $where = [["is_del","=",0]];
         $company = isset($this->post['company']) && $this->post['company'] !=="" ? trim($this->post['company']):"";
-        if($company!=""){
+        if($company!==""){
             $where[]=['company',"like","%$company%"];
         }
         $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($status!=""){
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
-        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? intval($this->post['creater']):"";
-        if($creater!=""){
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
+        if($creater!==""){
             $where[]=['creater',"like","%$creater%"];
         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
@@ -146,7 +146,7 @@ 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,companyNo,status,creater,addtime,type")->order("addtime desc")->select();
+        $list = Db::name('business')->where($where)->page($page,$size)->field("id,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();
@@ -271,9 +271,9 @@ class Business extends BaseController
 
     }
     public function del(){
-        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
-        if($id===""){
-            return  error_show(1004,"参数id不能为空");
+        $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id==""){
+            return error_show(1002,"参数id不能为空");
         }
         $str= Db::name('business')->where(['id'=>$id,'is_del'=>0])->find();
         if(empty($str)){

+ 14 - 1
app/admin/controller/Cat.php

@@ -179,7 +179,7 @@ public function edit(){
         return error_show(1002,"参数cat_name不能为空");
     }
     $pid = isset($this->post['pid']) && $this->post['pid'] !=="" ? intval($this->post['pid']) :"";
-    if($pid==""){
+    if($pid===""){
         return error_show(1002,"参数pid不能为空");
     }
     $cat_desc = isset($this->post['cat_desc']) && $this->post['cat_desc'] !=="" ? trim($this->post['cat_desc']) :"";
@@ -332,4 +332,17 @@ public function status(){
         return error_show(1002,"状态更新失败");
     }
 }
+public function delete(){
+    $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']) :"";
+    $info = Db::name('cat')->where(["is_del"=>0,'id'=>$id])->find();
+    if($info==false){
+        return error_show(1002,"未找到数据");
+    }
+    $supp= Db::name('cat')->update(['id'=>$id,'is_del'=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+    if($supp){
+        return error_show(0,"删除成功");
+    }else{
+        return error_show(1002,"删除失败");
+    }
+}
 }

+ 77 - 53
app/admin/controller/Customar.php

@@ -27,10 +27,10 @@ class Customar extends BaseController
         if ($companyName == "") {
             return error_show(1002, "参数companyName不能为空");
         }
-        $parent = isset($this->post['parent']) && $this->post['parent'] !== "" ? $this->post['parent'] : "";
-        if ($parent == "") {
-            return error_show(1002, "参数parent不能为空");
-        }
+        $parent = isset($this->post['parent']) && $this->post['parent'] !== "" ? intval($this->post['parent'] ) : "0";
+//        if ($parent === "") {
+//            return error_show(1002, "参数parent不能为空");
+//        }
         $customer_member = isset($this->post['customer_member']) && $this->post['customer_member'] !== "" ? $this->post['customer_member'] : "";
         if ($customer_member == "") {
             return error_show(1002, "参数customer_member不能为空");
@@ -82,36 +82,37 @@ class Customar extends BaseController
             $datainfo = Db::name('customer_info')->insert($data);
             if ($datainfo) {
 
-                $var = [];
-                //var_dump($customer_member);
+//                $var = [];
+//                //var_dump($customer_member);
                 foreach ($customer_member as $value) {
-                    $to = GetInfoById($token, ['id' => $value['id']]);
-
-                    if (empty($to) || $to['code'] != 0) {
-                        return app_show(1002, "数据拥有者信息不存在");
-                    }
-                    $item = [];
-                    $info = $to['data'];
-                    $item['owner'] = $info['nickname'];
-                    $item['ownerid'] = $info['id'];
-                    $item['commobile'] = $info['mobile'];
-                    $item['comtel'] = "";
-                    $item['contactor'] = isset($value['contactor']) ? $value['contactor'] : "";
-                    $item['position'] = isset($value['position']) ? $value['position'] : "";
-                    $item['wxaccount'] = isset($value['wxaccount']) ? $value['wxaccount'] : "";
-                    $item['qqaccount'] = isset($value['qqaccount']) ? $value['qqaccount'] : "";
-                    $item['email'] = isset($value['email']) ? $value['email'] : "";
-                    $item['comdepart'] = isset($value['comdepart']) ? $value['comdepart'] : "";
-                    $item['is_private'] = isset($value['is_private']) ? $value['is_private'] : "";
-                    $item['status'] = $value['status'];
-                    $item['createrid'] = $createrid;
-                    $item['creater'] = $creater;
-                    $item['companyNo'] = $companyNo;
-                    $item['is_del'] = 0;
-                    $item['addtime'] = date("Y-m-d H:i:s");
-                    $item['updatetime'] = date("Y-m-d H:i:s");
-                    $var[] = $item;
-                }
+//                    if($value['ownerid']!==""){
+//                        $to = GetInfoById($token, ['id' => $value['ownerid']]);
+//                        if (empty($to) || $to['code'] != 0) {
+//                            return app_show(1002, "数据拥有者信息不存在");
+//                        }
+//                    }
+                $item = [];
+//                $info = $to['data'];
+//                $item['owner'] =  isset($info['nickname']) ? $info['nickname'] : "";
+                // $item['ownerid'] = $info['id'];
+                $item['commobile'] = isset($value['commobile']) ? $value['commobile'] : "";;
+                $item['comtel'] =  "";
+                $item['contactor'] = isset($value['contactor']) ? $value['contactor'] : "";
+                $item['position'] = isset($value['position']) ? $value['position'] : "";
+                $item['wxaccount'] = isset($value['wxaccount']) ? $value['wxaccount'] : "";
+                $item['qqaccount'] = isset($value['qqaccount']) ? $value['qqaccount'] : "";
+                $item['email'] = isset($value['email']) ? $value['email'] : "";
+                $item['comdepart'] = isset($value['comdepart']) ? $value['comdepart'] : "";
+                //$item['is_private'] = isset($value['is_private']) ? $value['is_private'] : "";
+                $item['status'] = $value['status'];
+                $item['createrid'] = $createrid;
+                $item['creater'] = $creater;
+                $item['companyNo'] = $companyNo;
+                $item['is_del'] = 0;
+                $item['addtime'] = date("Y-m-d H:i:s");
+                $item['updatetime'] = date("Y-m-d H:i:s");
+                $var[] = $item;
+            }
                 $vp = Db::name('customer_member')->insertAll($var);
                 if ($vp == "") {
                     Db::rollback();
@@ -139,9 +140,10 @@ class Customar extends BaseController
         if ($companyName != "") {
             $where[] = ['b.companyName', "like", "%$companyName%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !== "" ? trim($this->post['status']) : "";
-        if ($status != "") {
-            $where[] = ['a.status', "=", $status];
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
+            $where[]=['status',"=",$status];
         }
         $creater = isset($this->post['creater']) && $this->post['creater'] !== "" ? intval($this->post['creater']) : "";
         if ($creater != "") {
@@ -219,16 +221,16 @@ class Customar extends BaseController
                 //$var=[];
                 //var_dump($customer_member);
                 foreach ($customer_member as $value) {
-                    $to = GetInfoById($token, ['id' => $value['ownerid']]);
-
-                    if (empty($to) || $to['code'] != 0) {
-                        return app_show(1002, "数据拥有者信息不存在");
-                    }
+//                    $to = GetInfoById($token, ['id' => $value['ownerid']]);
+//
+//                    if (empty($to) || $to['code'] != 0) {
+//                        return app_show(1002, "数据拥有者信息不存在");
+//                    }
                     $item = [];
-                    $info = $to['data'];
-                    $item['owner'] = $info['nickname'];
-                    $item['ownerid'] = $info['id'];
-                    $item['commobile'] = $info['mobile'];
+//                    $info = $to['data'];
+//                    $item['owner'] = $info['nickname'];
+//                    $item['ownerid'] = $info['id'];
+                    $item['commobile'] =isset($value['mobile']) ? $value['mobile'] : "";
                     $item['comtel'] = "";
                     $item['id'] = isset($value['id']) ? $value['id'] : "";
                     $item['contactor'] = isset($value['contactor']) ? $value['contactor'] : "";
@@ -237,7 +239,7 @@ class Customar extends BaseController
                     $item['qqaccount'] = isset($value['qqaccount']) ? $value['qqaccount'] : "";
                     $item['email'] = isset($value['email']) ? $value['email'] : "";
                     $item['comdepart'] = isset($value['comdepart']) ? $value['comdepart'] : "";
-                    $item['is_private'] = isset($value['is_private']) ? $value['is_private'] : "";
+                 //   $item['is_private'] = isset($value['is_private']) ? $value['is_private'] : "";
                     $item['status'] = $value['status'];
                     $item['createrid'] = $createrid;
                     $item['creater'] = $creater;
@@ -280,11 +282,11 @@ class Customar extends BaseController
         if ($info == "") {
             return error_show(1002, "未找到customer_member数据");
         }
-        $in = Db::name("customer_attr")->where(['id' => $idinfo['parent'], "is_del" => 0])->find();
-        if ($in == "") {
-            return error_show(1002, "未找到customer_attr数据");
-        }
-        $idinfo['attr_name'] = $in['name'];
+//        $in = Db::name("customer_attr")->where(['id' => $idinfo['parent'], "is_del" => 0])->find();
+//        if ($in == "") {
+//            return error_show(1002, "未找到customer_attr数据");
+//        }
+//        $idinfo['attr_name'] = $in['name'];
         $idinfo['member'] = $info;
         if ($idinfo == "") {
             return error_show(1002, "未找到数据");
@@ -296,15 +298,37 @@ class Customar extends BaseController
         if($id===""){
             return  error_show(1004,"参数id不能为空");
         }
-        $str= Db::name('customer_attr')->where(['id'=>$id,'is_del'=>0])->find();
+        $str= Db::name('customer_info')->where(['id'=>$id,'is_del'=>0])->find();
         if(empty($str)){
             return error_show(1002,"未找到数据");
         }
-        $end = Db::name('customer_attr')->update(['id'=>$id,'is_del'=>1]);
+        $end = Db::name('customer_info')->update(['id'=>$id,'is_del'=>1]);
         if($end){
             return error_show(0,"删除成功");
         }else{
             return error_show(1002,"删除失败");
         }
     }
+    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("customer_info")->where([["id","=",$id],["is_del","=",0]])->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;
+        $msg = $status==1?"启用":"禁用";
+        $update = Db::name("customer_info")->save($info);
+        return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
+
+    }
 }

+ 102 - 20
app/admin/controller/Customer.php

@@ -33,12 +33,52 @@ class Customer extends BaseController
         if($pid!==""){
             $condition[]=["pid","=",$pid];
         }
+        $companyNo = isset($this->post['companyNo']) && $this->post['companyNo'] !=="" ? trim($this->post['companyNo']):"";
+        if($companyNo !==""){
+            $where[] = ['companyNo',"like","%$companyNo%"];
+        }
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
+        if($creater !==""){
+            $where[] = ['creater',"like","%$creater%"];
+        }
         $name= isset($this->post['name'])&&$this->post['name']!=="" ? trim($this->post['name']):"";
         if($name!=""){
             $condition[]=["name","like","%{$this->post['name']}%"];
         }
+        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
+        if ($start != "") {
+            $where[] = ["addtime", '>=', $start];
+        }
+        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
+        if ($end != "") {
+            $where[] = ["addtime", '<=', $end];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
+        if($status!==""){
+            $where[] = ['status',"=",$status];
+        }
 //        $count = Db::name('customer_org1')->where($condition)->count();
 //        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
+        if($creater !==""){
+            $condition[] = ['creater',"like","%$creater%"];
+        }
+        $name= isset($this->post['name'])&&$this->post['name']!=="" ? trim($this->post['name']):"";
+        if($name!=""){
+            $condition[]=["name","like","%{$this->post['name']}%"];
+        }
+        $start = isset($this->post['start']) && $this->post['start'] !== "" ? $this->post['start'] : "";
+        if ($start != "") {
+            $condition[] = ["addtime", '>=', $start];
+        }
+        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] : "";
+        if ($end != "") {
+            $condition[] = ["addtime", '<=', $end];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
+        if($status!==""){
+            $condition[] = ['status',"=",$status];
+        }
         $pidlist = Db::name("customer_org1")->where($condition)->column("pid");
         if(!empty($pidlist)){
             $where[]=[["itemid","in",$pidlist]];
@@ -50,34 +90,40 @@ class Customer extends BaseController
                 $where[]=['itemid','=',$pid];
             }
         }
-        $list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("id,pid,name,level,depart_link");
+        $list = Db::name('customer_org1')->where($condition)->page($page,$size)->column("id,pid,name,level,depart_link,creater,addtime,status");
         $var=[];
         foreach ($list as $item) {
             $iten=[];
             $iten['name']=$item['name'];
-            $iten['code']="";
+//            $iten['code']="";
             $iten['id']=$item['id'];
-            $iten['kh']=0;
+            $iten['creater']=$item['creater'];
+            $iten['status']=$item['status'];
+            $iten['addtime']=$item['addtime'];
+            $iten['kh']=0;//组织架构
             $var[]=$iten;
         }
         $itm = Db::name('customer_info')->where($where)->select();
         foreach ($itm as $vat){
             $inm=[];
             $inm['name']=$vat['companyName'];
-            $inm['id']=$vat['id'];
-            $inm['code']=$vat['companyNo'];
-            $inm['companyName']=$vat['companyName'];
-            $inm['invoice_bank']=$vat['invoice_bank'];
-            $inm['invoice_bankNo']=$vat['invoice_bankNo'];
-            $inm['invoice_code']=$vat['invoice_code'];
-            $inm['invoice_people']=$vat['invoice_people'];
-            $inm['invoice_mobile']=$vat['invoice_mobile'];
-            $inm['invoice_addr']=$vat['invoice_addr'];
-            $inm['parent']=$vat['parent'];
-            $inm['branch']=$vat['branch'];
-            $inm['middle']=$vat['middle'];
-            $inm['country']=$vat['country'];
-            $inm['kh']=1;
+           $inm['id']=$vat['id'];
+//            $inm['code']=$vat['companyNo'];
+//            $inm['companyName']=$vat['companyName'];
+//            $inm['invoice_bank']=$vat['invoice_bank'];
+//            $inm['invoice_bankNo']=$vat['invoice_bankNo'];
+//            $inm['invoice_code']=$vat['invoice_code'];
+//            $inm['invoice_people']=$vat['invoice_people'];
+//            $inm['invoice_mobile']=$vat['invoice_mobile'];
+//            $inm['invoice_addr']=$vat['invoice_addr'];
+//            $inm['parent']=$vat['parent'];
+//            $inm['branch']=$vat['branch'];
+//            $inm['middle']=$vat['middle'];
+//            $inm['country']=$vat['country'];
+            $inm['status']=$vat['status'];
+            $inm['creater']=$vat['creater'];
+            $inm['addtime']=$vat['addtime'];
+            $inm['kh']=1;//客户
             $var[]=$inm;
         }
         return app_show(0,"获取成功",$var);
@@ -105,16 +151,31 @@ class Customer extends BaseController
                 return error_show(1004,"父级不能为空");
             }
         }
+        $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'] : "";
         $level = isset($this->post['level']) && $this->post['level'] !== "" ? trim($this->post['level']) : "1";
         Db::startTrans();
         try {
             $tada = [
                 "name" => $name,
-                "weight" => $weight, "pid" => $pid,
+                "weight" => $weight,
+                "pid" => $pid,
                 "level" => $level,
                 "updatetime" => date("Y-m-d H:i:s"),
                 "addtime" => date("Y-m-d H:i:s"),
-                "depart_link" => "", "is_del" => 0,"pname"=>isset($spid['name']) ? $spid['name']:"",
+                "depart_link" => "",
+                "is_del" => 0,
+                "pname"=>isset($spid['name']) ? $spid['name']:"",
+                "creater"=>$creater,
+                "createrid"=>$createrid
             ];
             $t = Db::name('customer_org1')->insert($tada, true);
            //var_dump(Db::name('customer_org1')->getLastSql());
@@ -217,6 +278,27 @@ class Customer extends BaseController
         $compy = Db::name('customer_org1')->save($custy);
         return $compy ? error_show(0,"删除成功"):error_show(1004,"删除失败");
     }
-
+    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("customer_org1")->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==1?"启用":"禁用";
+        $update = Db::name("customer_org1")->save($info);
+        return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
+    }
 
 }

+ 7 - 6
app/admin/controller/Goldprice.php

@@ -33,11 +33,11 @@ class Goldprice extends BaseController
     }
 
     public function create(){
-        $type = isset($this->post['type']) && $this->post['type'] !=="" ?trim($this->post['type']):"";
+        $type = isset($this->post['type']) && $this->post['type'] !=="" ?intval($this->post['type']):"";
         if($type==""){
             return error_show(1002,"参数type不能为空");
         }
-        $price = isset($this->post['price']) && $this->post['price'] !=="" ? intval($this->post['price']):"";
+        $price = isset($this->post['price']) && $this->post['price'] !=="" ? floatval($this->post['price']):"";
         if($price==""){
             return error_show(1002,"参数price不能为空");
         }
@@ -51,7 +51,7 @@ class Goldprice extends BaseController
         }
         $action_id= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $action_name= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"1";
         $data=[
             "type"=>$type,
             "price"=>$price,
@@ -133,7 +133,7 @@ class Goldprice extends BaseController
             return error_show(1002,"参数status无效");
         }
         $info['status']=$status;
-        $msg = $status==0?"启用":"禁用";
+        $msg = $status==1?"启用":"禁用";
         $update = Db::name("gold_price1")->save($info);
         return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
     }
@@ -150,7 +150,7 @@ class Goldprice extends BaseController
         if($type==""){
             return error_show(1002,"参数type不能为空");
         }
-        $price = isset($this->post['price']) && $this->post['price'] !=="" ? intval($this->post['price']):"";
+        $price = isset($this->post['price']) && $this->post['price'] !=="" ? floatval($this->post['price']):"";
         if($price==""){
             return error_show(1002,"参数price不能为空");
         }
@@ -166,13 +166,14 @@ class Goldprice extends BaseController
         $action_name= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
         $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"0";
         $data=[
+            "id"=>$id,
             "type"=>$type,
             "price"=>$price,
             "action_name"=>$action_name,
             "action_id"=>$action_id,
             "status"=>$status,
             "is_del"=>0,
-            "addtime"=>date("Y-m-d H:i:s")
+            //"addtime"=>date("Y-m-d H:i:s")
         ];
         $datainfo= Db::name("gold_price1")->save($data);
         if($datainfo){

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

@@ -691,9 +691,9 @@ class Goodup extends BaseController
             return error_show(1004,"参数status不能为空");
         }
         $remark = isset($this->post['remark'])&&$this->post['remark']!=="" ? trim($this->post['remark']):"";
-        if($remark===""){
-            return error_show(1004,"参数remark不能为空");
-        }
+//        if($remark===""){
+//            return error_show(1004,"参数remark不能为空");
+//        }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
             return error_show(1005,"参数token不能为空");

+ 11 - 11
app/admin/controller/Keepbrand.php

@@ -27,10 +27,10 @@ class Keepbrand extends BaseController
         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不能为空");
-        }
+//        $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不能为空");
@@ -43,11 +43,11 @@ class Keepbrand extends BaseController
         $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";
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']) :"1";
             $data=[
                 "brand_book"=>$brand_book,
                 "gyscode"=>$gyscode,
-                "is_book"=>$is_book,
+               // "is_book"=>$is_book,
                 "brand_id"=>$brand_id,
                 "createrid"=>$createrid,
                 "creater"=>$creater,
@@ -181,10 +181,10 @@ class Keepbrand extends BaseController
         if($brand_id==""){
             return error_show(1002,"参数brand_id不能为空");
         }
-        $is_book = isset($this->post['is_book']) && $this->post['is_book'] !== "" ? intval($this->post['is_book']):"";
-        if($is_book==""){
-            return error_show(1002,"参数is_book不能为空");
-        }
+//        $is_book = isset($this->post['is_book']) && $this->post['is_book'] !== "" ? intval($this->post['is_book']):"";
+//        if($is_book==""){
+//            return error_show(1002,"参数is_book不能为空");
+//        }
         $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";
         if($status==""){
@@ -194,7 +194,7 @@ class Keepbrand extends BaseController
             "id"=>$id,
             "brand_book"=>$brand_book,
             "gyscode"=>$gyscode,
-            "is_book"=>$is_book,
+           // "is_book"=>$is_book,
             "brand_id"=>$brand_id,
             "long"=>$long,
             "is_del"=>0,

+ 17 - 2
app/admin/controller/Platform.php

@@ -21,6 +21,10 @@ class Platform extends BaseController
             return error_show(1003,"参数platform_name不能为空");
 
         }
+        $platform_type = isset($this->post['platform_type']) && $this->post['platform_type'] !=="" ? intval($this->post['platform_type']):"";
+        if($platform_type==""){
+            return error_show(1002,"参数platform_type不能为空");
+        }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
             return error_show(1005,"参数token不能为空");
@@ -36,6 +40,7 @@ class Platform extends BaseController
         $data=[
             "platform_code"=>$platform_code,
             "platform_name"=>$platform_name,
+            "platform_type"=>$platform_type,
             "createrid"=>$action_id,
             "creater"=>$action_name,
             "desc"=>$desc,
@@ -59,8 +64,13 @@ class Platform extends BaseController
         if($platform_name!=""){
             $where[]=['platform_name',"like","%$platform_name%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($status!=""){
+        $platform_type = isset($this->post['platform_type']) && $this->post['platform_type'] !=="" ? intval($this->post['platform_type']):"";
+        if($platform_type !=""){
+            $where[]=['platform_type',"=",$platform_type];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
@@ -92,6 +102,10 @@ class Platform extends BaseController
         if ($platform_name == "") {
             return error_show(1002, "参数platform_name不能为空");
         }
+        $platform_type = isset($this->post['platform_type']) && $this->post['platform_type'] !== "" ? intval($this->post['platform_type']) :"";
+        if($platform_type==""){
+            return error_show(1002,"参数platform_type不能为空");
+        }
         $token = isset($this->post['token']) && $this->post['token'] != '' ? trim($this->post['token']) : "";
         if ($token == '') {
             return error_show(1005, "参数token不能为空");
@@ -108,6 +122,7 @@ class Platform extends BaseController
             "id" => $id,
             "platform_code" => $platform_code,
             "platform_name" => $platform_name,
+            "platform_type" => $platform_type,
             "createrid" => $action_id,
             "creater" => $action_name,
             "desc" => $desc,

+ 4 - 3
app/admin/controller/Specs.php

@@ -30,7 +30,7 @@ class Specs extends BaseController
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
         $exam_status = isset($this->post['exam_status']) &&$this->post['exam_status'] !==""? intval($this->post['exam_status']):"0";
-        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"1";
         $data = [
             "spec_name"=>$spec_name,
             "creater"=>$creater,
@@ -56,8 +56,9 @@ class Specs extends BaseController
         if($spec_name!=""){
             $where[]=['spec_name',"like","%$spec_name%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($status!=""){
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
         $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? intval($this->post['creater']):"";

+ 437 - 0
app/admin/controller/Suppler.php

@@ -0,0 +1,437 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Suppler extends BaseController
+{
+    public $post = "";
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post=$this->request->post();
+    }
+    public function create(){
+        $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']) :"";
+
+//        $rename = Db::name('supplier')->where(['is_del' => 0, 'name' => $name])->find();
+//        if (!empty($rename)) {
+//            return error_show(1002, "公司名称已存在");
+//        }
+        $code = rand(0000,9999);
+        $str = sprintf("%04d",$code);
+        $tr="GYS-".date("Ymd")."-".$str;
+        $source= isset($this->post['source']) && $this->post['source']!==""? intval($this->post['source']) :"";
+        if($source===""){
+            return error_show(1002,"供应商来源不能为空");
+        }
+        $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'] : "";
+        $type = isset($this->post['type']) && $this->post['type']!==""? intval($this->post['type']) :"";
+        if($type===""){
+            return error_show(1002,"申请类型不能为空");
+        }
+        $coop_state = isset($this->post['coop_state']) && $this->post['coop_state'] !==""? intval($this->post['coop_state']):"";
+        if($coop_state===""){
+            return error_show(1002,"参数coop_state不能为空");
+        }
+        $category = isset($this->post['category']) && $this->post['category'] !==""? intval($this->post['category']):"";
+        if($category===""){
+            return error_show(1002,"参数category不能为空");
+        }
+        $delivery_way = isset($this->post['delivery_way']) && $this->post['delivery_way'] !==""? intval($this->post['delivery_way']):"";
+        if($delivery_way===""){
+            return error_show(1002,"参数delivery_way不能为空");
+        }
+        $level = isset($this->post['level']) && $this->post['level'] !==""? intval($this->post['level']):"";
+        if($level===""){
+            return error_show(1002,"参数level不能为空");
+        }
+        $supplier_type = isset($this->post['supplier_type']) && $this->post['supplier_type'] !==""? intval($this->post['supplier_type']):"";
+        if($supplier_type===""){
+            return error_show(1002,"参数supplier_type不能为空");
+        }
+        $pay_type = isset($this->post['pay_type']) && $this->post['pay_type'] !==""? intval($this->post['pay_type']):"";
+        if($pay_type===""){
+            return error_show(1002,"参数pay_type不能为空");
+        }
+        $prove_img = isset($this->post['prove_img']) && $this->post['prove_img'] !==""? trim($this->post['prove_img']):"";
+        if($prove_img==""){
+            return error_show(1002,"参数prove_img不能为空");
+        }
+       // $area = isset($this->post['area']) && $this->post['area']!==""? trim($this->post['area']) :"";
+       // $city = isset($this->post['city']) && $this->post['city']!==""? trim($this->post['city']) :"";
+        $nature = isset($this->post['nature']) && $this->post['nature']!==""? intval($this->post['nature']) :"";
+        $is_platform = isset($this->post['is_platform']) && $this->post['is_platform']!==""? intval($this->post['is_platform']) :"0";
+        $ticket_type = isset($this->post['ticket_type']) && $this->post['ticket_type']!==""? intval($this->post['ticket_type']) :"";
+        $legaler = isset($this->post['legaler']) && $this->post['legaler']!==""? trim($this->post['legaler']) :"";
+        $addr = isset($this->post['addr']) && $this->post['addr']!==""? trim($this->post['addr']) :"";
+        $registercode= isset($this->post['registercode']) && $this->post['registercode']!==""? trim($this->post['registercode']) :"";
+        $capital= isset($this->post['capital']) && $this->post['capital']!==""? intval($this->post['capital']) :"";
+        $product_category= isset($this->post['product_category']) && $this->post['product_category']!==""? trim($this->post['product_category']) :"";
+        $is_payment= isset($this->post['is_payment']) && $this->post['is_payment']!==""?trim($this->post['is_payment']) :"";
+        $notice_mark= isset($this->post['notice_mark']) && $this->post['notice_mark']!==""?trim($this->post['notice_mark']) :"";
+        $agreement= isset($this->post['agreement']) && $this->post['agreement']!==""?trim($this->post['agreement']) :"";
+        $warehouse= isset($this->post['warehouse']) && $this->post['warehouse']!==""?trim($this->post['warehouse']) :"";
+        $pay_day= isset($this->post['pay_day']) && $this->post['pay_day']!==""?trim($this->post['pay_day']) :"";
+        $scope= isset($this->post['scope']) && $this->post['scope']!==""?trim($this->post['scope']) :"";
+        $status= isset($this->post['status']) && $this->post['status']!==""?intval($this->post['status']) :"1";
+        $registertime= isset($this->post['registertime']) && $this->post['registertime']!==""? $this->post['registertime'] :"";
+        $supplier_img = isset($this->post['supplier_img']) && $this->post['supplier_img'] !=="" ? trim($this->post['supplier_img']):"";
+        $contactor = isset($this->post['contactor']) && $this->post['contactor'] !=="" ? trim($this->post['contactor']):"";
+        if($contactor==""){
+            return error_show(1002,"参数contactor不能为空");
+        }
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? trim($this->post['mobile']):"";
+        if($mobile==""){
+            return error_show(1002,"参数mobile不能为空");
+        }
+        $position = isset($this->post['position']) && $this->post['position'] !=="" ? trim($this->post['position']):"";
+        if($position==""){
+            return error_show(1002,"参数position不能为空");
+        }
+        Db::startTrans();
+        try{
+            $data=[
+                "name"=>$name,
+                "source"=>$source,
+                "coop_state"=>$coop_state,
+                "category"=>$category,
+                "delivery_way"=>$delivery_way,
+                "level"=>$level,
+                "supplier_type"=>$supplier_type,
+                "pay_type"=>$pay_type,
+                "registercode"=>$registercode,
+                "capital"=>$capital,
+                "product_category"=>$product_category,
+                "is_payment"=>$is_payment,
+                "notice_mark"=>$notice_mark,
+                "agreement"=>$agreement,
+                "warehouse"=>$warehouse,
+                "pay_day"=>$pay_day,
+                "scope"=>$scope,
+                "status"=>$status,
+                "code"=>$tr,
+                "type"=>$type,
+               // "area"=>$area,
+               // "city"=>$city,
+                "nature"=>$nature,
+                "legaler"=>$legaler,
+                "addr"=>$addr,
+                "is_del"=>0,
+                "ticket_type"=>$ticket_type,
+                "addtime"=>date('Y-m-d H:i:s'),
+                "updatetime"=>date("Y-m-d H:i:s"),
+                "is_platform"=>$is_platform,
+                "prove_img"=>$prove_img,
+                "creater"=>$creater,
+                "createrid"=>$createrid,
+                "registertime"=>date('Y-m-d H:i:s')
+            ];
+            if($supplier_img==""){
+                if($registercode==""){
+                    return error_show(1002,"参数registercode不能为空");
+                }
+                if($name==""){
+                    return error_show(1002,"数据标题不能为空");
+                }
+                if($nature===""){
+                    return error_show(1002,"参数nature不能为空");
+                }
+                if($legaler==""){
+                    return error_show(1002,"参数legaler不能为空");
+                }
+                if($registertime==""){
+                    return error_show(1002,"参数registertime不能为空");
+                }
+                if($addr==""){
+                    return error_show(1002,"参数addr不能为空");
+                }
+                if($scope==""){
+                    return error_show(1002,"参数scope不能为空");
+                }
+                $data['registertime']=$registertime;
+            }
+            $join = Db::name('supplier')->insert($data,true);
+            if($join>0){
+                    $temp = [];
+                    $temp['code']=$code;
+                    $temp['contactor'] =$contactor;
+                    $temp['mobile'] = $mobile;
+                    $temp['position'] = $position;
+                    $temp['email'] ="";
+                    $temp['is_del'] = 0;
+                    $temp['addtime'] = date("Y-m-d H:i:s");
+                    $temp['updatetime'] = date("Y-m-d H:i:s");
+                $vp = Db::name('supplier_contact')->insert($temp);
+                if ($vp == "") {
+                    Db::rollback();
+                    return error_show(1002, "添加失败");
+                }
+                Db::commit();
+                return error_show(0,"添加成功") ;
+            }else{
+                Db::rollback();
+                return error_show(1002,"添加失败");
+            }
+        }catch (\Exception $e) {
+            Db::rollback();
+            return error_show(1003, $e->getMessage());
+        }
+    }
+    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]];
+        $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']):"";
+        if($name !==""){
+            $where[]=["a.name","like","%$name%"];
+        }
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
+        if($creater !==""){
+            $where[] = ["a.creater","like","%$creater%"];
+        }
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
+        if($status!==""){
+            $where[]= ["a.status","=",$status];
+        }
+        $start = isset($this->post['start']) && $this->post['start'] !== "" ?  $this->post['start']:"";
+        if($start!==""){
+            $where[]=['a.addtime',">=",$start];
+        }
+//        $end = isset($this->post['end']) && $this->post['end'] !== "" ? $this->post['end'] :"";
+//        if($end !=""){
+//            $where[]=['a.addtime',"<=",$end];
+//        }
+        $contactor = isset($this->post['contactor']) && $this->post['contactor'] !==""? trim($this->post['contactor']):"";
+        if($contactor !=""){
+            $where[]=["b.contactor","like","%$contactor%"];
+        }
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? intval($this->post['mobile']):"";
+        if($mobile !=""){
+            $where[] = ['b.mobile',"like","%$mobile%"];
+        }
+        $count = Db::name('supplier')->alias("a")
+            ->join("supplier_contact b","b.code=a.code","left")
+            ->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('supplier')->alias('a')
+            ->join("supplier_contact b","b.code=a.code","left")
+            ->where($where)->page($page,$size)->order("a.addtime desc")
+            ->field("a.*,b.contactor,b.mobile")->select();
+        return app_show("0","获取成功",['list'=>$list,'count'=>$count]);
+    }
+    public function edit(){
+        $id = isset($this->post['id']) && $this->post['id'] !=="" ? intval($this->post['id']):"";
+        if($id==""){
+            return error_show(1002,"参数id不能为空");
+        }
+        $info = Db::name("supplier")->where(['id'=>$id,'is_del'=>0])->find();
+        if($info==""){
+            return error_show(1002,"未找到数据");
+        }
+        $source= isset($this->post['source']) && $this->post['source']!==""? trim($this->post['source']) :"";
+        if($source==""){
+            return error_show(1002,"供应商来源不能为空");
+        }
+        $type = isset($this->post['type']) && $this->post['type']!==""? trim($this->post['type']) :"";
+        if($type==""){
+            return error_show(1002,"申请类型不能为空");
+        }
+        $coop_state = isset($this->post['coop_state']) && $this->post['coop_state'] !==""? trim($this->post['coop_state']):"";
+        if($coop_state==""){
+            return error_show(1002,"参数coop_state不能为空");
+        }
+        $category = isset($this->post['category']) && $this->post['category'] !==""? trim($this->post['category']):"";
+        if($category==""){
+            return error_show(1002,"参数category不能为空");
+        }
+        $delivery_way = isset($this->post['delivery_way']) && $this->post['delivery_way'] !==""? trim($this->post['delivery_way']):"";
+        if($delivery_way==""){
+            return error_show(1002,"参数delivery_way不能为空");
+        }
+        $level = isset($this->post['level']) && $this->post['level'] !==""? trim($this->post['level']):"";
+        if($level==""){
+            return error_show(1002,"参数level不能为空");
+        }
+        $supplier_type = isset($this->post['supplier_type']) && $this->post['supplier_type'] !==""? trim($this->post['supplier_type']):"";
+        if($supplier_type==""){
+            return error_show(1002,"参数supplier_type不能为空");
+        }
+        $pay_type = isset($this->post['pay_type']) && $this->post['pay_type'] !==""? trim($this->post['pay_type']):"";
+        if($pay_type==""){
+            return error_show(1002,"参数pay_type不能为空");
+        }
+        $prove_img = isset($this->post['prove_img']) && $this->post['prove_img'] !==""? trim($this->post['prove_img']):"";
+        if($prove_img==""){
+            return error_show(1002,"参数prove_img不能为空");
+        }
+        $name = isset($this->post['name']) && $this->post['name'] !=="" ? trim($this->post['name']) :"";
+        $nature = isset($this->post['nature']) && $this->post['nature']!==""? trim($this->post['nature']) :"";
+        $is_platform = isset($this->post['is_platform']) && $this->post['is_platform']!==""? intval($this->post['is_platform']) :"0";
+        $ticket_type = isset($this->post['ticket_type']) && $this->post['ticket_type']!==""? trim($this->post['ticket_type']) :"";
+        $legaler = isset($this->post['legaler']) && $this->post['legaler']!==""? trim($this->post['legaler']) :"";
+        $addr = isset($this->post['addr']) && $this->post['addr']!==""? trim($this->post['addr']) :"";
+        $registercode= isset($this->post['registercode']) && $this->post['registercode']!==""? trim($this->post['registercode']) :"";
+        $capital= isset($this->post['capital']) && $this->post['capital']!==""? intval($this->post['capital']) :"";
+        $product_category= isset($this->post['product_category']) && $this->post['product_category']!==""? trim($this->post['product_category']) :"";
+        $is_payment= isset($this->post['is_payment']) && $this->post['is_payment']!==""?trim($this->post['is_payment']) :"";
+        $notice_mark= isset($this->post['notice_mark']) && $this->post['notice_mark']!==""?trim($this->post['notice_mark']) :"";
+        $agreement= isset($this->post['agreement']) && $this->post['agreement']!==""?trim($this->post['agreement']) :"";
+        $warehouse= isset($this->post['warehouse']) && $this->post['warehouse']!==""?trim($this->post['warehouse']) :"";
+        $pay_day= isset($this->post['pay_day']) && $this->post['pay_day']!==""?trim($this->post['pay_day']) :"";
+        $scope= isset($this->post['scope']) && $this->post['scope']!==""?trim($this->post['scope']) :"";
+        $status= isset($this->post['status']) && $this->post['status']!==""?trim($this->post['status']) :"";
+        $registertime= isset($this->post['registertime']) && $this->post['registertime']!==""? $this->post['registertime'] :"";
+        $supplier_img = isset($this->post['supplier_img']) && $this->post['supplier_img'] !=="" ? trim($this->post['supplier_img']):"";
+        $contactor = isset($this->post['contactor']) && $this->post['contactor'] !=="" ? trim($this->post['contactor']):"";
+        if($contactor==""){
+            return error_show(1002,"参数contactor不能为空");
+        }
+        $mobile = isset($this->post['mobile']) && $this->post['mobile'] !=="" ? trim($this->post['mobile']):"";
+        if($mobile==""){
+            return error_show(1002,"参数mobile不能为空");
+        }
+        $position = isset($this->post['position']) && $this->post['position'] !=="" ? trim($this->post['position']):"";
+        if($position==""){
+            return error_show(1002,"参数position不能为空");
+        }
+        try{
+            $data=[
+                "id"=>$id,
+                "source"=>$source,
+                "coop_state"=>$coop_state,
+                "category"=>$category,
+                "delivery_way"=>$delivery_way,
+                "level"=>$level,
+                "supplier_type"=>$supplier_type,
+                "pay_type"=>$pay_type,
+                "registercode"=>$registercode,
+                "capital"=>$capital,
+                "product_category"=>$product_category,
+                "is_payment"=>$is_payment,
+                "notice_mark"=>$notice_mark,
+                "agreement"=>$agreement,
+                "warehouse"=>$warehouse,
+                "pay_day"=>$pay_day,
+                "scope"=>$scope,
+                "status"=>$status,
+                "type"=>$type,
+                "nature"=>$nature,
+                "legaler"=>$legaler,
+                "addr"=>$addr,
+                "is_del"=>0,
+                "ticket_type"=>$ticket_type,
+                "updatetime"=>date("Y-m-d H:i:s"),
+                "is_platform"=>$is_platform,
+                "prove_img"=>$prove_img,
+                "registertime"=>date("Y-m-d H:i:s"),
+            ];
+            if($supplier_img==""){
+                if($registercode==""){
+                    return error_show(1002,"参数registercode不能为空");
+                }
+                if($name==""){
+                    return error_show(1002,"数据标题不能为空");
+                }
+                if($nature==""){
+                    return error_show(1002,"参数nature不能为空");
+                }
+                if($legaler==""){
+                    return error_show(1002,"参数legaler不能为空");
+                }
+                if($registertime==""){
+                    return error_show(1002,"参数registertime不能为空");
+                }
+                $data['registertime']=$registertime;
+            }
+            $join = Db::name('supplier')->where(['id'=>$id,'is_del'=>0])->save($data);
+            if($join){
+                $item = Db::name('supplier_contact')->where(['code'=>$join['code']])->find();
+                    $temp = [];
+                isset($item['id']) && $item['id'] !== "" ? $temp['id'] = $item['id'] : '';
+                    $temp['code'] = $info['code'];
+                    $temp['contactor'] = $contactor;
+                    $temp['mobile'] = $mobile;
+                    $temp['position'] = $position;
+                    $temp['email'] ="";
+                    $temp['contactor'] ="";
+                    $temp['is_del'] = 0;
+                isset($item['id']) && $item['id'] !== "" ? '' : $temp['addtime'] = date("Y-m-d H:i:s");
+                    $temp['updatetime'] = date("Y-m-d H:i:s");
+
+                $vp = Db::name('supplier_contact')->save($temp);
+                if ($vp == "") {
+                    Db::rollback();
+                    return error_show(1002, "更新失败");
+                }
+                Db::commit();
+                return error_show(0,"编辑成功") ;
+            }else{
+                Db::rollback();
+                return error_show(1002,"编辑失败");
+            }
+        }catch (\Exception $e) {
+            Db::rollback();
+            return error_show(1003, $e->getMessage());
+        }
+    }
+    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('supplier')->where(['id'=>$id,'is_del'=>0])->find();
+        if($info==""){
+            return error_show(1002,"未找到数据");
+        }
+        return app_show(0,"获取成功",$info);
+    }
+    public function del(){
+        $id = isset($this->post['id']) && $this->post['id'] !==""? intval($this->post['id']) :"";
+        $sup = Db::name('supplier')->where(["is_del"=>0,'id'=>$id])->find();
+        if($sup==false){
+            return error_show(1002,"供应商信息不存在");
+        }
+        $supp= Db::name('supplier')->update(['id'=>$id,'is_del'=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+        if($supp){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
+    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("supplier")->where([["id","=",$id],["is_del","=",0]])->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==1?"启用":"禁用";
+        $update = Db::name("supplier")->save($info);
+        return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
+    }
+}

+ 25 - 12
app/admin/controller/Supplier.php

@@ -80,7 +80,6 @@ public function create(){
     }
     $is_platform = isset($this->post['is_platform']) && $this->post['is_platform']!==""? intval($this->post['is_platform'])
         :"0";
-
     $ticket_type = isset($this->post['ticket_type']) && $this->post['ticket_type']!==""? trim($this->post['ticket_type']) :"";
     if($ticket_type==""){
         return error_show(1002,"回款方式不能为空");
@@ -94,10 +93,17 @@ public function create(){
         return error_show(1002,"地址不能为空");
     }
     $data=[
-        "name"=>$name,"source"=>$source,"code"=>$tr,
-        "type"=>$type,"area"=>$area,"city"=>$city,
-        "nature"=>$nature,"legaler"=>$legaler,"addr"=>$addr,
-        "is_del"=>0,"ticket_type"=>$ticket_type,
+        "name"=>$name,
+        "source"=>$source,
+        "code"=>$tr,
+        "type"=>$type,
+        "area"=>$area,
+        "city"=>$city,
+        "nature"=>$nature,
+        "legaler"=>$legaler,
+        "addr"=>$addr,
+        "is_del"=>0,
+        "ticket_type"=>$ticket_type,
         "addtime"=>date('Y-m-d H:i:s'),
         "updatetime"=>date("Y-m-d H:i:s"),
         "is_platform"=>$is_platform
@@ -153,11 +159,18 @@ public function edit(){
         return error_show(1002,"地址不能为空");
     }
     $vmp=[
-        "id"=>$id,"legaler"=>$legaler,
-        "name"=>$name,"source"=>$source,
-        "type"=>$type,"area"=>$area,"city"=>$city,
-        "nature"=>$nature,"addr"=>$addr,
-        "is_del"=>0,"addtime"=>date('Y-m-d H:i:s'),"is_platform"=>$is_platform,
+        "id"=>$id,
+        "legaler"=>$legaler,
+        "name"=>$name,
+        "source"=>$source,
+        "type"=>$type,
+        "area"=>$area,
+        "city"=>$city,
+        "nature"=>$nature,
+        "addr"=>$addr,
+        "is_del"=>0,
+        "is_platform"=>$is_platform,
+        "addtime"=>date('Y-m-d H:i:s'),
         "updatetime"=>date("Y-m-d H:i:s")
     ];
     $ed = Db::name('supplier')->where(['is_del'=>0,'id'=>$id])->save($vmp);
@@ -183,8 +196,8 @@ public function selec(){
     }
     $supp= Db::name('supplier')->update(['id'=>$id,'is_del'=>1,"updatetime"=>date("Y-m-d H:i:s")]);
     if($supp){
-        $st = ["order_code"=>$id,"status"=>0,"action_remark"=>'',"action_type"=>"del"];
-        ActionLog::logAdd($this->post['token'],$st,"GYS",0,$supp);
+//        $st = ["order_code"=>$id,"status"=>0,"action_remark"=>'',"action_type"=>"del"];
+//        ActionLog::logAdd($this->post['token'],$st,"GYS",0,$supp);
         return error_show(0,"供应商信息删除成功");
     }else{
         return error_show(1002,"供应商信息删除失败");

+ 4 - 3
app/admin/controller/Title.php

@@ -85,9 +85,10 @@ class Title extends BaseController
         if($invoice_mobile !=""){
             $where[] =['a.invoice_code',"like","%$invoice_mobile%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? trim($this->post['status']):"";
-        if($status !=""){
-            $where[] =['a.status',"=",$status];
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
+            $where[]=['a.status',"=",$status];
         }
         $companyName = isset($this->post['companyName']) && $this->post['companyName'] !=="" ? trim($this->post['companyName']):"";
         if($companyName!=""){

+ 10 - 7
app/admin/controller/Unit.php

@@ -29,7 +29,7 @@ class Unit extends BaseController
         }
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
-        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
+        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"1";
         $data=[
             "unit"=>$unit,
             "creater"=>$creater,
@@ -51,24 +51,27 @@ class Unit extends BaseController
         $size = isset($this->post['size']) && $this->post['size'] !=="" ? intval($this->post['size']):"10";
         $where=[["is_del","=",0]];
         $unit = isset($this->post['unit']) && $this->post['unit'] !=="" ? trim($this->post['unit']):"";
-        if($unit!=""){
+        if($unit!==""){
             $where[]=['unit',"like","%$unit%"];
         }
-        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status']):"";
-        if($status!=""){
+        $status = isset($this->post['status']) && $this->post['status'] !=="" ? intval($this->post['status'])
+            :"";
+        if($status!==""){
             $where[]=['status',"=",$status];
         }
-        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? intval($this->post['creater']):"";
+        $creater = isset($this->post['creater']) && $this->post['creater'] !=="" ? trim($this->post['creater']):"";
         if($creater!=""){
             $where[]=['creater',"like","%$creater%"];
         }
         $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
         if($start!==""){
-            $where[]=['addtime',">=",date('Y-m-d H:i:s',strtotime($start))];
+           // $where[]=['addtime',">=",date('Y-m-d H:i:s')];//,strtotime($start)
+            $where[]=['addtime',">=",$start];
         }
         $end = isset($this->post['end']) && $this->post['end']!=="" ? $this->post['end']:"";
         if($end!==""){
-            $where[]=['addtime',"<",date('Y-m-d H:i:s',strtotime($end)+24*3600)];
+           // $where[]=['addtime',"<",date('Y-m-d H:i:s')];//,strtotime($end)+24*3600
+            $where[]=['addtime',"<=",$end];
         }
         $count = Db::name('unit') ->where($where)->count();
         $total = ceil($count / $size);

+ 12 - 0
app/admin/route/app.php

@@ -66,6 +66,7 @@ Route::rule('customercreate','admin/Customer/create');
 Route::rule('customerupdate','admin/Customer/updat');
 Route::rule('customerselect','admin/Customer/selec');
 Route::rule('customerdelect','admin/Customer/dell');
+Route::rule('customerstatus','admin/Customer/status');
 
 Route::rule('supplierlist','admin/Supplier/list');
 Route::rule('suppliercreate','admin/Supplier/create');
@@ -220,6 +221,7 @@ Route::rule('catedit','admin/Cat/edit');
 Route::rule('catinfo','admin/Cat/info');
 Route::rule('catstatus','admin/Cat/status');
 Route::rule('cattitle','admin/Cat/title');
+Route::rule('delete','admin/Cat/delete');
 
 Route::rule('backcreate','admin/Purchback/create');
 Route::rule('backlist','admin/Purchback/list');
@@ -307,12 +309,14 @@ Route::rule('goldpricedelect','admin/Goldprice/del');
 Route::rule('goldpricestatus','admin/Goldprice/status');
 Route::rule('goldlinst','admin/Goldprice/linst');
 Route::rule('goldratelist','admin/Goldprice/ratelist');
+Route::rule('golpriceedit','admin/Goldprice/edit');
 
 Route::rule('customarcreate','admin/Customar/create');
 Route::rule('customarlist','admin/Customar/list');
 Route::rule('customaredit','admin/Customar/edit');
 Route::rule('customarinfo','admin/Customar/info');
 Route::rule('customardelete','admin/Customar/del');
+Route::rule('customarstatus','admin/Customar/status');
 
 Route::rule('businesscreate','admin/Business/create');
 Route::rule('businesslist','admin/Business/list');
@@ -378,6 +382,7 @@ Route::rule('titleinfo','admin/Title/info');
 Route::rule('titledelete','admin/Title/del');
 Route::rule('titlestatus','admin/Title/status');
 
+
 Route::rule('ocrquery','admin/Ocrlicense/query');
 
 
@@ -393,3 +398,10 @@ Route::rule('consultfeed','admin/Consult/feadback');
 Route::rule('consultfeadinfo','admin/Consult/feadinfo');
 Route::rule('consultbaradd','admin/Consult/bargain_add');
 
+Route::rule('supplercreate','admin/Suppler/create');
+Route::rule('supplerlist','admin/Suppler/list');
+Route::rule('suppleredit','admin/Suppler/edit');
+Route::rule('supplerinfo','admin/Suppler/info');
+Route::rule('supplerstatus','admin/Suppler/status');
+Route::rule('supplerdelete','admin/Suppler/del');
+