dongxiaoqin пре 10 месеци
родитељ
комит
79b0ae1092

+ 89 - 0
app/adminapi/controller/setting/dict/DictConfigController.php

@@ -0,0 +1,89 @@
+<?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\setting\dict;
+
+use app\adminapi\controller\BaseAdminController;
+use app\adminapi\lists\setting\dict\DictConfigLists;
+use app\adminapi\logic\setting\dict\DictConfigLogic;
+use app\adminapi\validate\dict\DictConfigValidate;
+
+
+/**
+ * 字典数据
+ * Class DictConfigController
+ * @package app\adminapi\controller\dictionary
+ */
+class DictConfigController extends BaseAdminController
+{
+
+    /**
+     * @notes 获取字典数据列表
+     * @return \think\response\Json
+     */
+    public function lists()
+    {
+        return $this->dataLists(new DictConfigLists());
+    }
+
+    /**
+     * @notes 添加字典数据
+     * @return \think\response\Json
+     */
+    public function add()
+    {
+        $params = (new DictConfigValidate())->post()->goCheck('add');
+        $result = DictConfigLogic::save($params);
+        if (false === $result) {
+            return $this->fail(DictConfigLogic::getError());
+        }
+        return $this->success('添加成功', [], 1, 1);
+    }
+
+    /**
+     * @notes 编辑字典数据
+     * @return \think\response\Json
+     */
+    public function edit()
+    {
+        $params = (new DictConfigValidate())->post()->goCheck('edit');
+        $result = DictConfigLogic::save($params);
+        if (false === $result) {
+            return $this->fail(DictConfigLogic::getError());
+        }
+        return $this->success('编辑成功', [], 1, 1);
+    }
+
+    /**
+     * @notes 删除字典数据
+     * @return \think\response\Json
+     */
+    public function delete()
+    {
+        $params = (new DictConfigValidate())->post()->goCheck('id');
+        DictConfigLogic::delete($params);
+        return $this->success('删除成功', [], 1, 1);
+    }
+
+    /**
+     * @notes 获取字典详情
+     * @return \think\response\Json
+     */
+    public function detail()
+    {
+        $params = (new DictConfigValidate())->goCheck('id');
+        $result = DictConfigLogic::detail($params);
+        return $this->data($result);
+    }
+}

+ 69 - 0
app/adminapi/lists/setting/dict/DictConfigLists.php

@@ -0,0 +1,69 @@
+<?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\setting\dict;
+
+use app\adminapi\lists\BaseAdminDataLists;
+use app\common\lists\ListsSearchInterface;
+use app\common\model\dict\DictConfig;
+
+/**
+ * 字典配置数据列表
+ * Class DictCconfigLists
+ * @package app\adminapi\lists\dict
+ */
+class DictConfigLists extends BaseAdminDataLists implements ListsSearchInterface
+{
+
+    /**
+     * @notes 设置搜索条件
+     * @return \string[]
+     */
+    public function setSearch(): array
+    {
+        return [
+            '%like%' => ['name', 'value'],
+            '=' => ['status']
+        ];
+    }
+
+
+    /**
+     * @notes 获取列表
+     * @return array
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\DbException
+     * @throws \think\db\exception\ModelNotFoundException
+     */
+    public function lists(): array
+    {
+        return DictConfig::where($this->searchWhere)
+            ->append(['status_desc'])
+            ->limit($this->limitOffset, $this->limitLength)
+            ->order([ 'id' => 'desc'])
+            ->select()
+            ->toArray();
+    }
+
+
+    /**
+     * @notes 获取数量
+     * @return int
+     */
+    public function count(): int
+    {
+        return DictConfig::where($this->searchWhere)->count();
+    }
+
+}

+ 85 - 0
app/adminapi/logic/setting/dict/DictConfigLogic.php

