Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into dev
正在显示
14 个修改的文件
包含
477 行增加
和
9 行删除
| @@ -66,7 +66,6 @@ class ShareUser extends Command | @@ -66,7 +66,6 @@ class ShareUser extends Command | ||
| 66 | //删除用户第三方配置 | 66 | //删除用户第三方配置 |
| 67 | if(!empty($v['profile_key'])){ | 67 | if(!empty($v['profile_key'])){ |
| 68 | $this->del_profiles($v); | 68 | $this->del_profiles($v); |
| 69 | - continue; | ||
| 70 | } | 69 | } |
| 71 | //更新数据库 | 70 | //更新数据库 |
| 72 | $this->save_ayr_share($ayr_share_model,$v); | 71 | $this->save_ayr_share($ayr_share_model,$v); |
| @@ -131,7 +131,7 @@ class BaseController extends Controller | @@ -131,7 +131,7 @@ class BaseController extends Controller | ||
| 131 | ]; | 131 | ]; |
| 132 | $this->header['Content-Type'] = $type; | 132 | $this->header['Content-Type'] = $type; |
| 133 | $this->header['token'] = $this->token; | 133 | $this->header['token'] = $this->token; |
| 134 | - $response = response($result,$result_code,$this->header);; | 134 | + $response = response($result,$result_code,$this->header); |
| 135 | throw new HttpResponseException($response); | 135 | throw new HttpResponseException($response); |
| 136 | } | 136 | } |
| 137 | 137 | ||
| @@ -145,7 +145,6 @@ class BaseController extends Controller | @@ -145,7 +145,6 @@ class BaseController extends Controller | ||
| 145 | * @time :2023/6/17 16:34 | 145 | * @time :2023/6/17 16:34 |
| 146 | */ | 146 | */ |
| 147 | protected function _extents($data) { | 147 | protected function _extents($data) { |
| 148 | - | ||
| 149 | if (empty($data) || !is_array($data)) { | 148 | if (empty($data) || !is_array($data)) { |
| 150 | return empty($data) ? is_array($data) ? [] : '' : $data; | 149 | return empty($data) ? is_array($data) ? [] : '' : $data; |
| 151 | } | 150 | } |
| @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Aside\Project; | @@ -4,7 +4,9 @@ namespace App\Http\Controllers\Aside\Project; | ||
| 4 | 4 | ||
| 5 | use App\Helper\Arr; | 5 | use App\Helper\Arr; |
| 6 | use App\Http\Controllers\Aside\BaseController; | 6 | use App\Http\Controllers\Aside\BaseController; |
| 7 | +use App\Http\Logic\Aside\Project\ProcessRecordsLogic; | ||
| 7 | use App\Http\Logic\Aside\Project\ProjectLogic; | 8 | use App\Http\Logic\Aside\Project\ProjectLogic; |
| 9 | +use App\Http\Requests\Aside\Project\ProcessRecordsRequest; | ||
| 8 | use App\Http\Requests\Aside\Project\ProjectRequest; | 10 | use App\Http\Requests\Aside\Project\ProjectRequest; |
| 9 | use App\Models\InquirySet; | 11 | use App\Models\InquirySet; |
| 10 | use App\Rules\Ids; | 12 | use App\Rules\Ids; |
| @@ -96,4 +98,30 @@ class ProjectController extends BaseController | @@ -96,4 +98,30 @@ class ProjectController extends BaseController | ||
| 96 | $data = $logic->dataSource(); | 98 | $data = $logic->dataSource(); |
| 97 | return $this->success($data); | 99 | return $this->success($data); |
| 98 | } | 100 | } |
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * 进程记录 | ||
| 104 | + * @author zbj | ||
| 105 | + * @date 2023/6/25 | ||
| 106 | + */ | ||
| 107 | + public function get_process_records(Request $request, ProcessRecordsLogic $logic){ | ||
| 108 | + $request->validate([ | ||
| 109 | + 'project_id'=>'required' | ||
| 110 | + ],[ | ||
| 111 | + 'project_id.required' => '项目ID不能为空' | ||
| 112 | + ]); | ||
| 113 | + $data = $logic->getInfo($this->param['project_id']); | ||
| 114 | + return $this->success($data); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + /** | ||
| 118 | + * 保存进程记录 | ||
| 119 | + * @author zbj | ||
| 120 | + * @date 2023/6/25 | ||
| 121 | + */ | ||
| 122 | + public function save_process_records(ProcessRecordsRequest $request, ProcessRecordsLogic $logic){ | ||
| 123 | + $this->param['operator_id'] = $this->manage['id']; | ||
| 124 | + $data = $logic->save($this->param); | ||
| 125 | + return $this->success($data); | ||
| 126 | + } | ||
| 99 | } | 127 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Logic\Aside\Service\ServiceLogic; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @remark :企业服务设置信息 | ||
| 10 | + * @name :ServiceController | ||
| 11 | + * @author :lyh | ||
| 12 | + * @time :2023/6/25 16:13 | ||
| 13 | + */ | ||
| 14 | +class ServiceController extends BaseController | ||
| 15 | +{ | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * @remark :列表 | ||
| 19 | + * @name :lists | ||
| 20 | + * @author :lyh | ||
| 21 | + * @method :post | ||
| 22 | + * @time :2023/6/25 14:31 | ||
| 23 | + */ | ||
| 24 | + public function lists(ServiceLogic $serviceLogic){ | ||
| 25 | + $lists = $serviceLogic->serviceLists($this->map,$this->page,$this->row,$this->order); | ||
| 26 | + $this->response('success',Code::SUCCESS,$lists); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * @remark :企业服务通知详情 | ||
| 31 | + * @name :read | ||
| 32 | + * @author :lyh | ||
| 33 | + * @method :post | ||
| 34 | + * @time :2023/6/25 11:50 | ||
| 35 | + */ | ||
| 36 | + public function read(ServiceLogic $serviceLogic){ | ||
| 37 | + $this->request->validate([ | ||
| 38 | + 'id' => 'required', | ||
| 39 | + ],[ | ||
| 40 | + 'id.required' => '主键不能为空', | ||
| 41 | + ]); | ||
| 42 | + $info = $serviceLogic->serviceRead(); | ||
| 43 | + $this->response('success',Code::SUCCESS,$info); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * @remark :新增或编辑 | ||
| 48 | + * @name :save | ||
| 49 | + * @author :lyh | ||
| 50 | + * @method :post | ||
| 51 | + * @time :2023/6/25 11:51 | ||
| 52 | + */ | ||
| 53 | + public function save(ServiceLogic $serviceLogic){ | ||
| 54 | + if(isset($this->param['id'])){ | ||
| 55 | + $this->request->validate([ | ||
| 56 | + 'id' => 'required', | ||
| 57 | + ],[ | ||
| 58 | + 'id.required' => '主键不能为空', | ||
| 59 | + ]); | ||
| 60 | + } | ||
| 61 | + //参数验证 | ||
| 62 | + $this->verifyParam(); | ||
| 63 | + $serviceLogic->serviceSave(); | ||
| 64 | + $this->response('success'); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * @remark :编辑指定状态 | ||
| 69 | + * @name :status | ||
| 70 | + * @author :lyh | ||
| 71 | + * @method :post | ||
| 72 | + * @time :2023/6/25 14:15 | ||
| 73 | + */ | ||
| 74 | + public function status(ServiceLogic $serviceLogic){ | ||
| 75 | + $this->request->validate([ | ||
| 76 | + 'id' => 'required', | ||
| 77 | + ],[ | ||
| 78 | + 'id.required' => '主键不能为空', | ||
| 79 | + ]); | ||
| 80 | + $serviceLogic->serviceStatus(); | ||
| 81 | + $this->response('success'); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + /** | ||
| 85 | + * @param ServiceLogic $serviceLogic | ||
| 86 | + * @remark :删除信息 | ||
| 87 | + * @name :del | ||
| 88 | + * @author :lyh | ||
| 89 | + * @method :post | ||
| 90 | + * @time :2023/6/25 14:26 | ||
| 91 | + */ | ||
| 92 | + public function del(ServiceLogic $serviceLogic){ | ||
| 93 | + $this->request->validate([ | ||
| 94 | + 'id' => 'required|array', | ||
| 95 | + ],[ | ||
| 96 | + 'id.required' => '主键不能为空', | ||
| 97 | + ]); | ||
| 98 | + $serviceLogic->serviceDel(); | ||
| 99 | + $this->response('success'); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @remark :参数验证 | ||
| 104 | + * @name :validParam | ||
| 105 | + * @author :lyh | ||
| 106 | + * @method :post | ||
| 107 | + * @time :2023/6/25 14:03 | ||
| 108 | + */ | ||
| 109 | + public function verifyParam(){ | ||
| 110 | + $this->request->validate([ | ||
| 111 | + 'address' => 'required', | ||
| 112 | + 'duty_phone' => 'required', | ||
| 113 | + 'landline_telephone' => 'required', | ||
| 114 | + 'free_hotline' => 'required', | ||
| 115 | + 'enterprise_qq' => 'required', | ||
| 116 | + 'android' => 'required', | ||
| 117 | + 'official_account' => 'required', | ||
| 118 | + 'ios' => 'required', | ||
| 119 | + 'image' => 'required', | ||
| 120 | + 'app_remark' => 'required', | ||
| 121 | + ],[ | ||
| 122 | + 'address.required' => '地址不能为空', | ||
| 123 | + 'duty_phone.required' => '值班电话不能为空', | ||
| 124 | + 'landline_telephone.required' => '座机电话不能为空', | ||
| 125 | + 'free_hotline.required' => '免费热线不能为空', | ||
| 126 | + 'enterprise_qq.required' => '企业qq不能为空', | ||
| 127 | + 'android.required' => '安卓不能为空', | ||
| 128 | + 'official_account.required' => '公众号不能为空', | ||
| 129 | + 'ios.required' => 'ios下载地址不能为空', | ||
| 130 | + 'image.required' => '轮播图不能为空', | ||
| 131 | + 'app_remark.required' => 'app下载备注信息不能为空', | ||
| 132 | + ]); | ||
| 133 | + } | ||
| 134 | +} |
| @@ -5,10 +5,12 @@ namespace App\Http\Controllers\Aside\Task; | @@ -5,10 +5,12 @@ namespace App\Http\Controllers\Aside\Task; | ||
| 5 | use App\Http\Controllers\Aside\BaseController; | 5 | use App\Http\Controllers\Aside\BaseController; |
| 6 | use App\Http\Logic\Aside\Task\TaskFollowLogic; | 6 | use App\Http\Logic\Aside\Task\TaskFollowLogic; |
| 7 | use App\Http\Logic\Aside\Task\TaskLogic; | 7 | use App\Http\Logic\Aside\Task\TaskLogic; |
| 8 | +use App\Http\Logic\Aside\Task\TaskOwnerLogic; | ||
| 8 | use App\Http\Requests\Aside\Task\TaskFollowRequest; | 9 | use App\Http\Requests\Aside\Task\TaskFollowRequest; |
| 9 | use App\Http\Requests\Aside\Task\TaskRequest; | 10 | use App\Http\Requests\Aside\Task\TaskRequest; |
| 10 | use App\Models\Task\Task; | 11 | use App\Models\Task\Task; |
| 11 | -use Illuminate\Support\Facades\Request; | 12 | +use App\Models\Task\TaskOwner; |
| 13 | +use Illuminate\Http\Request; | ||
| 12 | use Illuminate\Validation\Rule; | 14 | use Illuminate\Validation\Rule; |
| 13 | 15 | ||
| 14 | 16 | ||
| @@ -26,10 +28,17 @@ class TaskController extends BaseController | @@ -26,10 +28,17 @@ class TaskController extends BaseController | ||
| 26 | { | 28 | { |
| 27 | $map = []; | 29 | $map = []; |
| 28 | if(!empty($this->param['search'])){ | 30 | if(!empty($this->param['search'])){ |
| 29 | - $map[] = ['title', 'like', "%{$this->param['search']}%"]; | 31 | + $map[] = ['content', 'like', "%{$this->param['search']}%"]; |
| 30 | } | 32 | } |
| 33 | + if(!empty($this->param['created_manage_id'])){ | ||
| 34 | + $map[] = ['created_manage_id', $this->param['created_manage_id']]; | ||
| 35 | + } | ||
| 36 | + if(!empty($this->param['owner_manage_id'])){ | ||
| 37 | + $map[] = ['id', 'in', TaskOwner::where('manage_id', $this->param['owner_manage_id'])->pluck('task_id')]; | ||
| 38 | + } | ||
| 39 | + | ||
| 31 | $sort = ['id' => 'desc']; | 40 | $sort = ['id' => 'desc']; |
| 32 | - $data = $logic->getList($map, $sort); | 41 | + $data = $logic->getList($map, $sort, ['id', 'project_id', 'workload', 'priority', 'content', 'attachment', 'status', 'end_at', 'created_manage_id']); |
| 33 | 42 | ||
| 34 | return $this->success($data); | 43 | return $this->success($data); |
| 35 | } | 44 | } |
| @@ -46,6 +55,7 @@ class TaskController extends BaseController | @@ -46,6 +55,7 @@ class TaskController extends BaseController | ||
| 46 | 55 | ||
| 47 | public function save(TaskRequest $request, TaskLogic $logic) | 56 | public function save(TaskRequest $request, TaskLogic $logic) |
| 48 | { | 57 | { |
| 58 | + $this->param['created_manage_id'] = $this->manage->id; | ||
| 49 | $data = $logic->save($this->param); | 59 | $data = $logic->save($this->param); |
| 50 | return $this->success($data); | 60 | return $this->success($data); |
| 51 | } | 61 | } |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Project; | ||
| 4 | + | ||
| 5 | + | ||
| 6 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 7 | +use App\Models\Project\ProcessRecords; | ||
| 8 | + | ||
| 9 | +class ProcessRecordsLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + | ||
| 15 | + $this->model = new ProcessRecords(); | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + public function getInfo($project_id) | ||
| 19 | + { | ||
| 20 | + $data = $this->model->select(['project_id', 'record', 'remark'])->where('project_id', $project_id)->first(); | ||
| 21 | + if(!$data){ | ||
| 22 | + $data = [ | ||
| 23 | + 'project_id' => $project_id, | ||
| 24 | + 'record' => [], | ||
| 25 | + 'remark' => '', | ||
| 26 | + ]; | ||
| 27 | + }else{ | ||
| 28 | + $data = $data->toArray(); | ||
| 29 | + } | ||
| 30 | + $data['data_source'] = [ | ||
| 31 | + [ | ||
| 32 | + 'type' => '基础资料', | ||
| 33 | + 'item' => ['Logo', 'banner素材', '基本信息', '公司介绍', '新闻'] | ||
| 34 | + ], | ||
| 35 | + [ | ||
| 36 | + 'type' => '产品资料', | ||
| 37 | + 'item' => ['都未准备', '不足10款', '描述较少', '重复度过高'] | ||
| 38 | + ], | ||
| 39 | + [ | ||
| 40 | + 'type' => '关键词/域名', | ||
| 41 | + 'item' => ['未提供', '筛选中', '未盖章', '域名未确认'] | ||
| 42 | + ], | ||
| 43 | + [ | ||
| 44 | + 'type' => '建站进度', | ||
| 45 | + 'item' => ['资料上传', '网站修改中', '网站搭建完成,客户确认中', '等待网站品控审核后上线'] | ||
| 46 | + ] | ||
| 47 | + ]; | ||
| 48 | + return $this->success($data); | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public function save($param){ | ||
| 52 | + $info = $this->model->select(['project_id', 'record', 'remark'])->where('project_id', $param['project_id'])->first(); | ||
| 53 | + if($info){ | ||
| 54 | + $this->model = $info; | ||
| 55 | + } | ||
| 56 | + $this->model->record = $param['record']; | ||
| 57 | + $this->model->remark = $param['remark']; | ||
| 58 | + $this->model->operator_id = $param['operator_id']; | ||
| 59 | + $res = $this->model->save(); | ||
| 60 | + if($res){ | ||
| 61 | + return $this->success(['project_id' => $this->model->project_id]); | ||
| 62 | + }else{ | ||
| 63 | + $this->fail('保存失败'); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Logic\Aside\Service; | ||
| 4 | + | ||
| 5 | +use App\Http\Logic\Aside\BaseLogic; | ||
| 6 | +use App\Models\Service; | ||
| 7 | +use Illuminate\Support\Facades\DB; | ||
| 8 | + | ||
| 9 | +class ServiceLogic extends BaseLogic | ||
| 10 | +{ | ||
| 11 | + public function __construct() | ||
| 12 | + { | ||
| 13 | + parent::__construct(); | ||
| 14 | + $this->model = new Service(); | ||
| 15 | + $this->param = $this->requestAll; | ||
| 16 | + } | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * @remark :企业服务列表 | ||
| 20 | + * @name :serviceLists | ||
| 21 | + * @author :lyh | ||
| 22 | + * @method :post | ||
| 23 | + * @time :2023/6/25 14:32 | ||
| 24 | + */ | ||
| 25 | + public function serviceLists($map,$page,$row,$order = 'id',$filed = ['*']){ | ||
| 26 | + $lists = $this->model->lists($map,$page,$row,$order,$filed); | ||
| 27 | + return $this->success($lists); | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * @remark :获取详情 | ||
| 32 | + * @name :serviceRead | ||
| 33 | + * @author :lyh | ||
| 34 | + * @method :post | ||
| 35 | + * @time :2023/6/25 13:44 | ||
| 36 | + */ | ||
| 37 | + public function serviceRead(){ | ||
| 38 | + $info = $this->model->read(['id'=>$this->param['id'],'status'=>0]); | ||
| 39 | + return $this->success($info); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + /** | ||
| 43 | + * @remark :新增或编辑 | ||
| 44 | + * @name :serviceSave | ||
| 45 | + * @author :lyh | ||
| 46 | + * @method :post | ||
| 47 | + * @time :2023/6/25 13:45 | ||
| 48 | + */ | ||
| 49 | + public function serviceSave(){ | ||
| 50 | + $info = $this->model->read(['id'=>$this->param['id']]); | ||
| 51 | + if($info === false){ | ||
| 52 | + $rs = $this->model->add($this->param); | ||
| 53 | + }else{ | ||
| 54 | + $rs = $this->model->edit($this->param,['id'=>$this->param['id']]); | ||
| 55 | + } | ||
| 56 | + if($rs === false){ | ||
| 57 | + $this->fail('error'); | ||
| 58 | + } | ||
| 59 | + return $this->success(); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * @remark :指定状态始终为一条数据 | ||
| 64 | + * @name :serviceStatus | ||
| 65 | + * @author :lyh | ||
| 66 | + * @method :post | ||
| 67 | + * @time :2023/6/25 14:09 | ||
| 68 | + */ | ||
| 69 | + public function serviceStatus(){ | ||
| 70 | + DB::beginTransaction(); | ||
| 71 | + try { | ||
| 72 | + $this->model->edit(['status'=>1],['id'=>['!=',$this->param['id']]]); | ||
| 73 | + $this->model->edit(['status'=>0],['id'=>$this->param['id']]); | ||
| 74 | + DB::commit(); | ||
| 75 | + }catch (\Exception $e){ | ||
| 76 | + DB::rollBack(); | ||
| 77 | + $this->fail('error'); | ||
| 78 | + } | ||
| 79 | + return $this->success(); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /** | ||
| 83 | + * @remark :删除企业服务信息 | ||
| 84 | + * @name :serviceDel | ||
| 85 | + * @author :lyh | ||
| 86 | + * @method :post | ||
| 87 | + * @time :2023/6/25 14:22 | ||
| 88 | + */ | ||
| 89 | + public function serviceDel(){ | ||
| 90 | + $rs = $this->model->del(['id'=>['in',$this->param['id']]]); | ||
| 91 | + if($rs === false){ | ||
| 92 | + $this->fail('error'); | ||
| 93 | + } | ||
| 94 | + return $this->success(); | ||
| 95 | + } | ||
| 96 | +} |
| @@ -24,7 +24,8 @@ class TaskFollowLogic extends BaseLogic | @@ -24,7 +24,8 @@ class TaskFollowLogic extends BaseLogic | ||
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | public function save($param){ | 26 | public function save($param){ |
| 27 | - $task = $this::getInfo($param['task_id']); | 27 | + $task_logic = new TaskLogic(); |
| 28 | + $task = $task_logic->getCacheInfo($param['task_id']); | ||
| 28 | if(!$task){ | 29 | if(!$task){ |
| 29 | $this->fail('任务不存在'); | 30 | $this->fail('任务不存在'); |
| 30 | } | 31 | } |
| @@ -33,6 +34,11 @@ class TaskFollowLogic extends BaseLogic | @@ -33,6 +34,11 @@ class TaskFollowLogic extends BaseLogic | ||
| 33 | $this->fail('非本人任务,不能添加跟进记录'); | 34 | $this->fail('非本人任务,不能添加跟进记录'); |
| 34 | } | 35 | } |
| 35 | parent::save($param); | 36 | parent::save($param); |
| 37 | + | ||
| 38 | + //清任务缓存 | ||
| 39 | + $task_logic->clearCache($param['task_id']); | ||
| 40 | + | ||
| 41 | + return $this->success(); | ||
| 36 | } | 42 | } |
| 37 | 43 | ||
| 38 | 44 |
| @@ -22,7 +22,7 @@ class TaskOwnerLogic extends BaseLogic | @@ -22,7 +22,7 @@ class TaskOwnerLogic extends BaseLogic | ||
| 22 | 22 | ||
| 23 | public function save($param){ | 23 | public function save($param){ |
| 24 | //获取已分配了的 | 24 | //获取已分配了的 |
| 25 | - $manage_ids = $this->model->where('task_id', $param['task_id'])->pluck('manage_id', 'id'); | 25 | + $manage_ids = $this->model->where('task_id', $param['task_id'])->pluck('manage_id', 'id')->toArray(); |
| 26 | 26 | ||
| 27 | //待删除的 | 27 | //待删除的 |
| 28 | $del_manage_ids = array_diff($manage_ids, $param['manage_ids']); | 28 | $del_manage_ids = array_diff($manage_ids, $param['manage_ids']); |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Aside\Project; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | +use Illuminate\Support\Str; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * Class ProcessRecordsRequest | ||
| 10 | + * @package App\Http\Requests\Aside\product | ||
| 11 | + * @author zbj | ||
| 12 | + * @date 2023/6/25 | ||
| 13 | + */ | ||
| 14 | +class ProcessRecordsRequest extends FormRequest | ||
| 15 | +{ | ||
| 16 | + /** | ||
| 17 | + * Determine if the user is authorized to make this request. | ||
| 18 | + * | ||
| 19 | + * @return bool | ||
| 20 | + */ | ||
| 21 | + public function authorize() | ||
| 22 | + { | ||
| 23 | + return true; | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * Get the validation rules that apply to the request. | ||
| 28 | + * | ||
| 29 | + * @return array | ||
| 30 | + */ | ||
| 31 | + public function rules() | ||
| 32 | + { | ||
| 33 | + return [ | ||
| 34 | + 'project_id' => 'required', | ||
| 35 | + 'record' => ['required', 'array', function ($attribute, $value, $fail) { | ||
| 36 | + foreach ($value as $v) { | ||
| 37 | + if (empty($v['date'])) { | ||
| 38 | + $fail('请选择记录日期'); | ||
| 39 | + } | ||
| 40 | + if (empty($v['content'])) { | ||
| 41 | + $fail('请输入记录内容'); | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | + }], | ||
| 45 | + ]; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public function messages() | ||
| 49 | + { | ||
| 50 | + return [ | ||
| 51 | + 'project_id.required'=>'项目ID不能为空', | ||
| 52 | + ]; | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | +} |
app/Models/Project/ProcessRecords.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\Project; | ||
| 4 | + | ||
| 5 | +use App\Helper\Arr; | ||
| 6 | +use App\Models\Base; | ||
| 7 | +use App\Services\Facades\Upload; | ||
| 8 | + | ||
| 9 | +class ProcessRecords extends Base | ||
| 10 | +{ | ||
| 11 | + //设置关联表名 | ||
| 12 | + protected $table = 'gl_project_process_records'; | ||
| 13 | + | ||
| 14 | + public function setRecordAttribute($value){ | ||
| 15 | + foreach ($value as &$v){ | ||
| 16 | + $v['image'] = Upload::url2path($v['image']); | ||
| 17 | + $v['file'] = Upload::url2path($v['file']); | ||
| 18 | + } | ||
| 19 | + $this->attributes['record'] = Arr::a2s($value); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + public function getRecordAttribute($value){ | ||
| 23 | + $value = Arr::s2a($value); | ||
| 24 | + foreach ($value as &$v){ | ||
| 25 | + $v['image'] = Upload::path2url($v['image']); | ||
| 26 | + $v['file'] = Upload::path2url($v['file']); | ||
| 27 | + } | ||
| 28 | + return $value; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
app/Models/Service.php
0 → 100644
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Models\Task; | 3 | namespace App\Models\Task; |
| 4 | 4 | ||
| 5 | +use App\Http\Logic\Aside\Project\ProjectLogic; | ||
| 5 | use App\Models\Base; | 6 | use App\Models\Base; |
| 6 | use App\Services\Facades\Upload; | 7 | use App\Services\Facades\Upload; |
| 7 | 8 | ||
| @@ -10,6 +11,8 @@ class Task extends Base | @@ -10,6 +11,8 @@ class Task extends Base | ||
| 10 | //设置关联表名 | 11 | //设置关联表名 |
| 11 | protected $table = 'gl_task'; | 12 | protected $table = 'gl_task'; |
| 12 | 13 | ||
| 14 | + protected $appends = ['project_id_text', 'status_text', 'timeout']; | ||
| 15 | + | ||
| 13 | const STATUS_WAIT = 0; | 16 | const STATUS_WAIT = 0; |
| 14 | const STATUS_DONGING = 1; | 17 | const STATUS_DONGING = 1; |
| 15 | const STATUS_DOWN = 2; | 18 | const STATUS_DOWN = 2; |
| @@ -18,11 +21,20 @@ class Task extends Base | @@ -18,11 +21,20 @@ class Task extends Base | ||
| 18 | public static function statusMap(){ | 21 | public static function statusMap(){ |
| 19 | return [ | 22 | return [ |
| 20 | self::STATUS_WAIT => '未开始', | 23 | self::STATUS_WAIT => '未开始', |
| 21 | - self::STATUS_DONGING => '进行中', | 24 | + self::STATUS_DONGING => '进程中', |
| 22 | self::STATUS_DOWN => '已完成', | 25 | self::STATUS_DOWN => '已完成', |
| 23 | ]; | 26 | ]; |
| 24 | } | 27 | } |
| 25 | 28 | ||
| 29 | + public function getProjectIdTextAttribute(){ | ||
| 30 | + $project = ProjectLogic::instance()->getCacheInfo($this->project_id); | ||
| 31 | + return $project['title'] ?? ''; | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + public function getStatusTextAttribute(){ | ||
| 35 | + return self::statusMap()[$this->status] ?? ''; | ||
| 36 | + } | ||
| 37 | + | ||
| 26 | public function setAttachmentAttribute($value){ | 38 | public function setAttachmentAttribute($value){ |
| 27 | $this->attributes['attachment'] = Upload::url2path($value); | 39 | $this->attributes['attachment'] = Upload::url2path($value); |
| 28 | } | 40 | } |
| @@ -31,6 +43,13 @@ class Task extends Base | @@ -31,6 +43,13 @@ class Task extends Base | ||
| 31 | return Upload::path2url($value); | 43 | return Upload::path2url($value); |
| 32 | } | 44 | } |
| 33 | 45 | ||
| 46 | + public function getTimeoutAttribute(){ | ||
| 47 | + if($this->status != self::STATUS_DOWN && strtotime($this->end_at) < time()){ | ||
| 48 | + return floor((time() - strtotime($this->end_at)) / 60); | ||
| 49 | + } | ||
| 50 | + return 0; | ||
| 51 | + } | ||
| 52 | + | ||
| 34 | public function owner(){ | 53 | public function owner(){ |
| 35 | return $this->hasMany(TaskOwner::class,'task_id','id'); | 54 | return $this->hasMany(TaskOwner::class,'task_id','id'); |
| 36 | 55 |
| @@ -112,6 +112,15 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -112,6 +112,15 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 112 | Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain'); | 112 | Route::any('/empowerDomain', [Aside\Project\OptimizeController::class, 'empowerDomain'])->name('admin.empowerDomain'); |
| 113 | }); | 113 | }); |
| 114 | 114 | ||
| 115 | + //企业服务配置 | ||
| 116 | + Route::prefix('service')->group(function () { | ||
| 117 | + Route::any('/', [Aside\ServiceController::class, 'lists'])->name('admin.service_lists'); | ||
| 118 | + Route::any('/read', [Aside\ServiceController::class, 'read'])->name('admin.service_read'); | ||
| 119 | + Route::any('/save', [Aside\ServiceController::class, 'save'])->name('admin.service_save'); | ||
| 120 | + Route::any('/status', [Aside\ServiceController::class, 'status'])->name('admin.service_status'); | ||
| 121 | + Route::any('/del', [Aside\ServiceController::class, 'del'])->name('admin.service_del'); | ||
| 122 | + }); | ||
| 123 | + | ||
| 115 | //项目管理 | 124 | //项目管理 |
| 116 | Route::prefix('project')->group(function () { | 125 | Route::prefix('project')->group(function () { |
| 117 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); | 126 | Route::get('/', [Aside\Project\ProjectController::class, 'list'])->name('admin.project'); |
| @@ -119,6 +128,8 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -119,6 +128,8 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 119 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); | 128 | Route::post('/save', [Aside\Project\ProjectController::class, 'save'])->name('admin.project_save'); |
| 120 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); | 129 | Route::any('/inquiry_set', [Aside\Project\ProjectController::class, 'inquiry_set'])->name('admin.project_inquiry_set'); |
| 121 | Route::any('/data_source', [Aside\Project\ProjectController::class, 'data_source'])->name('admin.project_data_source'); | 130 | Route::any('/data_source', [Aside\Project\ProjectController::class, 'data_source'])->name('admin.project_data_source'); |
| 131 | + Route::any('/get_process_records', [Aside\Project\ProjectController::class, 'get_process_records'])->name('admin.project_get_process_records'); | ||
| 132 | + Route::any('/save_process_records', [Aside\Project\ProjectController::class, 'save_process_records'])->name('admin.project_save_process_records'); | ||
| 122 | }); | 133 | }); |
| 123 | 134 | ||
| 124 | //工单管理 | 135 | //工单管理 |
-
请 注册 或 登录 后发表评论