正在显示
17 个修改的文件
包含
1012 行增加
和
1 行删除
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Console\Commands\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Models\Manage\Manage; | ||
| 6 | +use App\Models\Project\Project; | ||
| 7 | +use App\Models\WorkOrder\TicketProject; | ||
| 8 | +use Illuminate\Console\Command; | ||
| 9 | +use Illuminate\Support\Facades\Cache; | ||
| 10 | +use Illuminate\Support\Facades\Http; | ||
| 11 | + | ||
| 12 | +class FetchTicketProjects extends Command | ||
| 13 | +{ | ||
| 14 | + /** | ||
| 15 | + * The name and signature of the console command. | ||
| 16 | + * | ||
| 17 | + * @var string | ||
| 18 | + */ | ||
| 19 | + protected $signature = 'workorder:fetch-ticket-projects {version}'; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * The console command description. | ||
| 23 | + * | ||
| 24 | + * @var string | ||
| 25 | + */ | ||
| 26 | + protected $description = '同步V5,V6的项目到 gl_ticket_projects 表'; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * Create a new command instance. | ||
| 30 | + * | ||
| 31 | + * @return void | ||
| 32 | + */ | ||
| 33 | + public function __construct() | ||
| 34 | + { | ||
| 35 | + parent::__construct(); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * Execute the console command. | ||
| 40 | + * | ||
| 41 | + * @return int | ||
| 42 | + */ | ||
| 43 | + public function handle() | ||
| 44 | + { | ||
| 45 | + $version = $this->argument('version'); | ||
| 46 | + if ($version == 'v5') { | ||
| 47 | + $this->fetch_v5(); | ||
| 48 | + } elseif ($version == 'v6') { | ||
| 49 | + $this->fetch_v6(); | ||
| 50 | + } else { | ||
| 51 | + $this->error('Invalid action. Use "v5" or "v6".'); | ||
| 52 | + return 1; | ||
| 53 | + } | ||
| 54 | + return 0; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * @return void | ||
| 60 | + * 请求:https://www.quanqiusou.cn/extend_api/webs/globalso_all.php | ||
| 61 | + */ | ||
| 62 | + public function fetch_v5() | ||
| 63 | + { | ||
| 64 | + # pm 项目经理 assm 售后服务经理 | ||
| 65 | + $response = Http::get('https://www.quanqiusou.cn/extend_api/webs/globalso_all.php'); | ||
| 66 | + if ($response->status() == 200) { | ||
| 67 | + $items = $response->json(); | ||
| 68 | + foreach ($items as $item) { | ||
| 69 | + # V5: 版本号+postid | ||
| 70 | + $uuid = md5("V5{$item['postid']}"); | ||
| 71 | + $project = TicketProject::where('uuid', $uuid)->first(); | ||
| 72 | + | ||
| 73 | + $item['pm'] = $item['pm'] == '未安排' ? '杨长远' : $item['pm']; | ||
| 74 | + $item['assm'] = $item['assm'] == '未安排' ? '杨长远' : $item['assm']; | ||
| 75 | + | ||
| 76 | + // 如果 $item['cate'] 包含”推广“字符,则$engineer_name = $item['assm'] | ||
| 77 | + $engineer_name = (strpos($item['cate'], '推广') !== false) ? $item['assm'] : $item['pm']; | ||
| 78 | + | ||
| 79 | + $fields = [ | ||
| 80 | + 'post_id' => $item['postid'], | ||
| 81 | + 'company_name' => $item['company'], | ||
| 82 | + 'title' => $item['title'], | ||
| 83 | + 'engineer_id' => Manage::where('name', $engineer_name)->value('id') ?? 0, | ||
| 84 | + 'website' => $item['main_url'] ?? '', | ||
| 85 | + ]; | ||
| 86 | + if (!$project) { | ||
| 87 | + $new = new TicketProject(); | ||
| 88 | + $new->uuid = $uuid; | ||
| 89 | + $new->version = 5; | ||
| 90 | + $new->table_id = 0; | ||
| 91 | + foreach ($fields as $k => $v) { | ||
| 92 | + $new->$k = $v; | ||
| 93 | + } | ||
| 94 | + $new->save(); | ||
| 95 | + } else { | ||
| 96 | + $changed = false; | ||
| 97 | + foreach ($fields as $k => $v) { | ||
| 98 | + if ($project->$k != $v) { | ||
| 99 | + $project->$k = $v; | ||
| 100 | + $changed = true; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + if ($changed) { | ||
| 104 | + $project->save(); | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + echo "V5: {$item['postid']} - {$item['title']} - {$item['company']} - {$item['main_url']}\n"; | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + /** | ||
| 113 | + * @return void | ||
| 114 | + * 1. 按照ID升序查询 gl_project 表 limit 10 | ||
| 115 | + * 2。同步到 TicketProject 后,redis 缓存 ID | ||
| 116 | + */ | ||
| 117 | + public function fetch_v6() | ||
| 118 | + { | ||
| 119 | + while (true) { | ||
| 120 | + try { | ||
| 121 | + $lastid = Cache::store('redis')->get('fetch_v6_lastid', 0); | ||
| 122 | + $items = Project::where('id', '>', intval($lastid)) | ||
| 123 | + ->orderBy('id', 'asc') | ||
| 124 | + ->limit(10) | ||
| 125 | + ->get(); | ||
| 126 | + if ($items->isEmpty()) { | ||
| 127 | + echo "not found items \n"; | ||
| 128 | + break; | ||
| 129 | + } | ||
| 130 | + foreach ($items as $item) { | ||
| 131 | + $uuid = md5("V5{$item->id}"); | ||
| 132 | + $project = TicketProject::where('uuid', $uuid)->first(); | ||
| 133 | + if (!$project) { | ||
| 134 | + $project = new TicketProject(); | ||
| 135 | + $project->uuid = $uuid; | ||
| 136 | + $project->post_id = $item->post_id; | ||
| 137 | + $project->version = 6; | ||
| 138 | + $project->table_id = $item->id; | ||
| 139 | + $project->save(); | ||
| 140 | + Cache::store('redis')->put('fetch_v6_lastid', $item->id); | ||
| 141 | + } | ||
| 142 | + echo "V6: {$item->company}\n"; | ||
| 143 | + } | ||
| 144 | + }catch (\Exception $exception) { | ||
| 145 | + echo $exception; | ||
| 146 | + break; | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + } | ||
| 151 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Api\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Http\Controllers\Api\BaseController; | ||
| 6 | +use App\Http\Requests\Api\WorkOrder\TicketStoreRequest; | ||
| 7 | +use App\Models\WorkOrder\TicketLog; | ||
| 8 | +use App\Models\WorkOrder\TicketProject; | ||
| 9 | +use App\Models\WorkOrder\Tickets; | ||
| 10 | +use Illuminate\Http\Request; | ||
| 11 | +use Illuminate\Support\Facades\DB; | ||
| 12 | + | ||
| 13 | +class TicketController extends BaseController | ||
| 14 | +{ | ||
| 15 | + /** | ||
| 16 | + * Display a listing of the resource. | ||
| 17 | + * | ||
| 18 | + * @return \Illuminate\Http\Response | ||
| 19 | + */ | ||
| 20 | + public function index($project_id, Request $request) | ||
| 21 | + { | ||
| 22 | + $project = TicketProject::where('uuid', $project_id)->first(); | ||
| 23 | + if (!$project) return $this->error('未找到项目', 404); | ||
| 24 | + $page = (int)$request->input('page', 1); | ||
| 25 | + $size = (int)$request->input('size', 10); | ||
| 26 | + | ||
| 27 | + $tickets = Tickets::with([ | ||
| 28 | + 'project.projectV6:id,company,version', | ||
| 29 | + 'logs.engineer:id,name', | ||
| 30 | + ]) | ||
| 31 | + ->where('project_id', $project->id) | ||
| 32 | + ->orderBy('id', 'desc') | ||
| 33 | + ->paginate($size, ['*'], 'page', $page); | ||
| 34 | + return response()->json(['data' => $tickets]); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Store a newly created resource in storage. | ||
| 39 | + * | ||
| 40 | + * @param \Illuminate\Http\Request $request | ||
| 41 | + * @return \Illuminate\Http\Response | ||
| 42 | + * B端用户在企微群里提交工单 | ||
| 43 | + */ | ||
| 44 | + public function store($project_id, TicketStoreRequest $request) | ||
| 45 | + { | ||
| 46 | + $request->validated(); | ||
| 47 | + $project = TicketProject::where('uuid', $project_id)->first(); | ||
| 48 | + if (!$project) return $this->error('未找到项目', 404); | ||
| 49 | + if ($project->version == 6){ | ||
| 50 | + if ($project->project->projectV6->delete_status) return $this->error('该项目已被删除', 400); | ||
| 51 | + if ($project->project->projectV6->extend_type == 5) return $this->error('未续费', 400); | ||
| 52 | + if ($project->project->projectV6->type == 8) return $this->error('项目已归档', 400); | ||
| 53 | + if ($project->project->projectV6->site_status == 1) return $this->error('站点已关闭', 400); | ||
| 54 | + } | ||
| 55 | + $result = DB::transaction(function () use ($request, $project) { | ||
| 56 | + $ticket = new Tickets(); | ||
| 57 | + $ticket->project_id = $project->id; | ||
| 58 | + $ticket->title = $request->input('title'); | ||
| 59 | + $ticket->content = $request->input('content'); | ||
| 60 | + // $files = [NULL] | ||
| 61 | + $files = $request->input('files'); | ||
| 62 | + if (empty($files) || (is_array($files) && count(array_filter($files, function($v){ return !is_null($v); })) === 0)) { | ||
| 63 | + $ticket->files = null; | ||
| 64 | + } else { | ||
| 65 | + $ticket->files = json_encode($files); | ||
| 66 | + } | ||
| 67 | + $ticket->submit_side = 2; // 2 for B-side submission | ||
| 68 | + $ticket->submit_username = $request->input('submit_username'); | ||
| 69 | + $ticket->save(); | ||
| 70 | + $log = new TicketLog(); | ||
| 71 | + if ($project->version == 5){ | ||
| 72 | + # V5 | ||
| 73 | + $log->engineer_id = $project->engineer_id; | ||
| 74 | + }else{ | ||
| 75 | + # V6 的项目 | ||
| 76 | + if ($project->projectV6->type == 3){ | ||
| 77 | + // 项目类型是优化推广,项目负责人找优化 | ||
| 78 | + $seo = $project->projectV6->deploy_optimize; | ||
| 79 | + $log->engineer_id = $seo->manager_mid ?? $seo->optimist_mid ?? 0; | ||
| 80 | + }else{ | ||
| 81 | + // 非优化推广项目,项目负责人找技术组长 | ||
| 82 | + $build = $project->projectV6->deploy_build; | ||
| 83 | + $log->engineer_id = $build->leader_mid ?? 0; | ||
| 84 | + } | ||
| 85 | + } | ||
| 86 | + $ticket->logs()->save($log); | ||
| 87 | + return $ticket; | ||
| 88 | + }); | ||
| 89 | + return response()->json(['data' => $result]); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + /** | ||
| 93 | + * Display the specified resource. | ||
| 94 | + * | ||
| 95 | + * @param int $id | ||
| 96 | + * @return \Illuminate\Http\Response | ||
| 97 | + */ | ||
| 98 | + public function show($project_id, $id) | ||
| 99 | + { | ||
| 100 | + $ticket = Tickets::with([ | ||
| 101 | + 'logs.engineer:id,name', | ||
| 102 | + 'project.projectV6:id,company', | ||
| 103 | + ]) | ||
| 104 | + ->find($id); | ||
| 105 | + | ||
| 106 | + if (!$ticket) return $this->error('工单未找到', 404); | ||
| 107 | + | ||
| 108 | + if ($ticket->project->uuid !== $project_id) return $this->error('无权限查看该工单', 403); | ||
| 109 | + | ||
| 110 | + if ($ticket->project->version == 6){ | ||
| 111 | + if ($ticket->project->projectV6->delete_status) return $this->error('该项目已被删除', 400); | ||
| 112 | + if ($ticket->project->projectV6->extend_type == 5) return $this->error('未续费', 400); | ||
| 113 | + if ($ticket->project->projectV6->type == 8) return $this->error('项目已归档', 400); | ||
| 114 | + if ($ticket->project->projectV6->site_status == 1) return $this->error('站点已关闭', 400); | ||
| 115 | + } | ||
| 116 | + return response()->json(['data' => $ticket]); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + /** | ||
| 120 | + * Update the specified resource in storage. | ||
| 121 | + * | ||
| 122 | + * @param \Illuminate\Http\Request $request | ||
| 123 | + * @param int $id | ||
| 124 | + * @return \Illuminate\Http\Response | ||
| 125 | + */ | ||
| 126 | + public function update(Request $request, $id) | ||
| 127 | + { | ||
| 128 | + // | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * Remove the specified resource from storage. | ||
| 133 | + * | ||
| 134 | + * @param int $id | ||
| 135 | + * @return \Illuminate\Http\Response | ||
| 136 | + */ | ||
| 137 | + public function destroy($id) | ||
| 138 | + { | ||
| 139 | + // | ||
| 140 | + } | ||
| 141 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Aside\BaseController; | ||
| 7 | +use App\Http\Requests\Aside\WorkOrder\AsideTicketStoreRequest; | ||
| 8 | +use App\Http\Requests\Aside\WorkOrder\AsideTicketListRequest; | ||
| 9 | +use App\Http\Requests\Aside\WorkOrder\AsideTicketLogUpdateRequest; | ||
| 10 | +use App\Http\Requests\Aside\WorkOrder\AsideTicketUpdateRequest; | ||
| 11 | +use App\Models\WorkOrder\TicketLog; | ||
| 12 | +use App\Models\WorkOrder\TicketProject; | ||
| 13 | +use App\Models\WorkOrder\Tickets; | ||
| 14 | +use Illuminate\Http\Request; | ||
| 15 | +use Illuminate\Support\Facades\DB; | ||
| 16 | + | ||
| 17 | +class AsideTicketController extends BaseController | ||
| 18 | +{ | ||
| 19 | + /** | ||
| 20 | + * Display a listing of the resource. | ||
| 21 | + * | ||
| 22 | + * @return \Illuminate\Http\Response | ||
| 23 | + */ | ||
| 24 | + public function index(AsideTicketListRequest $request) | ||
| 25 | + { | ||
| 26 | + /** | ||
| 27 | + * 1. 超管看所有工单 | ||
| 28 | + * 2. 其他查看和自己有关的工单 | ||
| 29 | + */ | ||
| 30 | + $lists = TicketLog::with([ | ||
| 31 | + 'ticket.project.projectV6:id,company,title', | ||
| 32 | + 'ticket.logs.engineer:id,name', | ||
| 33 | + ]) | ||
| 34 | + ->when($this, function ($query) { | ||
| 35 | + $role = $this->manage['role']; | ||
| 36 | + // 超管 role = 1 | ||
| 37 | + if ($role == 1) { | ||
| 38 | + return $query; | ||
| 39 | + } | ||
| 40 | + // 其他角色查自己参与的工单 | ||
| 41 | + return $query->where('engineer_id', $this->manage['id']); | ||
| 42 | + }) | ||
| 43 | + ->when($request->input('project_id') !== null, function ($query) use ($request) { | ||
| 44 | + // project_id 查 gl_ticket_projects.uuid | ||
| 45 | + return $query->whereHas('ticket.project', function ($q) use ($request) { | ||
| 46 | + $q->where('uuid', $request->input('project_id')); | ||
| 47 | + }); | ||
| 48 | + }) | ||
| 49 | + ->when($request->input('status') !== null, function ($query) use ($request) { | ||
| 50 | + // status 查 gl_tickets.status | ||
| 51 | + return $query->whereHas('ticket', function ($q) use ($request) { | ||
| 52 | + $q->where('status', $request->input('status')); | ||
| 53 | + }); | ||
| 54 | + }) | ||
| 55 | + ->when($request->input('search'), function ($query) use ($request) { | ||
| 56 | + // search 查 gl_tickets.title 或 gl_ticket_projects.title 或 gl_ticket_projects.company_name | ||
| 57 | + $search = $request->input('search'); | ||
| 58 | + $query->where(function ($q) use ($search) { | ||
| 59 | + $q->whereHas('ticket', function ($q1) use ($search) { | ||
| 60 | + $q1->where('title', 'like', '%' . $search . '%'); | ||
| 61 | + }) | ||
| 62 | + ->orWhereHas('ticket.project', function ($q2) use ($search) { | ||
| 63 | + $q2->where('title', 'like', '%' . $search . '%') | ||
| 64 | + ->orWhere('company_name', 'like', '%' . $search . '%'); | ||
| 65 | + }); | ||
| 66 | + }); | ||
| 67 | + }) | ||
| 68 | + ->orderBy('id', 'desc') | ||
| 69 | + ->paginate($this->row, ['*'], 'page', $this->page); | ||
| 70 | + $this->response('success', Code::SUCCESS, $lists); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public function getProjects($search) | ||
| 74 | + { | ||
| 75 | + $projects = TicketProject::with([ | ||
| 76 | + 'projectV6:id,company,title', | ||
| 77 | + ]) | ||
| 78 | + ->where(function ($query) use ($search) { | ||
| 79 | + $query->where('title', 'like', '%' . $search . '%') | ||
| 80 | + ->orWhere('company_name', 'like', '%' . $search . '%') | ||
| 81 | + ->orWhereHas('projectV6', function ($q) use ($search) { | ||
| 82 | + $q->where('company', 'like', '%' . $search . '%') | ||
| 83 | + ->orWhere('title', 'like', '%' . $search . '%'); | ||
| 84 | + }); | ||
| 85 | + }) | ||
| 86 | + ->get(); | ||
| 87 | + $this->response('success', Code::SUCCESS, $projects); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + /** | ||
| 91 | + * Store a newly created resource in storage. | ||
| 92 | + * | ||
| 93 | + * @param \Illuminate\Http\Request $request | ||
| 94 | + * @return \Illuminate\Http\Response | ||
| 95 | + */ | ||
| 96 | + public function store(AsideTicketStoreRequest $request) | ||
| 97 | + { | ||
| 98 | + $request->validated(); | ||
| 99 | + $project = TicketProject::where('uuid', $request->input('project_id'))->first(); | ||
| 100 | + if ($project->version == 6){ | ||
| 101 | + if ($project->projectV6->delete_status) $this->response('该项目已被删除', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 102 | + if ($project->projectV6->extend_type == 5) $this->response('未续费', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 103 | + if ($project->projectV6->type == 8) $this->response('项目已归档', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 104 | + if ($project->projectV6->site_status == 1) $this->response('站点已关闭', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 105 | + } | ||
| 106 | + $result = DB::transaction(function () use ($request, $project) { | ||
| 107 | + $ticket = new Tickets(); | ||
| 108 | + $ticket->project_id = $project->id; | ||
| 109 | + $ticket->title = $request->input('title'); | ||
| 110 | + $ticket->content = $request->input('content'); | ||
| 111 | + // $files = [NULL] | ||
| 112 | + $files = $request->input('files'); | ||
| 113 | + if (empty($files) || (is_array($files) && count(array_filter($files, function($v){ return !is_null($v); })) === 0)) { | ||
| 114 | + $ticket->files = null; | ||
| 115 | + } else { | ||
| 116 | + $ticket->files = json_encode($files); | ||
| 117 | + } | ||
| 118 | + $ticket->submit_side = 1; // 1 for A-side submission | ||
| 119 | + $ticket->submit_user_id = $this->manage['id']; | ||
| 120 | + $ticket->submit_username = $this->manage['name']; | ||
| 121 | + $ticket->save(); | ||
| 122 | + // A 端提工单,都是针对客户提的需求等开发任务;比如翻译,修改页面等。。。 | ||
| 123 | + foreach ($request->input('engineer_ids', []) as $engineer_id) { | ||
| 124 | + $log = new TicketLog(); | ||
| 125 | + $log->engineer_id = $engineer_id; | ||
| 126 | + $ticket->logs()->save($log); | ||
| 127 | + } | ||
| 128 | + return $ticket; | ||
| 129 | + }); | ||
| 130 | + $this->response('success', Code::SUCCESS, $result->toArray()); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + /** | ||
| 134 | + * Display the specified resource. | ||
| 135 | + * | ||
| 136 | + * @param int $id | ||
| 137 | + * @return \Illuminate\Http\Response | ||
| 138 | + */ | ||
| 139 | + public function show($id) | ||
| 140 | + { | ||
| 141 | + $ticket = Tickets::with([ | ||
| 142 | + 'logs.engineer', | ||
| 143 | + 'project.projectV6:id,company,title', | ||
| 144 | + ])->find($id); | ||
| 145 | + | ||
| 146 | + if (!$ticket) $this->response('工单不存在', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 147 | + | ||
| 148 | + if ($this->manage['role'] != 1 | ||
| 149 | + && $ticket->submit_user_id != $this->manage['id'] | ||
| 150 | + && $ticket->logs()->where('engineer_id', $this->manage['id'])->count() == 0) | ||
| 151 | + // 只能查看自己的工单 | ||
| 152 | + $this->response('没有权限查看该工单', Code::USER_PERMISSION_ERROE); | ||
| 153 | + | ||
| 154 | + // TODO 判断是否有查看工单详情权限,待添加 | ||
| 155 | + $this->response('success', Code::SUCCESS, $ticket->toArray()); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * A端修改工单 | ||
| 160 | + * 1. 邀请协同的同事 | ||
| 161 | + * 2. 审核工单 | ||
| 162 | + */ | ||
| 163 | + public function update(AsideTicketUpdateRequest $request, $id) | ||
| 164 | + { | ||
| 165 | + $request->validated(); | ||
| 166 | + $ticket = Tickets::find($id); | ||
| 167 | + if (!$ticket) $this->response('工单不存在', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 168 | + // 检测修改权限 | ||
| 169 | + if ($ticket->submit_side == 1 && $ticket->submit_user_id != $this->manage['id']) { | ||
| 170 | + // A端提交的工单,只有提交人可以修改 | ||
| 171 | + $this->response('没有权限操作该工单', Code::USER_PERMISSION_ERROE); | ||
| 172 | + } elseif ($ticket->submit_side == 2) | ||
| 173 | + { | ||
| 174 | + // B端提交的工单,只有第一对接人可以修改 | ||
| 175 | + $log = $ticket->logs()->first(); | ||
| 176 | + if ($log->engineer_id != $this->manage['id']) | ||
| 177 | + $this->response('没有权限操作该工单', Code::USER_PERMISSION_ERROE); | ||
| 178 | + } | ||
| 179 | + | ||
| 180 | + // 开始修改 | ||
| 181 | + $result = DB::transaction(function () use ($request, $ticket) { | ||
| 182 | + if ($request->input('engineer_ids')) | ||
| 183 | + { | ||
| 184 | + // 有邀请工程师协同处理 | ||
| 185 | + foreach ($request->input('engineer_ids') as $engineer_id) | ||
| 186 | + { | ||
| 187 | + try { | ||
| 188 | + // 利用唯一索引去重 | ||
| 189 | + $new_log = new TicketLog(); | ||
| 190 | + $new_log->engineer_id = $engineer_id; | ||
| 191 | + $ticket->logs()->save($new_log); | ||
| 192 | + }catch (\Exception $exception){} | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + $ticket->reply = $request->input('reply', null); | ||
| 197 | + $ticket->status = $request->input('status', $ticket->status); | ||
| 198 | + $ticket->save(); | ||
| 199 | + if ($ticket->status == Tickets::STATUS_COMPLETED) | ||
| 200 | + { | ||
| 201 | + // 完成工单,把子任务里面未完成的工单改为完成 | ||
| 202 | + $ticket->end_at = now(); | ||
| 203 | + $ticket->logs()->where('status', '<', TicketLog::STATUS_COMPLETED) | ||
| 204 | + ->update(['status' => TicketLog::STATUS_COMPLETED, 'end_at' => now()]); | ||
| 205 | + } | ||
| 206 | + return $ticket; | ||
| 207 | + }); | ||
| 208 | + $this->response('success', Code::SUCCESS, $result->toArray()); | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + /** | ||
| 212 | + * Remove the specified resource from storage. | ||
| 213 | + * | ||
| 214 | + * @param int $id | ||
| 215 | + * @return \Illuminate\Http\Response | ||
| 216 | + */ | ||
| 217 | + public function destroy($id) | ||
| 218 | + { | ||
| 219 | + // | ||
| 220 | + } | ||
| 221 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Controllers\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Enums\Common\Code; | ||
| 6 | +use App\Http\Controllers\Aside\BaseController; | ||
| 7 | +use App\Http\Requests\Aside\WorkOrder\AsideTicketLogUpdateRequest; | ||
| 8 | +use App\Models\WorkOrder\TicketLog; | ||
| 9 | +use App\Models\WorkOrder\Tickets; | ||
| 10 | +use Illuminate\Http\Request; | ||
| 11 | +use Illuminate\Support\Facades\DB; | ||
| 12 | + | ||
| 13 | +class AsideTicketLogController extends BaseController | ||
| 14 | +{ | ||
| 15 | + /** | ||
| 16 | + * Display a listing of the resource. | ||
| 17 | + * | ||
| 18 | + * @return \Illuminate\Http\Response | ||
| 19 | + */ | ||
| 20 | + public function index() | ||
| 21 | + { | ||
| 22 | + // | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * Store a newly created resource in storage. | ||
| 27 | + * | ||
| 28 | + * @param \Illuminate\Http\Request $request | ||
| 29 | + * @return \Illuminate\Http\Response | ||
| 30 | + */ | ||
| 31 | + public function store(Request $request) | ||
| 32 | + { | ||
| 33 | + // | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * Display the specified resource. | ||
| 38 | + * | ||
| 39 | + * @param int $id | ||
| 40 | + * @return \Illuminate\Http\Response | ||
| 41 | + */ | ||
| 42 | + public function show($id) | ||
| 43 | + { | ||
| 44 | + // | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * A 端完结工单任务 | ||
| 49 | + */ | ||
| 50 | + public function update(AsideTicketLogUpdateRequest $request, $id) | ||
| 51 | + { | ||
| 52 | + $log = TicketLog::find($id); // 拆分的子工单 | ||
| 53 | + if (!$log) { | ||
| 54 | + $this->response('工单不存在', Code::USER_MODEL_NOTFOUND_ERROE); | ||
| 55 | + } | ||
| 56 | + if ($log->engineer_id != $this->manage['id']) { | ||
| 57 | + // 只能操作自己的工单 | ||
| 58 | + $this->response('没有权限操作该工单', Code::USER_PERMISSION_ERROE); | ||
| 59 | + } | ||
| 60 | + if ($log->status >= TicketLog::STATUS_COMPLETED) { | ||
| 61 | + // 已经完成的工单不能再操作 | ||
| 62 | + $this->response('工单已完成,不能再操作', Code::USER_PERMISSION_ERROE); | ||
| 63 | + } | ||
| 64 | + $ticket = $log->ticket; | ||
| 65 | + $result = DB::transaction(function () use ($request, $ticket, $log) { | ||
| 66 | + if ($request->input('status') !== null) | ||
| 67 | + { | ||
| 68 | + $log->status = $request->input('status'); | ||
| 69 | + if ($log->status >= TicketLog::STATUS_COMPLETED) | ||
| 70 | + { | ||
| 71 | + // 我的工单标记为已完成 | ||
| 72 | + $log->status = $request->input('status'); | ||
| 73 | + $log->end_at = now(); | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + $log->save(); | ||
| 77 | + // 是否有未完成的子任务 | ||
| 78 | + $pending = $ticket->logs() | ||
| 79 | + ->where('status', '<', TicketLog::STATUS_COMPLETED) | ||
| 80 | + ->count(); | ||
| 81 | + if ($pending) | ||
| 82 | + { | ||
| 83 | + $ticket->status = Tickets::STATUS_PROCESSING; | ||
| 84 | + }else | ||
| 85 | + { | ||
| 86 | + $ticket->status = Tickets::STATUS_COMPLETED; | ||
| 87 | + // 如果所有子任务都完成了,则将工单状态改为已完成 | ||
| 88 | + $ticket->end_at = now(); | ||
| 89 | + } | ||
| 90 | + $ticket->save(); | ||
| 91 | + return $log; | ||
| 92 | + }); | ||
| 93 | + $this->response('success', Code::SUCCESS, $result->toArray()); | ||
| 94 | + | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * Remove the specified resource from storage. | ||
| 99 | + * | ||
| 100 | + * @param int $id | ||
| 101 | + * @return \Illuminate\Http\Response | ||
| 102 | + */ | ||
| 103 | + public function destroy($id) | ||
| 104 | + { | ||
| 105 | + // | ||
| 106 | + } | ||
| 107 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Api\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +class TicketStoreRequest extends FormRequest | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Determine if the user is authorized to make this request. | ||
| 11 | + * | ||
| 12 | + * @return bool | ||
| 13 | + */ | ||
| 14 | + public function authorize() | ||
| 15 | + { | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Get the validation rules that apply to the request. | ||
| 21 | + * | ||
| 22 | + * @return array | ||
| 23 | + */ | ||
| 24 | + public function rules() | ||
| 25 | + { | ||
| 26 | + return [ | ||
| 27 | + 'title' => 'required|string', | ||
| 28 | + 'content' => 'required|string', | ||
| 29 | + 'files' => 'nullable|array', | ||
| 30 | + 'submit_username' => 'required|string', | ||
| 31 | + ]; | ||
| 32 | + } | ||
| 33 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +class AsideTicketListRequest extends FormRequest | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Determine if the user is authorized to make this request. | ||
| 11 | + * | ||
| 12 | + * @return bool | ||
| 13 | + */ | ||
| 14 | + public function authorize() | ||
| 15 | + { | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Get the validation rules that apply to the request. | ||
| 21 | + * | ||
| 22 | + * @return array | ||
| 23 | + */ | ||
| 24 | + public function rules() | ||
| 25 | + { | ||
| 26 | + return [ | ||
| 27 | + 'project_id' => 'nullable|string', // 产品ID | ||
| 28 | + 'status' => 'nullable|in:0,1,2,3|integer', | ||
| 29 | + 'search' => 'nullable|string', // 搜索关键词 | ||
| 30 | + 'page' => 'nullable|integer', | ||
| 31 | + 'size' => 'nullable|integer', | ||
| 32 | + ]; | ||
| 33 | + } | ||
| 34 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +class AsideTicketLogUpdateRequest extends FormRequest | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Determine if the user is authorized to make this request. | ||
| 11 | + * | ||
| 12 | + * @return bool | ||
| 13 | + */ | ||
| 14 | + public function authorize() | ||
| 15 | + { | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Get the validation rules that apply to the request. | ||
| 21 | + * | ||
| 22 | + * @return array | ||
| 23 | + */ | ||
| 24 | + public function rules() | ||
| 25 | + { | ||
| 26 | + return [ | ||
| 27 | + 'status' => 'required|in:0,1,2,3|integer', | ||
| 28 | + 'reply' => 'nullable|string', | ||
| 29 | + ]; | ||
| 30 | + } | ||
| 31 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +class AsideTicketStoreRequest extends FormRequest | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Determine if the user is authorized to make this request. | ||
| 11 | + * | ||
| 12 | + * @return bool | ||
| 13 | + */ | ||
| 14 | + public function authorize() | ||
| 15 | + { | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Get the validation rules that apply to the request. | ||
| 21 | + * | ||
| 22 | + * @return array | ||
| 23 | + */ | ||
| 24 | + public function rules() | ||
| 25 | + { | ||
| 26 | + return [ | ||
| 27 | + 'project_id' => 'required|exists:gl_ticket_projects,uuid', | ||
| 28 | + 'title' => 'required|string', | ||
| 29 | + 'content' => 'required|string', | ||
| 30 | + 'files' => 'nullable|array', | ||
| 31 | + 'engineer_ids' => 'array', | ||
| 32 | + ]; | ||
| 33 | + } | ||
| 34 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Http\Requests\Aside\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Foundation\Http\FormRequest; | ||
| 6 | + | ||
| 7 | +class AsideTicketUpdateRequest extends FormRequest | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Determine if the user is authorized to make this request. | ||
| 11 | + * | ||
| 12 | + * @return bool | ||
| 13 | + */ | ||
| 14 | + public function authorize() | ||
| 15 | + { | ||
| 16 | + return true; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * Get the validation rules that apply to the request. | ||
| 21 | + * | ||
| 22 | + * @return array | ||
| 23 | + */ | ||
| 24 | + public function rules() | ||
| 25 | + { | ||
| 26 | + return [ | ||
| 27 | + 'status' => 'nullable|in:0,1,2,3|integer', | ||
| 28 | + 'reply' => 'nullable|string', | ||
| 29 | + 'engineer_ids' => 'nullable|array', | ||
| 30 | + ]; | ||
| 31 | + } | ||
| 32 | +} |
app/Models/WorkOrder/TicketLog.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Models\Manage\Manage; | ||
| 6 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
| 7 | +use Illuminate\Database\Eloquent\Model; | ||
| 8 | + | ||
| 9 | +class TicketLog extends Model | ||
| 10 | +{ | ||
| 11 | + use HasFactory; | ||
| 12 | + | ||
| 13 | + protected $table = 'gl_ticket_logs'; | ||
| 14 | + | ||
| 15 | + const STATUS_PEDDING = 0; // 待处理 | ||
| 16 | + const STATUS_PROCESSING = 1; // 处理中 | ||
| 17 | + const STATUS_COMPLETED = 2; // 已完成 | ||
| 18 | + const STATUS_CLOSED = 3; // 已关闭 | ||
| 19 | + | ||
| 20 | + public function engineer() | ||
| 21 | + { | ||
| 22 | + return $this->belongsTo(Manage::class, 'engineer_id', 'id') | ||
| 23 | + ->select(['id', 'name']); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + public function ticket() | ||
| 27 | + { | ||
| 28 | + return $this->belongsTo(Tickets::class, 'ticket_id', 'id'); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
app/Models/WorkOrder/TicketProject.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\WorkOrder; | ||
| 4 | + | ||
| 5 | +use App\Models\Manage\Manage; | ||
| 6 | +use App\Models\Project\Project; | ||
| 7 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
| 8 | +use Illuminate\Database\Eloquent\Model; | ||
| 9 | + | ||
| 10 | +class TicketProject extends Model | ||
| 11 | +{ | ||
| 12 | + use HasFactory; | ||
| 13 | + | ||
| 14 | + protected $table = 'gl_ticket_projects'; | ||
| 15 | + | ||
| 16 | + public function projectV6() | ||
| 17 | + { | ||
| 18 | + return $this->hasOne(Project::class, 'id', 'table_id') | ||
| 19 | + ->where('version', 6); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} |
app/Models/WorkOrder/Tickets.php
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Models\WorkOrder; | ||
| 4 | + | ||
| 5 | +use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
| 6 | +use Illuminate\Database\Eloquent\Model; | ||
| 7 | + | ||
| 8 | +class Tickets extends Model | ||
| 9 | +{ | ||
| 10 | + use HasFactory; | ||
| 11 | + | ||
| 12 | + protected $table = 'gl_tickets'; | ||
| 13 | + | ||
| 14 | + const STATUS_PEDDING = 0; // 待处理 | ||
| 15 | + const STATUS_PROCESSING = 1; // 处理中 | ||
| 16 | + const STATUS_COMPLETED = 2; // 已完成 | ||
| 17 | + const STATUS_CLOSED = 3; // 已关闭 | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * @return void | ||
| 21 | + * 关联的工单日志 | ||
| 22 | + */ | ||
| 23 | + public function logs() | ||
| 24 | + { | ||
| 25 | + return $this->hasMany(TicketLog::class, 'ticket_id', 'id'); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 关联项目 | ||
| 30 | + */ | ||
| 31 | + public function project() | ||
| 32 | + { | ||
| 33 | + return $this->belongsTo(TicketProject::class, 'project_id', 'id'); | ||
| 34 | + } | ||
| 35 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use Illuminate\Database\Migrations\Migration; | ||
| 4 | +use Illuminate\Database\Schema\Blueprint; | ||
| 5 | +use Illuminate\Support\Facades\Schema; | ||
| 6 | + | ||
| 7 | +class CreateTicketProjectsTable extends Migration | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Run the migrations. | ||
| 11 | + * | ||
| 12 | + * @return void | ||
| 13 | + */ | ||
| 14 | + public function up() | ||
| 15 | + { | ||
| 16 | + Schema::create('gl_ticket_projects', function (Blueprint $table) { | ||
| 17 | + $table->id(); | ||
| 18 | + $table->integer('post_id')->index(); | ||
| 19 | + $table->integer('version')->default(5)->comment('版本号: 5, 6'); | ||
| 20 | + $table->integer('table_id')->index()->comment('来源表ID'); | ||
| 21 | + $table->string('uuid', 32)->unique()->comment('项目链接唯一标识符'); | ||
| 22 | + $table->string('company_name')->nullable()->index()->comment('公司名称'); | ||
| 23 | + $table->string('title')->nullable()->index()->comment('项目标题'); | ||
| 24 | + $table->bigInteger('engineer_id')->default(0)->index()->comment('V5项目的第一负责人 gl_manage 表ID'); | ||
| 25 | + $table->string('website')->nullable()->index()->comment('站点域名'); | ||
| 26 | + $table->timestamps(); | ||
| 27 | + }); | ||
| 28 | + \Illuminate\Support\Facades\DB::statement("ALTER TABLE `gl_ticket_projects` comment '售后工单项目整合表V5,V6'"); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Reverse the migrations. | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + */ | ||
| 36 | + public function down() | ||
| 37 | + { | ||
| 38 | + Schema::dropIfExists('gl_ticket_projects'); | ||
| 39 | + } | ||
| 40 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use Illuminate\Database\Migrations\Migration; | ||
| 4 | +use Illuminate\Database\Schema\Blueprint; | ||
| 5 | +use Illuminate\Support\Facades\Schema; | ||
| 6 | + | ||
| 7 | +class CreateTicketsTable extends Migration | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Run the migrations. | ||
| 11 | + * | ||
| 12 | + * @return void | ||
| 13 | + */ | ||
| 14 | + public function up() | ||
| 15 | + { | ||
| 16 | + Schema::create('gl_tickets', function (Blueprint $table) { | ||
| 17 | + $table->id(); | ||
| 18 | + $table->foreignId('project_id')->constrained('gl_ticket_projects')->onDelete('cascade')->comment('项目ID'); | ||
| 19 | + $table->string('title')->nullable()->comment('工单类型,工单标题'); | ||
| 20 | + $table->longText('content')->comment('工单图文描述'); | ||
| 21 | + $table->json('files')->nullable()->comment('附件'); | ||
| 22 | + $table->integer('status')->index()->default(0)->comment('工单状态,0:待处理, 1:处理中,2:已完成, 3:已关闭'); | ||
| 23 | + $table->integer('submit_side')->default(1)->index()->comment('提交方,1: A端, 2: B端'); | ||
| 24 | + $table->string('submit_username')->nullable()->comment('提交人姓名,B端在企微群提交时,留个姓名即可'); | ||
| 25 | + $table->integer('submit_user_id')->default(0)->index()->comment('A端提交时,提交人 gl_manage ID'); | ||
| 26 | + $table->timestamp('end_at')->nullable()->comment('结束时间,工单状态为已完成或已关闭时有值'); | ||
| 27 | + $table->longText('reply')->nullable()->comment('回复内容,审核意见,可以为空'); | ||
| 28 | + $table->timestamps(); | ||
| 29 | + }); | ||
| 30 | + \Illuminate\Support\Facades\DB::statement("ALTER TABLE `gl_tickets` comment '工单表,注意:B端,A端都会提工单'"); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * Reverse the migrations. | ||
| 35 | + * | ||
| 36 | + * @return void | ||
| 37 | + */ | ||
| 38 | + public function down() | ||
| 39 | + { | ||
| 40 | + Schema::dropIfExists('gl_tickets'); | ||
| 41 | + } | ||
| 42 | +} |
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +use Illuminate\Database\Migrations\Migration; | ||
| 4 | +use Illuminate\Database\Schema\Blueprint; | ||
| 5 | +use Illuminate\Support\Facades\Schema; | ||
| 6 | + | ||
| 7 | +class CreateTicketLogsTable extends Migration | ||
| 8 | +{ | ||
| 9 | + /** | ||
| 10 | + * Run the migrations. | ||
| 11 | + * | ||
| 12 | + * @return void | ||
| 13 | + */ | ||
| 14 | + public function up() | ||
| 15 | + { | ||
| 16 | + Schema::create('gl_ticket_logs', function (Blueprint $table) { | ||
| 17 | + $table->id(); | ||
| 18 | + $table->foreignId('ticket_id')->constrained('gl_tickets')->onDelete('cascade')->comment('工单ID'); | ||
| 19 | + $table->unsignedInteger('engineer_id')->comment('处理人 gl_manage ID'); | ||
| 20 | + $table->foreign('engineer_id')->references('id')->on('gl_manage')->onDelete('cascade'); | ||
| 21 | + $table->longText('reply')->nullable()->comment('回复内容可以为空'); | ||
| 22 | + $table->integer('status')->default(0)->index()->comment('工单状态,0:待处理, 1:处理中,2:已完成, 3:已关闭'); | ||
| 23 | + $table->boolean('ding')->default(false)->index()->comment('钉钉通知'); | ||
| 24 | + $table->timestamp('end_at')->nullable()->comment('结束时间,工单状态为已完成或已关闭时有值'); | ||
| 25 | + $table->unique(['ticket_id', 'engineer_id'], 'ticket_engineer_unique'); # 唯一索引,防止同一工单被同一人多次操作,同一工单,可以多人协作 | ||
| 26 | + $table->timestamps(); | ||
| 27 | + }); | ||
| 28 | + \Illuminate\Support\Facades\DB::statement("ALTER TABLE `gl_ticket_logs` comment '工单操作日志表,记录工单的分配处理任务等'"); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * Reverse the migrations. | ||
| 33 | + * | ||
| 34 | + * @return void | ||
| 35 | + */ | ||
| 36 | + public function down() | ||
| 37 | + { | ||
| 38 | + Schema::dropIfExists('gl_ticket_logs'); | ||
| 39 | + } | ||
| 40 | +} |
| @@ -75,4 +75,11 @@ Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateControll | @@ -75,4 +75,11 @@ Route::post('/inquiry_relate_domain', [\App\Http\Controllers\Api\PrivateControll | ||
| 75 | Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']); | 75 | Route::get('/get_manage_by_domain', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectManageByDomain']); |
| 76 | 76 | ||
| 77 | // 获取信息通过商户号 | 77 | // 获取信息通过商户号 |
| 78 | -Route::any('/get_project_by_mch_id', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectByMchId']); | ||
| 78 | +Route::any('/get_project_by_mch_id', [\App\Http\Controllers\Api\PrivateController::class, 'getProjectByMchId']); | ||
| 79 | + | ||
| 80 | +// B端,渠道在企微群操作-售后工单 | ||
| 81 | +Route::prefix('tickets')->group(function () { | ||
| 82 | + Route::get('/{project_id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'index'])->summary('B端,渠道-工单列表')->name('tickets.list'); | ||
| 83 | + Route::post('/{project_id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'store'])->summary('B端,渠道-提工单')->name('tickets.store'); | ||
| 84 | + Route::get('/{project_id}/{id}', [\App\Http\Controllers\Api\WorkOrder\TicketController::class, 'show'])->summary('B端,渠道-工单详情')->name('tickets.show'); | ||
| 85 | +}); |
| @@ -253,6 +253,16 @@ Route::middleware(['aloginauth'])->group(function () { | @@ -253,6 +253,16 @@ Route::middleware(['aloginauth'])->group(function () { | ||
| 253 | Route::get('/{id}', [Aside\WorkOrder\WorkOrderController::class, 'show'])->name('admin.workorder.show')->summary('A端工单详情'); | 253 | Route::get('/{id}', [Aside\WorkOrder\WorkOrderController::class, 'show'])->name('admin.workorder.show')->summary('A端工单详情'); |
| 254 | Route::post('/{id}', [Aside\WorkOrder\WorkOrderController::class, 'update'])->name('admin.workorder.update')->summary('A端更新工单'); | 254 | Route::post('/{id}', [Aside\WorkOrder\WorkOrderController::class, 'update'])->name('admin.workorder.update')->summary('A端更新工单'); |
| 255 | }); | 255 | }); |
| 256 | + // 售后工单改版 | ||
| 257 | + Route::prefix('tickets')->group(function () { | ||
| 258 | + Route::get('/', [Aside\WorkOrder\AsideTicketController::class, 'index'])->name('admin.tickets.index')->summary('A端工单列表'); | ||
| 259 | + Route::post('/', [Aside\WorkOrder\AsideTicketController::class, 'store'])->name('admin.tickets.store')->summary('A端创建工单'); | ||
| 260 | + Route::get('/{id}', [Aside\WorkOrder\AsideTicketController::class, 'show'])->name('admin.tickets.show')->summary('A端工单详情'); | ||
| 261 | + Route::post('/{id}', [Aside\WorkOrder\AsideTicketController::class, 'update'])->name('admin.tickets.update')->summary('A端更新工单,审核,邀请同事'); | ||
| 262 | + Route::get('/projects/{search}', [Aside\WorkOrder\AsideTicketController::class, 'getProjects'])->name('admin.tickets.projects')->summary('A端V5V6项目列表'); | ||
| 263 | + Route::post('/log/{id}', [Aside\WorkOrder\AsideTicketLogController::class, 'update'])->name('admin.tickets.log.update')->summary('A端工单操作日志更新,完成工单'); | ||
| 264 | + }); | ||
| 265 | + | ||
| 256 | //服务器配置 | 266 | //服务器配置 |
| 257 | Route::prefix('devops')->group(function () { | 267 | Route::prefix('devops')->group(function () { |
| 258 | Route::any('/', [Aside\Devops\ServerConfigController::class, 'lists'])->name('admin.devops.lists'); | 268 | Route::any('/', [Aside\Devops\ServerConfigController::class, 'lists'])->name('admin.devops.lists'); |
-
请 注册 或 登录 后发表评论