whitefang пре 1 година
родитељ
комит
a9bea88f0c

+ 108 - 0
app/adminapi/controller/platform_rule/PerformanceWorkerRulesController.php

@@ -0,0 +1,108 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+
+namespace app\adminapi\controller\platform_rule;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\platform_rule\PerformanceWorkerRulesLists;
+use app\adminapi\logic\platform_rule\PerformanceWorkerRulesLogic;
+use app\adminapi\validate\platform_rule\PerformanceWorkerRulesValidate;
+
+
+/**
+ * PerformanceWorkerRules控制器
+ * Class PerformanceWorkerRulesController
+ * @package app\adminapi\controller\platform_rule
+ */
+class PerformanceWorkerRulesController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function lists()
+    {
+        return $this->dataLists(new PerformanceWorkerRulesLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function add()
+    {
+        $params = (new PerformanceWorkerRulesValidate())->post()->goCheck('add');
+        $result = PerformanceWorkerRulesLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(PerformanceWorkerRulesLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function edit()
+    {
+        $params = (new PerformanceWorkerRulesValidate())->post()->goCheck('edit');
+        $result = PerformanceWorkerRulesLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(PerformanceWorkerRulesLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function delete()
+    {
+        $params = (new PerformanceWorkerRulesValidate())->post()->goCheck('delete');
+        PerformanceWorkerRulesLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function detail()
+    {
+        $params = (new PerformanceWorkerRulesValidate())->goCheck('detail');
+        $result = PerformanceWorkerRulesLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 81 - 0
app/adminapi/lists/platform_rule/PerformanceWorkerRulesLists.php

@@ -0,0 +1,81 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\lists\platform_rule;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\platform_rule\PerformanceWorkerRules;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * PerformanceWorkerRules列表
+ * Class PerformanceWorkerRulesLists
+ * @package app\adminapi\listsplatform_rule
+ */
+class PerformanceWorkerRulesLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['goods_category_ids', 'rate'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function lists(): array
+    {
+        return PerformanceWorkerRules::where($this->searchWhere)
+            ->field(['id', 'goods_category_ids', 'rate', 'create_time', 'update_time'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->each(function (&$item){
+                $item['goods_category_ids'] = explode(',',$item['goods_category_ids']);
+            })
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function count(): int
+    {
+        return PerformanceWorkerRules::where($this->searchWhere)->count();
+    }
+
+}

+ 110 - 0
app/adminapi/logic/platform_rule/PerformanceWorkerRulesLogic.php

@@ -0,0 +1,110 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\logic\platform_rule;
+
+
+use app\common\model\platform_rule\PerformanceWorkerRules;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * PerformanceWorkerRules逻辑
+ * Class PerformanceWorkerRulesLogic
+ * @package app\adminapi\logic\platform_rule
+ */
+class PerformanceWorkerRulesLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            PerformanceWorkerRules::create([
+                'goods_category_ids' => !empty($params['goods_category_ids'])?implode(',',$params['goods_category_ids']):'',
+                'rate' => $params['rate'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            PerformanceWorkerRules::where('id', $params['id'])->update([
+                'goods_category_ids' => !empty($params['goods_category_ids'])?implode(',',$params['goods_category_ids']):'',
+                'rate' => $params['rate'],
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public static function delete(array $params): bool
+    {
+        return PerformanceWorkerRules::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public static function detail($params): array
+    {
+        $result = PerformanceWorkerRules::findOrEmpty($params['id'])->toArray();
+        !empty($result) && $result['goods_category_ids'] = explode(',',$result['goods_category_ids']);
+        return $result;
+    }
+}

+ 98 - 0
app/adminapi/validate/platform_rule/PerformanceWorkerRulesValidate.php

@@ -0,0 +1,98 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\adminapi\validate\platform_rule;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * PerformanceWorkerRules验证器
+ * Class PerformanceWorkerRulesValidate
+ * @package app\adminapi\validate\platform_rule
+ */
+class PerformanceWorkerRulesValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'rate' => 'require',
+
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'rate' => '提成比例',
+
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return PerformanceWorkerRulesValidate
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['rate']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return PerformanceWorkerRulesValidate
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','rate']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return PerformanceWorkerRulesValidate
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return PerformanceWorkerRulesValidate
+     * @author likeadmin
+     * @date 2024/12/08 14:51
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 31 - 0
app/common/model/platform_rule/PerformanceWorkerRules.php

@@ -0,0 +1,31 @@
+<?php
+// +----------------------------------------------------------------------
+// | likeadmin快速开发前后端分离管理后台(PHP版)
+// +----------------------------------------------------------------------
+// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
+// | 开源版本可自由商用,可去除界面版权logo
+// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
+// | github下载:https://github.com/likeshop-github/likeadmin
+// | 访问官网:https://www.likeadmin.cn
+// | likeadmin团队 版权所有 拥有最终解释权
+// +----------------------------------------------------------------------
+// | author: likeadminTeam
+// +----------------------------------------------------------------------
+
+namespace app\common\model\platform_rule;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * PerformanceWorkerRules模型
+ * Class PerformanceWorkerRules
+ * @package app\common\model\platform_rule
+ */
+class PerformanceWorkerRules extends BaseModel
+{
+    
+    protected $name = 'performance_worker_rules';
+}

+ 2 - 0
app/workerapi/validate/RegisterValidate.php

@@ -26,6 +26,7 @@ class RegisterValidate extends BaseValidate
         //'maintain_exp_type' => 'require',
         //'maintain_exp_type' => 'require',
         'lon' => 'require',
         'lon' => 'require',
         'lat' => 'require',
         'lat' => 'require',
+        'address'=>'require',
     ];
     ];
 
 
     protected $message = [
     protected $message = [
@@ -41,5 +42,6 @@ class RegisterValidate extends BaseValidate
         //'maintain_exp_type.require' => '请输入维修经验',
         //'maintain_exp_type.require' => '请输入维修经验',
         'lon.require' => '请输入经度',
         'lon.require' => '请输入经度',
         'lat.require' => '请输入维度',
         'lat.require' => '请输入维度',
+        'address.require'=>'请输入详细地址',
     ];
     ];
 }
 }