@@ -0,0 +1,85 @@
+<?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\setting\dict;
+
+use app\common\logic\BaseLogic;
+use app\common\model\dict\DictConfig;
+
+
+/**
+ * 字典数据逻辑
+ * Class DictConfigLogic
+ * @package app\adminapi\logic\DictConfig
+ */
+class DictConfigLogic extends BaseLogic
+{
+
+    /**
+     * @notes 添加编辑
+     * @param array $params
+     * @return DictConfig|\think\Model
+     */
+    public static function save(array $params)
+    {
+        try {
+            $data = [
+                'name' => $params['name'],
+                'value' => $params['value'],
+                'content' => $params['content'] ? json_encode($params['content']) : null,
+                'status' => $params['status'],
+                'remark' => $params['remark'] ?? '',
+            ];
+            //校验字段类型是否重复
+            $id = !empty($params['id'])? $params['id'] : 0;
+            if (DictConfig::where(['value' => $params['value']])->where('id', '<>', $id)->value('id')) {
+                throw new \think\Exception('字段类型已存在'.$params['id']);
+            }
+            if (!empty($params['id'])) {
+                return DictConfig::where(['id' => $params['id']])->update($data);
+            } else {
+                return DictConfig::create($data);
+            }
+        } catch (\Exception $e) {
+            self::setError($e->getMessage());
+            return false;
+        }
+    }
+
+
+    /**
+     * @notes 删除字典数据
+     * @param array $params
+     * @return bool
+     */
+    public static function delete(array $params)
+    {
+        return DictConfig::destroy($params['id']);
+    }
+
+
+    /**
+     * @notes 获取字典数据详情
+     * @param $params
+     * @return array
+     */
+    public static function detail($params): array
+    {
+        $detail = DictConfig::findOrEmpty($params['id'])->toArray();
+        $detail['content'] = $detail['content'] ?  json_decode($detail['content'], true) : [];
+        return $detail;
+    }
+
+
+}

+ 7 - 7
app/adminapi/logic/works/ServiceWorkLogic.php

@@ -170,9 +170,9 @@ class ServiceWorkLogic extends BaseLogic
             }
 
             //验证更改的预约时间必须是在领单时间内的半小内修改,否则不允许修改
-            if(strtotime($work->appointment_time) != strtotime($params['appointment_time']) && (time()-strtotime($work->receive_time))>1800){
-                throw new Exception('距离领单时间已超过半小时,无法修改预约时间,请联系客服');
-            }
+            // if(strtotime($work->appointment_time) != strtotime($params['appointment_time']) && (time()-strtotime($work->receive_time))>1800){
+            //     throw new Exception('距离领单时间已超过半小时,无法修改预约时间,请联系客服');
+            // }
 
             //添加预约时间修改待审核记录
             ServiceWorkAppointmentLog::create([
@@ -756,7 +756,6 @@ class ServiceWorkLogic extends BaseLogic
             if ($result['appointment_log']){
                 $result['appointment_log']['last_appointment_time'] = date('Y/m/d H:i:s',$result['appointment_log']['last_appointment_time']);
                 $result['appointment_log']['this_appointment_time'] = date('Y/m/d H:i:s',$result['appointment_log']['this_appointment_time']);
-                //$result['appointment_log']['create_time'] = date('Y/m/d H:i:s',$result['appointment_log']['create_time']);
             }
         }
         return  $result;
@@ -1339,7 +1338,7 @@ class ServiceWorkLogic extends BaseLogic
                 throw new \Exception('审核记录不存在');
             }
             $master = MasterWorker::where('id',$log->worker_id)->findOrEmpty();
-            Db::commit();
+            
             
             $log->status = $params['status'];
             $log->remark = $params['remark'];
