panlumeng 3 лет назад
Родитель
Сommit
68bbbc0746

+ 56 - 0
app/admin/controller/Attr.php

@@ -92,4 +92,60 @@ class Attr extends BaseController
         $update = Db::name("customer_attr")->save($info);
         return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
     }
+    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('customer_attr')->where(['id'=>$id,"is_del"=>0])->find();
+        if($info==""){
+            return error_show(1002,"未找到数据");
+        }
+        $name = isset($this->post['name']) && $this->post['name'] !==""? trim($this->post['name']):"";
+        if($name==""){
+            return error_show(1002,"参数name不能为空");
+        }
+        $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'] : "";
+        $status = isset($this->post['status']) && $this->post['status'] !==""? intval($this->post['status']):"0";
+        $data=[
+            "id"=>$id,
+            "createrid"=>$createrid,
+            "creater"=>$creater,
+            "name"=>$name,
+            "status"=>$status,
+            "is_del"=>0,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $datainfo=Db::name("customer_attr")->save($data);
+        if($datainfo){
+            return error_show(0,"更新成功");
+        }else{
+            return error_show(1002,"更新失败");
+        }
+    }
+    public function del(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id===""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $str= Db::name('customer_attr')->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]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
 }

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

@@ -82,4 +82,82 @@ class Brand extends BaseController
         $list = Db::name('brand')->where($where)->page($page,$size)->order("addtime desc")->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('brand')->where(['id'=>$id,"is_del"=>0])->find();
+        if($info==""){
+            return error_show(1003,"未找到数据");
+        }
+        $brand_name=isset( $this->post['brand_name']) && $this->post['brand_name'] !=="" ? trim($this->post['brand_name']):"";
+        if($brand_name==""){
+            return error_show(1002,"参数brand_name不能为空");
+        }
+        $logo_url= isset($this->post['logo_url'])  && $this->post['logo_url'] !=="" ? trim($this->post['logo_url']):"";
+        $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'] : "";
+        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
+
+        $data=[
+            "id"=>$id,
+            "brand_name"=>$brand_name,
+            "logo_url"=>$logo_url,
+            "createrid"=>$createrid,
+            "creater"=>$creater,
+            "status"=>$status,
+            "is_del"=>0,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $item = Db::name("brand")->save($data);
+        return $item? error_show(0,"更新成功"):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("brand")->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")->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')->where(['id'=>$id,'is_del'=>0])->find();
+        if(empty($str)){
+            return error_show(1002,"未找到数据");
+        }
+        $end = Db::name('brand')->update(['id'=>$id,'is_del'=>1]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
 }

+ 60 - 0
app/admin/controller/Catdesc.php

@@ -107,4 +107,64 @@ class Catdesc extends BaseController
         $update = Db::name("cat_desc")->save($info);
         return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
     }
+    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("cat_desc")->where(['id'=>$id,"is_del"=>0])->find();
+        if($info==""){
+            return error_show(1002,"未找到数据");
+        }
+        $cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] !==""? intval($this->post['cat_id']):"";
+        if($cat_id===""){
+            return error_show(1002,"参数cat_id不能为空");
+        }
+        $desc = isset($this->post['desc']) && $this->post['desc'] !==""? trim($this->post['desc']):"";
+        if($desc==""){
+            return error_show(1002,"参数desc不能为空");
+        }
+        $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'] : "";
+        $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
+        $data =[
+            "id"=>$id,
+            "cat_id"=>$cat_id,
+            "desc"=>$desc,
+            "status"=>$status,
+            "createrid"=>$createrid,
+            "creater"=>$creater,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $datatinfo = Db::name("cat_desc")->save($data);
+        if($datatinfo){
+            return error_show(0,"更新成功");
+        }else{
+            return error_show(1002,"更新失败");
+        }
+    }
+    public function del(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id===""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $str= Db::name('cat_desc')->where(['id'=>$id,'is_del'=>0])->find();
+        if(empty($str)){
+            return error_show(1002,"未找到数据");
+        }
+        $end = Db::name('cat_desc')->update(['id'=>$id,'is_del'=>1]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
 }

+ 16 - 0
app/admin/controller/Customar.php

@@ -291,4 +291,20 @@ class Customar extends BaseController
         }
         return app_show(0, "获取成功", $idinfo);
     }
+    public function del(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id===""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $str= Db::name('customer_attr')->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]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
 }

+ 44 - 0
app/admin/controller/Goldprice.php

@@ -122,4 +122,48 @@ class Goldprice extends BaseController
         $update = Db::name("gold_price1")->save($info);
         return  $update? error_show(0,"{$msg}成功"):error_show(1004,"{$msg}失败");
     }
+    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("gold_price1")->where(['id'=>$id,"is_del"=>0])->find();
+        if($info==""){
+            return error_show(1003,"未找到数据");
+        }
+        $type = isset($this->post['type']) && $this->post['type'] !=="" ?trim($this->post['type']):"";
+        if($type==""){
+            return error_show(1002,"参数type不能为空");
+        }
+        $price = isset($this->post['price']) && $this->post['price'] !=="" ? intval($this->post['price']):"";
+        if($price==""){
+            return error_show(1002,"参数price不能为空");
+        }
+        $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,"创建人数据不存在");
+        }
+        $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";
+        $data=[
+            "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")
+        ];
+        $datainfo= Db::name("gold_price1")->save($data);
+        if($datainfo){
+            return error_show(0,"更新成功");
+        }else{
+            return error_show(1002,"更新失败");
+        }
+    }
 }

