Răsfoiți Sursa

增加消息,我的,意见反馈,绑定银行卡,平台规则等接口及页面功能

林海涛 1 an în urmă
părinte
comite
143a37e3bd
27 a modificat fișierele cu 1296 adăugiri și 4 ștergeri
  1. 109 0
      app/adminapi/controller/feedback/FeedbackController.php
  2. 108 0
      app/adminapi/controller/platform_rule/PlatformRuleController.php
  3. 90 0
      app/adminapi/lists/feedback/FeedbackLists.php
  4. 78 0
      app/adminapi/lists/platform_rule/PlatformRuleLists.php
  5. 111 0
      app/adminapi/logic/feedback/FeedbackLogic.php
  6. 1 1
      app/adminapi/logic/goods/GoodsLogic.php
  7. 110 0
      app/adminapi/logic/platform_rule/PlatformRuleLogic.php
  8. 102 0
      app/adminapi/validate/feedback/FeedbackValidate.php
  9. 96 0
      app/adminapi/validate/platform_rule/PlatformRuleValidate.php
  10. 12 0
      app/common/model/bank_account/BankAccount.php
  11. 1 1
      app/common/model/dict/DictType.php
  12. 46 0
      app/common/model/feedback/Feedback.php
  13. 18 0
      app/common/model/master_worker_message/MasterWorkerMessage.php
  14. 34 0
      app/common/model/platform_rule/PlatformRule.php
  15. 19 0
      app/workerapi/controller/FeedbackController.php
  16. 25 1
      app/workerapi/controller/MasterWorkerController.php
  17. 43 0
      app/workerapi/controller/MasterWorkerMessageController.php
  18. 14 0
      app/workerapi/controller/PlatformRuleController.php
  19. 25 0
      app/workerapi/lists/BaseWorkerDataLists.php
  20. 37 0
      app/workerapi/lists/MasterWorkerMessageLists.php
  21. 40 0
      app/workerapi/lists/PlatformRuleLists.php
  22. 27 0
      app/workerapi/logic/FeedbackLogic.php
  23. 34 1
      app/workerapi/logic/MasterWorkerInfoLogic.php
  24. 8 0
      app/workerapi/logic/MasterWorkerLogic.php
  25. 54 0
      app/workerapi/logic/MasterWorkerMessageLogic.php
  26. 31 0
      app/workerapi/validate/BankAccountValidate.php
  27. 23 0
      app/workerapi/validate/FeedbackValidate.php

+ 109 - 0
app/adminapi/controller/feedback/FeedbackController.php