@@ -1347,7 +1346,7 @@ class ServiceWorkLogic extends BaseLogic
 
             //预约时间修改审核通过则更新工单预约时间
             if ($params['status'] == 1) {
-                $work->work_status = 3;//待上门
+                //$work->work_status = 3;//待上门
                 $work->appointment_time = $log->this_appointment_time;
                 $work->save();
 
@@ -1355,10 +1354,11 @@ class ServiceWorkLogic extends BaseLogic
                 $work_log = [
                     'work_id'=>$work->id,
                     'master_worker_id'=>$log->worker_id,
-                    'opera_log'=>'编号['.$master->worker_number.']'.$master->real_name.'于'.date('y-m-d H:i:s',time()).'联系了客户,确认了于'.date('Y-m-d H:i:s',$log->this_appointment_time).'预约上门',
+                    'opera_log'=>'编号['.$master->worker_number.']'.$master->real_name.'于'.$log->create_time.'联系了客户,确认了于'.date('Y-m-d H:i:s',$log->this_appointment_time).'预约上门',
                 ];
                 ServiceWorkLogLogic::add($work_log);
             }
+            Db::commit();
             return true;
         } catch (\Exception $e) {
             Db::rollback();

+ 93 - 0
app/adminapi/validate/dict/DictConfigValidate.php

@@ -0,0 +1,93 @@
+<?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\dict;
+
+use app\common\model\dict\DictConfig;
+use app\common\validate\BaseValidate;
+
+
+/**
+ * 字典配置数据验证
+ * Class DictConfigValidate
+ * @package app\adminapi\validate\dict
+ */
+class DictConfigValidate extends BaseValidate
+{
+
+    protected $rule = [
+        'id' => 'require|checkDictConfig',
+        'name' => 'require|length:1,255',
+        'value' => 'require',
+        'content' => 'require',
+        'status' => 'require|in:0,1',
+    ];
+
+
+    protected $message = [
+        'id.require' => '参数缺失',
+        'name.require' => '请填写字典数据名称',
+        'name.length' => '字典数据名称长度须在1-255位字符',
+        'value.require' => '请填写字典数据值',
+        'content.require' => '请填写配置数据',
+        'status.require' => '请选择字典数据状态',
+        'status.in' => '字典数据状态参数错误',
+    ];
+
+
+    /**
+     * @notes 添加场景
+     * @return DictDataValidate
+     */
+    public function sceneAdd()
+    {
+        return $this->remove('id', true);
+    }
+
+
+    /**
+     * @notes ID场景
+     * @return DictDataValidate
+     */
+    public function sceneId()
+    {
+        return $this->only(['id']);
+    }
+
+
+    /**
+     * @notes 编辑场景
+     * @return DictDataValidate
+     */
+    public function sceneEdit()
+    {
+        return $this->remove('type_id', true);
+    }
+
+
+    /**
+     * @notes 校验字典数据
+     * @param $value
+     * @return bool|string
+     */
+    protected function checkDictConfig($value)
+    {
+        $article = DictConfig::findOrEmpty($value);
+        if ($article->isEmpty()) {
+            return '字典配置数据不存在';
+        }
+        return true;
+    }
+
+}

+ 45 - 0
app/common/model/dict/DictConfig.php

@@ -0,0 +1,45 @@
+<?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\dict;
+
+use app\common\model\BaseModel;
+use think\model\concern\SoftDelete;
+
+
+/**
+ * 字典配置数据模型
+ * Class DictConfig
+ * @package app\common\model\dict
+ */
+class DictConfig extends BaseModel
+{
+
+    use SoftDelete;
+
+    protected $deleteTime = 'delete_time';
+
+
+    /**
+     * @notes 状态描述
+     * @param $value
+     * @param $data
+     * @return string
+     */
+    public function getStatusDescAttr($value, $data)
+    {
+        return $data['status'] ? '正常' : '停用';
+    }
+
+}

+ 1 - 1
app/workerapi/controller/SaleController.php

@@ -32,7 +32,7 @@ use app\workerapi\lists\GroupActivityLists;
 class SaleController extends BaseApiController
 {
 
-    public array $notNeedLogin = ['register', 'account','getTenantList','getTenantDetail','getWorkerList','getWorkerDetail','getPropertyList','getPropertyDetail'];
+    public array $notNeedLogin = ['register', 'account','getTenantList','getTenantDetail','getWorkerList','getWorkerDetail','getPropertyList','getPropertyDetail','getGroupActivityList','getGroupActivityDetail'];
 
 
     /**