+ 47 - 0
app/admin/controller/Goodup.php

@@ -0,0 +1,47 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Goodup extends BaseController
+{
+    public $post="";
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post=$this->request->post();
+    }
+    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 =[["is_del","=",0]];
+        $cat_id = isset($this->post['cat_id']) && $this->post['cat_id'] !=="" ? trim($this->post['cat_id']):"";
+        if($cat_id!==""){
+            $where[]=['cat_id',"=",$cat_id];
+        }
+        $good_name = isset($this->post['good_name']) && $this->post['good_name'] !=="" ? trim($this->post['good_name']):"";
+        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];
+         }
+        $start = isset($this->post['start']) && $this->post['start']!=="" ? $this->post['start']:"";
+        if($start!==""){
+            $where[]=['addtime',">=",date('Y-m-d H:i:s',strtotime($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)];
+        }
+        $count = Db::name('good')->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('good')->where($where)->page($page,$size)->order("addtime desc")->select();
+        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+    }
+}

+ 59 - 1
app/admin/controller/Specs.php

@@ -6,7 +6,7 @@ use app\BaseController;
 use think\App;
 use think\facade\Db;
 
-class specs extends BaseController
+class Specs extends BaseController
 {
     public $post="";
     public function __construct(App $app)
@@ -125,4 +125,62 @@ class specs extends BaseController
         $list = Db::name('specs')->where($where)->order("addtime desc")->select();
         return app_show(0,"获取成功",$list);
     }
+    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("specs")->where(['id'=>$id,"is_del"=>0])->find();
+        if($info==""){
+            return error_show(1002,"未找到数据");
+        }
+        $spec_name = isset($this->post['spec_name']) && $this->post['spec_name'] !==""? trim($this->post['spec_name']):"";
+        if($spec_name==""){
+            return error_show(1002,"参数spec_name不能为空");
+        }
+        $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'] : "";
+        $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";
+        $data = [
+            "id"=>$id,
+            "spec_name"=>$spec_name,
+            "creater"=>$creater,
+            "createrid"=>$createrid,
+            "exam_status"=>$exam_status,
+            "status"=>$status,
+            "is_del"=>0,
+            "updatetime"=>date("Y-m-d H:i:s")
+        ];
+        $datainfo=Db::name('specs')->save($data);
+        if($datainfo){
+            return error_show(0,"更新成功");
+        }else{
+            return error_show(1002,"更新失败");
+        }
+    }
+    public function del(){
+        $id = $this->post['id'] && $this->post['id'] !=="" ? intval($this->post['id']) :"";
+        if($id===""){
+            return  error_show(1004,"参数id不能为空");
+        }
+        $str= Db::name('specs')->where(['id'=>$id,'is_del'=>0])->find();
+        if(empty($str)){
+            return error_show(1002,"未找到数据");
+        }
+        $end = Db::name('specs')->update(['id'=>$id,'is_del'=>1]);
+        if($end){
+            return error_show(0,"删除成功");
+        }else{
+            return error_show(1002,"删除失败");
+        }
+    }
 }

+ 27 - 0
app/admin/controller/Specvalue.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\BaseController;
+use think\App;
+use think\facade\Db;
+
+class Specvalue extends BaseController
+{
+    public $post="";
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post=$this->request->post();
+    }
+    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 = [['is_del','=',0]];
+        $count = Db::name('spec_value')->where($where)->count();
+        $total = ceil($count / $size);
+        $page = $page >= $total ? $total : $page;
+        $list = Db::name('spec_value')->where($where)->page($page,$size)->order("addtime desc")->select();
+        return app_show(0,"获取成功",['list'=>$list,'count'=>$count]);
+    }
+}

+ 11 - 2
app/admin/route/app.php

@@ -276,21 +276,29 @@ Route::rule('msglimitread','admin/Log/limit');
 Route::rule('attrcreate','admin/Attr/create');
 Route::rule('attrlist','admin/Attr/list');
 Route::rule('attrstatus','admin/Attr/status');
+Route::rule('attredit','admin/Attr/edit');
+Route::rule('attrdelete','admin/Attr/del');
+
 
 Route::rule('specscreate','admin/Specs/create');
 Route::rule('specslist','admin/Specs/list');
 Route::rule('specsstatus','admin/Specs/status');
 Route::rule('specstitle','admin/Specs/title');
+Route::rule('specsedit','admin/Specs/edit');
+Route::rule('specsdelete','admin/Specs/del');
+
 
 Route::rule('brandcreate','admin/Brand/create');
 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('desccreate','admin/Catdesc/create');
 Route::rule('desclist','admin/Catdesc/list');
 Route::rule('descstatus','admin/Catdesc/status');
+Route::rule('descedit','admin/Catdesc/edit');
+Route::rule('descdelete','admin/Catdesc/del');
 
 Route::rule('goldpricecreate','admin/Goldprice/create');
 Route::rule('goldpricelist','admin/Goldprice/list');
@@ -301,6 +309,7 @@ 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('businesscreate','admin/Business/create');
 Route::rule('businesslist','admin/Business/list');
@@ -310,4 +319,4 @@ Route::rule('businessstatus','admin/Business/status');
 Route::rule('businesssinfo','admin/Business/info');
 Route::rule('businesstitle','admin/Business/title');
 
-
+Route::rule('gooduplist','admin/Goodup/list');