@@ -0,0 +1,109 @@
+<?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\feedback;
+
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\feedback\FeedbackLists;
+use app\adminapi\logic\feedback\FeedbackLogic;
+use app\adminapi\validate\feedback\FeedbackValidate;
+
+
+/**
+ * Feedback控制器
+ * Class FeedbackController
+ * @package app\adminapi\controller\feedback
+ */
+class FeedbackController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function lists()
+    {
+        return $this->dataLists(new FeedbackLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function add()
+    {
+        $params = (new FeedbackValidate())->post()->goCheck('add');
+        $result = FeedbackLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(FeedbackLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function edit()
+    {
+        $params = (new FeedbackValidate())->post()->goCheck('edit');
+        $params['deal_user_id'] = $this->adminId;
+        $result = FeedbackLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(FeedbackLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function delete()
+    {
+        $params = (new FeedbackValidate())->post()->goCheck('delete');
+        FeedbackLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function detail()
+    {
+        $params = (new FeedbackValidate())->goCheck('detail');
+        $result = FeedbackLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 108 - 0
app/adminapi/controller/platform_rule/PlatformRuleController.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\PlatformRuleLists;
+use app\adminapi\logic\platform_rule\PlatformRuleLogic;
+use app\adminapi\validate\platform_rule\PlatformRuleValidate;
+
+
+/**
+ * PlatformRule控制器
+ * Class PlatformRuleController
+ * @package app\adminapi\controller\platform_rule
+ */
+class PlatformRuleController extends BaseAdminController
+{
+
+
+    /**
+     * @notes 获取列表
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function lists()
+    {
+        return $this->dataLists(new PlatformRuleLists());
+    }
+
+
+    /**
+     * @notes 添加
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function add()
+    {
+        $params = (new PlatformRuleValidate())->post()->goCheck('add');
+        $result = PlatformRuleLogic::add($params);
+        if (true === $result) {
+            return $this->success('添加成功', [], 1, 1);
+        }
+        return $this->fail(PlatformRuleLogic::getError());
+    }
+
+
+    /**
+     * @notes 编辑
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function edit()
+    {
+        $params = (new PlatformRuleValidate())->post()->goCheck('edit');
+        $result = PlatformRuleLogic::edit($params);
+        if (true === $result) {
+            return $this->success('编辑成功', [], 1, 1);
+        }
+        return $this->fail(PlatformRuleLogic::getError());
+    }
+
+
+    /**
+     * @notes 删除
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function delete()
+    {
+        $params = (new PlatformRuleValidate())->post()->goCheck('delete');
+        PlatformRuleLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @return \think\response\Json
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function detail()
+    {
+        $params = (new PlatformRuleValidate())->goCheck('detail');
+        $result = PlatformRuleLogic::detail($params);
+        return $this->data($result);
+    }
+
+
+}

+ 90 - 0
app/adminapi/lists/feedback/FeedbackLists.php

@@ -0,0 +1,90 @@
+<?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\feedback;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\feedback\Feedback;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * Feedback列表
+ * Class FeedbackLists
+ * @package app\adminapi\listsfeedback
+ */
+class FeedbackLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => [ 'feedback_type',  'status', 'create_time', 'update_time'],
+
+        ];
+    }
+    public function queryWhere(){
+        $where = [];
+        // 用户
+        if (isset($this->params['user_id']) && is_array($this->params['user_id'])) {
+            $where[] = ['user_id', 'in',$this->params['user_id']];
+        }
+        if (isset($this->params['deal_user_id']) && is_array($this->params['deal_user_id'])) {
+            $where[] = ['deal_user_id', 'in',$this->params['deal_user_id']];
+        }
+        return $where;
+    }
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function lists(): array
+    {
+        return Feedback::with(['masterWorker','admin'])
+            ->where($this->searchWhere)
+            ->where($this->queryWhere())
+            ->field(['id', 'user_id', 'feedback_type', 'description', 'pictures', 'status','deal_user_id','remark'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function count(): int
+    {
+        return Feedback::where($this->searchWhere)->where($this->queryWhere())->count();
+    }
+
+}

+ 78 - 0
app/adminapi/lists/platform_rule/PlatformRuleLists.php

@@ -0,0 +1,78 @@
+<?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\PlatformRule;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * PlatformRule列表
+ * Class PlatformRuleLists
+ * @package app\adminapi\listsplatform_rule
+ */
+class PlatformRuleLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function setSearch(): array
+    {
+        return [
+            '%like%' => ['rule_name'],
+
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function lists(): array
+    {
+        return PlatformRule::where($this->searchWhere)
+            ->field(['id', 'rule_name', 'description'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['sort'=>'desc', 'id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function count(): int
+    {
+        return PlatformRule::where($this->searchWhere)->count();
+    }
+
+}

+ 111 - 0
app/adminapi/logic/feedback/FeedbackLogic.php

@@ -0,0 +1,111 @@
+<?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\feedback;
+
+
+use app\common\model\feedback\Feedback;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * Feedback逻辑
+ * Class FeedbackLogic
+ * @package app\adminapi\logic\feedback
+ */
+class FeedbackLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            Feedback::create([
+                'user_id' => $params['user_id'],
+                'feedback_type' => $params['feedback_type'],
+                'description' => $params['description'],
+                'pictures' => $params['pictures'],
+                'status' => $params['status'],
+            ]);
+
+            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/07/11 14:47
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            Feedback::where('id', $params['id'])->update([
+                'status' => $params['status'],
+                'remark' => $params['remark'],
+                'deal_user_id' => $params['deal_user_id'],
+            ]);
+            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/07/11 14:47
+     */
+    public static function delete(array $params): bool
+    {
+        return Feedback::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public static function detail($params): array
+    {
+        return Feedback::with('masterWorker')->findOrEmpty($params['id'])->toArray();
+    }
+}

+ 1 - 1
app/adminapi/logic/goods/GoodsLogic.php

@@ -42,7 +42,7 @@ class GoodsLogic extends BaseLogic
         try {
             $params['goods_category_id'] = end($params['goods_category_ids']);
             Goods::create([
-                'goods_category_ids' => json_encode($params['goods_category_ids'],true),
+                'goods_category_ids' => $params['goods_category_ids'],
                 'goods_category_id' => $params['goods_category_id'],
                 'goods_name' => $params['goods_name'],
                 'goods_image' => $params['goods_image'],

+ 110 - 0
app/adminapi/logic/platform_rule/PlatformRuleLogic.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\PlatformRule;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * PlatformRule逻辑
+ * Class PlatformRuleLogic
+ * @package app\adminapi\logic\platform_rule
+ */
+class PlatformRuleLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            PlatformRule::create([
+                'rule_name' => $params['rule_name'],
+                'description' => $params['description'],
+                'sort' => $params['sort']
+            ]);
+
+            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/07/11 11:41
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            PlatformRule::where('id', $params['id'])->update([
+                'rule_name' => $params['rule_name'],
+                'description' => $params['description'],
+                'sort' => $params['sort']
+            ]);
+
+            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/07/11 11:41
+     */
+    public static function delete(array $params): bool
+    {
+        return PlatformRule::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public static function detail($params): array
+    {
+        return PlatformRule::findOrEmpty($params['id'])->toArray();
+    }
+}

+ 102 - 0
app/adminapi/validate/feedback/FeedbackValidate.php

@@ -0,0 +1,102 @@
+<?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\feedback;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * Feedback验证器
+ * Class FeedbackValidate
+ * @package app\adminapi\validate\feedback
+ */
+class FeedbackValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'user_id' => 'require',
+        'feedback_type' => 'require',
+        'description' => 'require',
+        'status' => 'require',

+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'user_id' => '用户ID',
+        'feedback_type' => '反馈类型',
+        'description' => '详细说明',
+        'status' => '状态',

+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return FeedbackValidate
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['user_id','feedback_type','description','status']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return FeedbackValidate
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','user_id','feedback_type','description','status']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return FeedbackValidate
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return FeedbackValidate
+     * @author likeadmin
+     * @date 2024/07/11 14:47
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 96 - 0
app/adminapi/validate/platform_rule/PlatformRuleValidate.php

@@ -0,0 +1,96 @@
+<?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;
+
+
+/**
+ * PlatformRule验证器
+ * Class PlatformRuleValidate
+ * @package app\adminapi\validate\platform_rule
+ */
+class PlatformRuleValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'rule_name' => 'require',

+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'rule_name' => '规则名称',

+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return PlatformRuleValidate
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['rule_name']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return PlatformRuleValidate
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','rule_name']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return PlatformRuleValidate
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return PlatformRuleValidate
+     * @author likeadmin
+     * @date 2024/07/11 11:41
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 12 - 0
app/common/model/bank_account/BankAccount.php

@@ -0,0 +1,12 @@
+<?php
+namespace app\common\model\bank_account;
+use app\common\model\BaseModel;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午4:43
+ */
+class BankAccount extends BaseModel
+{
+    protected $name = 'bank_account';
+}

+ 1 - 1
app/common/model/dict/DictType.php

@@ -45,6 +45,6 @@ class DictType extends BaseModel
     }
     public function dictData()
     {
-        return $this->hasMany(DictData::class,'type_id','id')->where('status',1)->order('sort','desc')->field('id,type_id,name');
+        return $this->hasMany(DictData::class,'type_id','id')->where('status',1)->order('sort','desc')->field('id,value,name');
     }
 }

+ 46 - 0
app/common/model/feedback/Feedback.php

@@ -0,0 +1,46 @@
+<?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\feedback;
+
+
+use app\common\model\auth\Admin;
+use app\common\model\BaseModel;
+use app\common\model\master_worker\MasterWorker;
+
+
+/**
+ * Feedback模型
+ * Class Feedback
+ * @package app\common\model\feedback
+ */
+class Feedback extends BaseModel
+{
+    
+    protected $name = 'feedback';
+    protected $type = [
+        'pictures' =>  'array',
+    ];
+
+    public function masterWorker()
+    {
+        return $this->hasOne(MasterWorker::class, 'id', 'user_id')
+            ->field('id,nickname');
+    }
+    public function admin()
+    {
+        return $this->hasOne(Admin::class,'id','deal_user_id')->field('id,name');;
+    }
+
+}

+ 18 - 0
app/common/model/master_worker_message/MasterWorkerMessage.php

@@ -0,0 +1,18 @@
+<?php
+namespace app\common\model\master_worker_message;
+use app\common\model\BaseModel;
+use app\common\model\master_worker\MasterWorker;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午5:28
+ */
+class MasterWorkerMessage extends BaseModel
+{
+    protected $name = 'master_worker_message';
+
+    public function masterWorker()
+    {
+        return $this->hasOne(MasterWorker::class,'id','user_id')->field('id,nickname');
+    }
+}

+ 34 - 0
app/common/model/platform_rule/PlatformRule.php

@@ -0,0 +1,34 @@
+<?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;
+
+
+
+/**
+ * PlatformRule模型
+ * Class PlatformRule
+ * @package app\common\model\platform_rule
+ */
+class PlatformRule extends BaseModel
+{
+    
+    protected $name = 'platform_rule';
+    
+
+    
+}

+ 19 - 0
app/workerapi/controller/FeedbackController.php

@@ -0,0 +1,19 @@
+<?php
+
+namespace app\workerapi\controller;
+
+use app\workerapi\logic\FeedbackLogic;
+use app\workerapi\validate\FeedbackValidate;
+
+class FeedbackController extends BaseApiController
+{
+    public function addFeedback()
+    {
+        $params =  (new FeedbackValidate())->post()->goCheck('addFeedback');
+        $result = FeedbackLogic::addFeedback($params, $this->userId);
+        if (true === $result) {
+            return $this->success('操作成功', [], 1, 1);
+        }
+        return $this->fail(FeedbackLogic::getError());
+    }
+}

+ 25 - 1
app/workerapi/controller/MasterWokerController.php → app/workerapi/controller/MasterWorkerController.php

@@ -5,10 +5,11 @@ namespace app\workerapi\controller;
 use app\workerapi\logic\LoginLogic;
 use app\workerapi\logic\MasterWorkerInfoLogic;
 use app\workerapi\logic\MasterWorkerLogic;
+use app\workerapi\validate\BankAccountValidate;
 use app\workerapi\validate\MasterWokerInfoValidate;
 use app\workerapi\validate\MasterWokerValidate;
 
-class MasterWokerController extends BaseApiController
+class MasterWorkerController extends BaseApiController
 {
 
     /**
@@ -75,4 +76,27 @@ class MasterWokerController extends BaseApiController
         }
         return $this->fail(MasterWorkerInfoLogic::getError());
     }
+
+    /**
+     * 绑定银行卡
+     * @return \think\response\Json
+     * @author 林海涛
+     * @date 2024/7/11 下午4:27
+     */
+    public function bindBankAccount()
+    {
+        $params =  (new BankAccountValidate())->post()->goCheck('bindBankAccount');
+        $result = MasterWorkerInfoLogic::bindBankAccount($params, $this->userId);
+        if (true === $result) {
+            return $this->success('操作成功', [], 1, 1);
+        }
+        return $this->fail(MasterWorkerInfoLogic::getError());
+    }
+
+    public function myInfo()
+    {
+        $result = MasterWorkerLogic::detail($this->userId);
+        return $this->data($result);
+    }
+
 }

+ 43 - 0
app/workerapi/controller/MasterWorkerMessageController.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace app\workerapi\controller;
+
+use app\workerapi\lists\MasterWorkerMessageLists;
+use app\workerapi\logic\MasterWorkerMessageLogic;
+
+class MasterWorkerMessageController extends BaseApiController
+{
+    /**
+     * 统计师傅未读消息数量
+     * @return \think\response\Json
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author 林海涛
+     * @date 2024/7/11 下午6:28
+     */
+    public function msgStatistics()
+    {
+       $data = MasterWorkerMessageLogic::msgStatistics($this->userId);
+       return $this->success('操作成功', $data, 1, 1);
+
+    }
+
+    public function lists()
+    {
+
+        return $this->dataLists(new MasterWorkerMessageLists());
+    }
+
+    public function showMsg()
+    {
+        $validate = \think\facade\Validate::rule([
+                'ids'  => 'require|array',
+            ]);
+        if (!$validate->check(request()->all())) {
+            return $this->fail($validate->getError());
+        }
+        MasterWorkerMessageLogic::showMsg(request()->all(),$this->userId);
+        return $this->success('操作成功', [], 1, 1);
+    }
+}

+ 14 - 0
app/workerapi/controller/PlatformRuleController.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace app\workerapi\controller;
+
+use app\workerapi\lists\PlatformRuleLists;
+
+class PlatformRuleController extends BaseApiController
+{
+     public function lists()
+     {
+
+         return $this->dataLists(new PlatformRuleLists());
+     }
+}

+ 25 - 0
app/workerapi/lists/BaseWorkerDataLists.php

@@ -0,0 +1,25 @@
+<?php
+namespace app\workerapi\lists;
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午1:41
+ */
+use app\common\lists\BaseDataLists;
+abstract  class BaseWorkerDataLists extends BaseDataLists
+{
+    protected array $userInfo = [];
+    protected int $userId = 0;
+
+    public string $export;
+
+    public function __construct()
+    {
+        parent::__construct();
+        if (isset($this->request->userInfo) && $this->request->userInfo) {
+            $this->userInfo = $this->request->userInfo;
+            $this->userId = $this->request->userId;
+        }
+        $this->export = $this->request->get('export', '');
+    }
+
+}

+ 37 - 0
app/workerapi/lists/MasterWorkerMessageLists.php

@@ -0,0 +1,37 @@
+<?php
+namespace app\workerapi\lists;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\master_worker_message\MasterWorkerMessage;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午6:21
+ */
+class MasterWorkerMessageLists extends BaseWorkerDataLists  implements ListsSearchInterface
+{
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['msg_type'],
+        ];
+    }
+    public function queryWhere()
+    {
+        $where = [];
+        $where[] = ['user_id', '=', $this->userId];
+        return $where;
+    }
+    public function lists():array
+    {
+        return MasterWorkerMessage::where($this->searchWhere)
+            ->where($this->queryWhere())
+            ->field(['id', 'title','describe','create_time','update_time'])
+            ->order(['id' => 'asc'])
+            ->select()
+            ->toArray();
+    }
+    public function count(): int
+    {
+        return MasterWorkerMessage::where($this->searchWhere)->where($this->queryWhere())->count();
+    }
+}

+ 40 - 0
app/workerapi/lists/PlatformRuleLists.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午1:40
+ */
+namespace app\workerapi\lists;
+use app\common\enum\YesNoEnum;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\platform_rule\PlatformRule;
+
+
+class PlatformRuleLists extends BaseWorkerDataLists implements ListsSearchInterface
+{
+    /**
+     * 设置搜索条件
+     * @return array[]
+     * @author 林海涛
+     * @date 2024/7/11 下午1:46
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['rule_name'],
+        ];
+    }
+
+    public function lists():array
+    {
+       $data = PlatformRule::where($this->searchWhere)
+            ->field(['id', 'rule_name','description', 'sort'])
+            ->order(['sort' => 'desc','id' => 'desc'])
+            ->select()
+            ->toArray();
+       return $data;
+    }
+    public function count(): int
+    {
+        return PlatformRule::where($this->searchWhere)->count();
+    }
+}

+ 27 - 0
app/workerapi/logic/FeedbackLogic.php

@@ -0,0 +1,27 @@
+<?php
+namespace app\workerapi\logic;
+use app\common\logic\BaseLogic;
+use app\common\model\feedback\Feedback;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午2:41
+ */
+class FeedbackLogic extends BaseLogic
+{
+    public static function addFeedback($params, $userId)
+    {
+        try {
+            FeedBack::create([
+                'user_id' => $userId,
+                'feedback_type' => $params['feedback_type'],
+                'description' => $params['description'],
+                'pictures' => $params['pictures'] ?? null,
+            ]);
+            return true;
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+}

+ 34 - 1
app/workerapi/logic/MasterWorkerInfoLogic.php

@@ -1,6 +1,7 @@
 <?php
 namespace app\workerapi\logic;
 use app\common\logic\BaseLogic;
+use app\common\model\bank_account\BankAccount;
 use app\common\model\master_worker\MasterWorkerInfo;
 
 /**
@@ -16,7 +17,7 @@ class MasterWorkerInfoLogic extends BaseLogic
         try{
             $where = [['user_id', '=', $userId]];
             $userInfo = MasterWorkerInfo::where($where)->findOrEmpty();
-            if (!$userInfo->isEmpty()) {
+            if ($userInfo->isEmpty()) {
                 $userInfo = new MasterWorkerInfo();
                 $userInfo->user_id = $userId;
             }
@@ -31,4 +32,36 @@ class MasterWorkerInfoLogic extends BaseLogic
             return false;
         }
     }
+
+    /**
+     * 绑定银行卡
+     * @param $params
+     * @param $userId
+     * @return bool
+     * @author 林海涛
+     * @date 2024/7/11 下午4:41
+     */
+    public static function bindBankAccount($params,$userId)
+    {
+        try{
+            $where = [['worker_id', '=', $userId]];
+            $bankAccount = BankAccount::where($where)->findOrEmpty();
+            if ($bankAccount->isEmpty()) {
+                $bankAccount = new BankAccount();
+                $bankAccount->worker_id = $userId;
+            }
+            $bankAccount->account_holder = $params['account_holder'];
+            $bankAccount->bank_name = $params['bank_name'];
+            $bankAccount->province = $params['province'];
+            $bankAccount->city = $params['city'];
+            $bankAccount->opening_branch = $params['opening_branch'];
+            $bankAccount->account = $params['account'];
+            $bankAccount->mobile = $params['mobile'];
+            $bankAccount->save();
+            return true;
+        } catch(\Exception $e){
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
 }

+ 8 - 0
app/workerapi/logic/MasterWorkerLogic.php

@@ -80,4 +80,12 @@ class MasterWorkerLogic extends  BaseLogic
             return false;
         }
     }
+
+     public static function detail($userId): array
+    {
+        return MasterWorker::field('id,sn,avatar,real_avatar,real_name,nickname,account,mobile,sex,estimate_money,user_money,earnest_money,exp')
+            ->findOrEmpty($userId)
+
+            ->toArray();
+    }
 }

+ 54 - 0
app/workerapi/logic/MasterWorkerMessageLogic.php

@@ -0,0 +1,54 @@
+<?php
+namespace app\workerapi\logic;
+use app\common\enum\YesNoEnum;
+use app\common\logic\BaseLogic;
+use app\common\model\dict\DictData;
+use app\common\model\dict\DictType;
+use app\common\model\master_worker_message\MasterWorkerMessage;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午5:39
+ */
+class MasterWorkerMessageLogic extends  BaseLogic
+{
+    /**
+     * 统计各种类型的未读消息总数
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author 林海涛
+     * @date 2024/7/11 下午5:43
+     */
+    public static function msgStatistics($userId)
+    {
+       //查询字典值
+        $dictData = DictData::where('type_value','worker_notify_message_type')
+            ->field('id,value,name')
+            ->where('status',YesNoEnum::YES)
+            ->order(['sort'=>'desc'])
+            ->select()
+            ->toArray();
+        $msgTypeArr =  array_column($dictData,'value');
+        $msgStatisTicsObj = MasterWorkerMessage::field('msg_type,count(*) as count')
+            ->where('show_type',YesNoEnum::NO)
+            ->whereIn('msg_type',$msgTypeArr)
+            ->where('user_id',$userId)
+            ->group('msg_type')
+            ->select();
+       foreach($dictData as $k => $v){
+           $val = $msgStatisTicsObj->where('msg_type',$v['value'])->first();
+           $v['total'] = $val->count?? 0;
+           $dictData[$k] = $v;
+       }
+       return $dictData;
+    }
+
+    public static function showMsg($params,$userId)
+    {
+        return MasterWorkerMessage::whereIn('id',$params['ids'])
+            ->where('user_id',$userId)
+            ->update(['show_type'=>YesNoEnum::YES]);
+    }
+}

+ 31 - 0
app/workerapi/validate/BankAccountValidate.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace app\workerapi\validate;
+use app\common\validate\BaseValidate;
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午4:30
+ */
+class BankAccountValidate extends \app\common\validate\BaseValidate
+{
+    protected $rule = [
+        'account_holder' => 'require',
+        'bank_name' => 'require',
+        'province'=>'require',
+        'city'=>'require',
+        'opening_branch'=>'require',
+        'account'=>'require',
+        'mobile'=>'require|mobile',
+    ];
+
+    protected $message = [
+        'account_holder.require' => '请输入户主名称',
+        'bank_name.require' => '请输入银行名称',
+        'province.require' => '请输入省',
+        'city.require' => '请输入市',
+        'opening_branch.require' => '请输入开发支行',
+        'account.require' => '请输入开发支行',
+        'mobile.require' => '请输入银行卡预留手机号',
+        'mobile.mobile' => '银行卡预留手机号格式不正确',
+    ];
+}

+ 23 - 0
app/workerapi/validate/FeedbackValidate.php

@@ -0,0 +1,23 @@
+<?php
+namespace app\workerapi\validate;
+use app\common\validate\BaseValidate;
+
+/**
+ * @author 林海涛
+ * @date 2024/7/11 下午2:32
+ */
+Class FeedbackValidate  extends BaseValidate
+{
+    protected $rule = [
+        'feedback_type' => 'require',
+        'description' => 'require',
+        'pictures'=>'array|length:0,4'
+    ];
+
+    protected $message = [
+        'feedback_type.require' => '意见反馈类型必填',
+        'description.require' => '请输入详细说明',
+        'pictures.array' => '上传的图片为一个数组',
+        'pictures.length' => '图片最多上传4张',
+    ];
+}