Kaynağa Gözat

删除服务商

moonsflyer 8 ay önce
ebeveyn
işleme
6945c0825a

+ 10 - 42
app/adminapi/controller/agricultural_machinery/UserServiceController.php

@@ -94,85 +94,53 @@ class UserServiceController extends BaseAdminController
     }
 
 
-    /**
-     * @notes  编辑农耕分类
-     * @return \think\response\Json
-     * @author heshihu
-     * @date 2022/2/21 17:49
-     */
-    public function edit()
-    {
-        $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('edit');
-        $result = AgriculturalMachineryServiceCategoryLogic::edit($params);
-        if (true === $result) {
-            return $this->success('编辑成功', [], 1, 1);
-        }
-        return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
-    }
-
 
     /**
-     * @notes  删除农耕分类
+     * @notes  删除服务商
      * @return \think\response\Json
      * @author heshihu
      * @date 2022/2/21 17:52
      */
     public function delete()
     {
-        $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('delete');
-        AgriculturalMachineryServiceCategoryLogic::delete($params);
+        $params = (new UserServiceValidate())->post()->goCheck('delete');
+        UserServiceLogic::delete($params);
         return $this->success('删除成功', [], 1, 1);
     }
 
 
     /**
-     * @notes  农耕分类详情
+     * @notes  服务详情
      * @return \think\response\Json
      * @author heshihu
      * @date 2022/2/21 17:54
      */
     public function detail()
     {
-        $params = (new AgriculturalMachineryServiceCategoryValidate())->goCheck('detail');
-        $result = AgriculturalMachineryServiceCategoryLogic::detail($params);
+        $params = (new UserServiceValidate())->goCheck('detail');
+        $result = UserServiceLogic::detail($params);
         return $this->data($result);
     }
 
 
     /**
-     * @notes  更改农耕分类状态
+     * @notes  更改服务商状态
      * @return \think\response\Json
      * @author heshihu
      * @date 2022/2/21 10:15
      */
     public function updateStatus()
     {
-        $params = (new AgriculturalMachineryServiceCategoryValidate())->post()->goCheck('status');
-        $result = AgriculturalMachineryServiceCategoryLogic::updateStatus($params);
+        $params = (new UserServiceValidate())->post()->goCheck('status');
+        $result = UserServiceLogic::updateStatus($params);
         if (true === $result) {
             return $this->success('修改成功', [], 1, 1);
         }
-        return $this->fail(AgriculturalMachineryServiceCategoryLogic::getError());
+        return $this->fail(UserServiceLogic::getError());
     }
 
 
     /**
-     * @notes 获取有效农耕分类
-     * @return \think\response\Json
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\DbException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @author 段誉
-     * @date 2022/10/13 10:54
-     */
-    public function getValidCate()
-    {
-        $params = (new AgriculturalMachineryServiceCategoryValidate())->get()->goCheck('list');
-        $result = AgriculturalMachineryServiceCategoryLogic::getValidCateData($params);
-        return $this->data($result);
-    }
-
-    /**
      * @notes 获取会员列表
      * @return \think\response\Json
      * @throws \think\db\exception\DataNotFoundException

+ 5 - 29
app/adminapi/logic/agricultural_machinery/UserServiceLogic.php

@@ -116,30 +116,6 @@ class UserServiceLogic extends BaseLogic
 
 
     /**
-     * @notes  编辑农耕分类
-     * @param array $params
-     * @return bool
-     * @author heshihu
-     * @date 2022/2/21 17:50
-     */
-    public static function edit(array $params) : bool
-    {
-        try {
-            AgriculturalMachineryServiceCategory::update([
-                'id' => $params['id'],
-                'name' => $params['name'],
-                'status' => $params['status'] ?? 1,
-                'sort' => $params['sort'] ?? 0
-            ]);
-            return true;
-        } catch (\Exception $e) {
-            self::setError($e->getMessage());
-            return false;
-        }
-    }
-
-
-    /**
      * @notes  删除农耕分类
      * @param array $params
      * @author heshihu
@@ -147,11 +123,11 @@ class UserServiceLogic extends BaseLogic
      */
     public static function delete(array $params)
     {
-        AgriculturalMachineryServiceCategory::destroy($params['id']);
+        UserService::destroy($params['id']);
     }
 
     /**
-     * @notes  查看农耕分类详情
+     * @notes  查看服务商详情
      * @param $params
      * @return array
      * @author heshihu
@@ -159,11 +135,11 @@ class UserServiceLogic extends BaseLogic
      */
     public static function detail($params) : array
     {
-        return AgriculturalMachineryServiceCategory::findOrEmpty($params['id'])->toArray();
+        return UserService::findOrEmpty($params['id'])->toArray();
     }
 
     /**
-     * @notes  更改农耕分类状态
+     * @notes  更改服务商状态
      * @param array $params
      * @return bool
      * @author heshihu
@@ -171,7 +147,7 @@ class UserServiceLogic extends BaseLogic
      */
     public static function updateStatus(array $params)
     {
-        AgriculturalMachineryServiceCategory::update([
+        UserService::update([
             'id' => $params['id'],
             'status' => $params['status']
         ]);

+ 1 - 1
app/adminapi/validate/agricultural_machinery/UserServiceValidate.php

@@ -135,7 +135,7 @@ class UserServiceValidate extends BaseValidate
     public function sceneDelete()
     {
         return $this->only(['id'])
-            ->append('id', 'checkDeleteArticleCate');
+            ->append('id', 'checkUserServiceInfo');
     }
     /**
      * @notes 场景相关校验