liugc 11 месяцев назад
Родитель
Сommit
7480f81788

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

+ 5 - 3
app/adminapi/lists/master_worker/MasterWorkerServiceOrderLists.php

@@ -58,10 +58,12 @@ class MasterWorkerServiceOrderLists extends BaseAdminDataLists implements ListsS
             $where[] = [ 'a.id','IN',$period_ids?:[0]];
         }
         if (isset($this->params['is_recruiting_behalf']) && !empty($this->params['is_recruiting_behalf'])) {
+            $where[] = ['a.recruiting_behalf','<>' ,""];
             if ($this->params['is_recruiting_behalf'] == 1){
-                $where[] = ['a.recruiting_behalf','<>' ,""];
-                $master_worker_ids = MasterWorkerBehalf::column('master_worker_id')??[];
-                $master_worker_ids && $where[] = ['a.id','not in' ,$master_worker_ids];
+                if (isset($this->params['accounting']) && !empty($this->params['accounting'])) {
+                    $this->params['accounting'] == 2 && $where[] = ['a.id','in' ,MasterWorkerBehalf::column('master_worker_id')??[]];
+                    $this->params['accounting'] == 1 && $where[] = ['a.id','not in' ,MasterWorkerBehalf::column('master_worker_id')??[]];
+                }
             }else
                 $where[] = ['a.recruiting_behalf','=' ,""];
         }

+ 77 - 0
app/adminapi/lists/works/ServiceWorkAnomalousLists.php

@@ -0,0 +1,77 @@
+<?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\works;
+
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\model\works\ServiceWorkAnomalous;
+use app\common\lists\ListsSearchInterface;
+
+
+/**
+ * ServiceWorkAnomalous列表
+ * Class ServiceWorkAnomalousLists
+ * @package app\adminapi\lists
+ */
+class ServiceWorkAnomalousLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[][]
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function setSearch(): array
+    {
+        return [
+            '=' => ['work_id', 'reason_type', 'reason', 'status', 'remark'],
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function lists(): array
+    {
+        return ServiceWorkAnomalous::where($this->searchWhere)
+            ->field(['id', 'work_id', 'reason_type', 'reason', 'status', 'remark'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order(['id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function count(): int
+    {
+        return ServiceWorkAnomalous::where($this->searchWhere)->count();
+    }
+
+}

+ 3 - 0
app/adminapi/logic/external/ExternalConsultationLogic.php

@@ -45,6 +45,7 @@ class ExternalConsultationLogic extends BaseLogic
                 'external_platform_id' => $params['external_platform_id'],
                 'shop_code' => $params['shop_code'],
                 'shop_name' => $params['shop_name'],
+                'service_name' => $params['service_name']??'',
                 'unique_code' => $params['unique_code'],
                 'solution_type' => $params['solution_type'],
                 'form_detail' => $params['form_detail'],
@@ -84,6 +85,7 @@ class ExternalConsultationLogic extends BaseLogic
                 'external_platform_id' => $params['external_platform_id'],
                 'shop_code' => $params['shop_code'],
                 'shop_name' => $params['shop_name'],
+                'service_name' => $params['service_name']??'',
                 'unique_code' => $params['unique_code'],
                 'solution_type' => $params['solution_type'],
                 'form_detail' => $params['form_detail'],
@@ -133,6 +135,7 @@ class ExternalConsultationLogic extends BaseLogic
                 'external_platform_id' => $params['external_platform_id'],
                 'shop_code' => $params['shop_code'],
                 'shop_name' => $params['shop_name'],
+                'service_name' => $params['service_name']??'',
                 'unique_code' => $params['unique_code'],
                 'solution_type' => $params['solution_type'],
                 'form_detail' => $params['form_detail'],

+ 114 - 0
app/adminapi/logic/works/ServiceWorkAnomalousLogic.php

@@ -0,0 +1,114 @@
+<?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\works;
+
+
+use app\common\model\works\ServiceWorkAnomalous;
+use app\common\logic\BaseLogic;
+use think\facade\Db;
+
+
+/**
+ * ServiceWorkAnomalous逻辑
+ * Class ServiceWorkAnomalousLogic
+ * @package app\adminapi\logic
+ */
+class ServiceWorkAnomalousLogic extends BaseLogic
+{
+
+
+    /**
+     * @notes 添加
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public static function add(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ServiceWorkAnomalous::create([
+                'work_id' => $params['work_id'],
+                'reason_type' => $params['reason_type'],
+                'reason' => $params['reason'],
+                'status' => $params['status'],
+                'remark' => $params['remark']
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 编辑
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public static function edit(array $params): bool
+    {
+        Db::startTrans();
+        try {
+            ServiceWorkAnomalous::where('id', $params['id'])->update([
+                'work_id' => $params['work_id'],
+                'reason_type' => $params['reason_type'],
+                'reason' => $params['reason'],
+                'status' => $params['status'],
+                'remark' => $params['remark']
+            ]);
+
+            Db::commit();
+            return true;
+        } catch (\Exception $e) {
+            Db::rollback();
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除
+     * @param array $params
+     * @return bool
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public static function delete(array $params): bool
+    {
+        return ServiceWorkAnomalous::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取详情
+     * @param $params
+     * @return array
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public static function detail($params): array
+    {
+        return ServiceWorkAnomalous::findOrEmpty($params['id'])->toArray();
+    }
+}

+ 100 - 0
app/adminapi/validate/works/ServiceWorkAnomalousValidate.php

@@ -0,0 +1,100 @@
+<?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\works;
+
+
+use app\common\validate\BaseValidate;
+
+
+/**
+ * ServiceWorkAnomalous验证器
+ * Class ServiceWorkAnomalousValidate
+ * @package app\adminapi\validate
+ */
+class ServiceWorkAnomalousValidate extends BaseValidate
+{
+
+     /**
+      * 设置校验规则
+      * @var string[]
+      */
+    protected $rule = [
+        'id' => 'require',
+        'work_id' => 'require',
+        'reason_type' => 'require',
+        'status' => 'require',
+    ];
+
+
+    /**
+     * 参数描述
+     * @var string[]
+     */
+    protected $field = [
+        'id' => 'id',
+        'work_id' => '服务工单ID',
+        'reason_type' => '原因类型:0=未知,1=金额错误',
+        'status' => '处理状态:0=未处理,1=已处理',
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return ServiceWorkAnomalousValidate
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function sceneAdd()
+    {
+        return $this->only(['work_id','reason_type','status']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return ServiceWorkAnomalousValidate
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function sceneEdit()
+    {
+        return $this->only(['id','work_id','reason_type','status']);
+    }
+
+
+    /**
+     * @notes 删除场景
+     * @return ServiceWorkAnomalousValidate
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function sceneDelete()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 详情场景
+     * @return ServiceWorkAnomalousValidate
+     * @author likeadmin
+     * @date 2025/05/04 15:41
+     */
+    public function sceneDetail()
+    {
+        return $this->only(['id']);
+    }
+
+}

+ 34 - 0
app/common/model/works/ServiceWorkAnomalous.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\works;
+
+
+use app\common\model\BaseModel;
+
+
+
+/**
+ * ServiceWorkAnomalous模型
+ * Class ServiceWorkAnomalous
+ * @package app\common\model
+ */
+class ServiceWorkAnomalous extends BaseModel
+{
+    
+    protected $name = 'service_work_anomalous';
+    
+
+    
+}