xialei 1 год назад
Родитель
Сommit
ed762c25bb
2 измененных файлов с 34 добавлено и 10 удалено
  1. 17 10
      app/controller/merchant/business/BusinessSchool.php
  2. 17 0
      route/admin.php

+ 17 - 10
app/controller/merchant/business/BusinessSchool.php

@@ -9,18 +9,21 @@ use think\facade\Route;
9
 class BusinessSchool  extends BaseController
9
 class BusinessSchool  extends BaseController
10
 {
10
 {
11
     public function classify_list(){
11
     public function classify_list(){
12
-        $list = Db::name("business_school_classify") ->where('mer_id',$this->request->merId())->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
12
+        // $list = Db::name("business_school_classify")->where('mer_id',$this->request->merId())->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
13
+        $list = Db::name("business_school_classify")->where('is_del',0)->order("sort desc,id desc")-> select() -> toArray();
13
         return app("json") -> success($list);
14
         return app("json") -> success($list);
14
     }
15
     }
15
 
16
 
16
     public function classify_del(){
17
     public function classify_del(){
17
         $id=$this->request->params(['id']);
18
         $id=$this->request->params(['id']);
18
-        $count=Db::name('business_school')->where('mer_id',$this->request->merId())->where('classify',$id['id'])->where('is_del',0)->count();
19
+        // $count=Db::name('business_school')->where('mer_id',$this->request->merId())->where('classify',$id['id'])->where('is_del',0)->count();
20
+        $count=Db::name('business_school')->where('classify',$id['id'])->where('is_del',0)->count();
19
         if($count){
21
         if($count){
20
             return app('json')->fail('该分类下有数据,不能直接删除~');
22
             return app('json')->fail('该分类下有数据,不能直接删除~');
21
         }
23
         }
22
 
24
 
23
-        Db::name('business_school_classify')->where('mer_id',$this->request->merId())->where('id',$id['id'])->update(['is_del'=>1]);
25
+        // Db::name('business_school_classify')->where('mer_id',$this->request->merId())->where('id',$id['id'])->update(['is_del'=>1]);
26
+        Db::name('business_school_classify')->where('id',$id['id'])->update(['is_del'=>1]);
24
         return app("json") -> success('删除成功');
27
         return app("json") -> success('删除成功');
25
     }
28
     }
26
     public function classify_add_form(){
29
     public function classify_add_form(){
@@ -89,7 +92,8 @@ class BusinessSchool  extends BaseController
89
 
92
 
90
 
93
 
91
     public function get_sort(){
94
     public function get_sort(){
92
-        $data=Db::name('business_school')->field('sort')->where('mer_id',$this->request->merId())->where('is_del',0)->order('sort desc,id desc')->find();
95
+        // $data=Db::name('business_school')->field('sort')->where('mer_id',$this->request->merId())->where('is_del',0)->order('sort desc,id desc')->find();
96
+        $data=Db::name('business_school')->field('sort')->where('is_del',0)->order('sort desc,id desc')->find();
93
         $sort=1;
97
         $sort=1;
94
         if($data){
98
         if($data){
95
             $sort=$data['sort']+1;
99
             $sort=$data['sort']+1;
@@ -102,7 +106,7 @@ class BusinessSchool  extends BaseController
102
         $query=Db::name('business_school')
106
         $query=Db::name('business_school')
103
             -> alias("sp")
107
             -> alias("sp")
104
             -> join("business_school_classify spc","sp.classify = spc.id","left")
108
             -> join("business_school_classify spc","sp.classify = spc.id","left")
105
-            ->where('spc.mer_id',$this->request->merId())
109
+            // ->where('spc.mer_id',$this->request->merId())
106
             ->where('sp.is_del',0)
110
             ->where('sp.is_del',0)
107
             -> when(isset($where['type']) && $where['type']!='',function ($query) use ($where){
111
             -> when(isset($where['type']) && $where['type']!='',function ($query) use ($where){
108
                 $query -> where("sp.type",$where['type']);
112
                 $query -> where("sp.type",$where['type']);
@@ -131,7 +135,8 @@ class BusinessSchool  extends BaseController
131
         if($id_str=='' || is_array($id_str)){
135
         if($id_str=='' || is_array($id_str)){
132
             return app("json") -> fail('请选择数据~');
136
             return app("json") -> fail('请选择数据~');
133
         }
137
         }
134
-        Db::name('business_school')->where('mer_id',$this->request->merId())->whereIn('id',explode(',',$id_str))->update(['is_del'=>1]);
138
+        // Db::name('business_school')->where('mer_id',$this->request->merId())->whereIn('id',explode(',',$id_str))->update(['is_del'=>1]);
139
+        Db::name('business_school')->whereIn('id',explode(',',$id_str))->update(['is_del'=>1]);
135
         return app("json") -> success('删除成功');
140
         return app("json") -> success('删除成功');
136
     }
141
     }
137
     public function get_one(){
142
     public function get_one(){
@@ -139,7 +144,8 @@ class BusinessSchool  extends BaseController
139
         if(empty($id['id'])){
144
         if(empty($id['id'])){
140
             return app('json')->fail('id不存在');
145
             return app('json')->fail('id不存在');
141
         }
146
         }
142
-        $data=Db::name('business_school') ->where('mer_id',$this->request->merId())->where('id',$id['id'])->find();
147
+        // $data=Db::name('business_school') ->where('mer_id',$this->request->merId())->where('id',$id['id'])->find();
148
+        $data=Db::name('business_school')->where('id',$id['id'])->find();
143
         return app("json") -> success($data);
149
         return app("json") -> success($data);
144
     }
150
     }
145
 
151
 
@@ -184,9 +190,9 @@ class BusinessSchool  extends BaseController
184
         $ids=explode(',',$id_str);
190
         $ids=explode(',',$id_str);
185
 
191
 
186
         Db::name('business_school')
192
         Db::name('business_school')
187
-            ->where('mer_id',$this->request->merId())
193
+            // ->where('mer_id',$this->request->merId())
188
             ->whereIn('id',$ids)
194
             ->whereIn('id',$ids)
189
-            ->update(['state'=>$state==1?1:0]);
195
+            ->update(['state'=>$state==1?0:1]);
190
         return app("json") -> success('操作成功');
196
         return app("json") -> success('操作成功');
191
     }
197
     }
192
 
198
 
@@ -205,7 +211,8 @@ class BusinessSchool  extends BaseController
205
         if ($id == 0 ){
211
         if ($id == 0 ){
206
             $res = Db::name("business_school_classify") -> insert($data);
212
             $res = Db::name("business_school_classify") -> insert($data);
207
         }else{
213
         }else{
208
-            $res = Db::name("business_school_classify") ->where('mer_id',$this->request->merId()) -> where("id",$id) -> update($data);
214
+            // $res = Db::name("business_school_classify") ->where('mer_id',$this->request->merId()) -> where("id",$id) -> update($data);
215
+            $res = Db::name("business_school_classify")->where("id",$id)->update($data);
209
             return app("json") -> success("成功");
216
             return app("json") -> success("成功");
210
         }
217
         }
211
         if ($res)return app("json") -> success("成功");
218
         if ($res)return app("json") -> success("成功");

+ 17 - 0
route/admin.php

@@ -920,6 +920,23 @@ Route::group(config('admin.api_admin_prefix') . '/', function () {
920
 
920
 
921
         });
921
         });
922
 
922
 
923
+        //商学院管理
924
+        Route::group('business_school', function () {
925
+
926
+            Route::post("classify_del","merchant.business.BusinessSchool/classify_del")->name('business_school_classify_del');//课程分类删除(假删除)
927
+            Route::post("classify_list","merchant.business.BusinessSchool/classify_list")->name('business_school_classify_list');//课程分类列表
928
+            Route::post("classify_add_form","merchant.business.BusinessSchool/classify_add_form")->name('business_school_classify_add_form');//分类新增  修改
929
+            Route::post("classify_save_form","merchant.business.BusinessSchool/classify_save_form")->name('business_school_classify_save_form');//分类新增  修改
930
+            Route::post("classify_save","merchant.business.BusinessSchool/classify_save")->name('business_school_classify_save');//分类新增/修改
931
+
932
+
933
+            Route::post("list","merchant.business.BusinessSchool/lst")->name('business_school_lst');//课程列表
934
+            Route::post("detail","merchant.business.BusinessSchool/get_one")->name('business_school_detail');//课程详情
935
+            Route::post("save","merchant.business.BusinessSchool/save")->name('business_school_save');;//新增  修改
936
+            Route::post("del","merchant.business.BusinessSchool/del")->name('business_school_del');//课程删除
937
+            Route::post("save_state","merchant.business.BusinessSchool/save_state")->name('business_school_save_state');//课程删除
938
+            Route::post("sort","merchant.business.BusinessSchool/get_sort")->name('business_school_get_sort');//课程删除
939
+        });
923
 
940
 
924
 
941
 
925
 
942