|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @remark :
|
|
|
|
* @name :Project5CateController.php
|
|
|
|
* @name :Ticket5UploadDataController.php
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/11/8 09:35
|
|
...
|
...
|
@@ -15,7 +15,7 @@ use App\Models\Ticket\Project5Cate; |
|
|
|
use App\Models\WorkOrder\TicketProject;
|
|
|
|
use Illuminate\Support\Facades\Http;
|
|
|
|
|
|
|
|
class Project5CateController extends BaseController
|
|
|
|
class Ticket5UploadDataController extends BaseController
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @remark :获取对应项目的分类
|
|
...
|
...
|
@@ -34,7 +34,7 @@ class Project5CateController extends BaseController |
|
|
|
]);
|
|
|
|
//查询是否有值
|
|
|
|
$project5CateModel = new Project5Cate();
|
|
|
|
$cateInfo = $project5CateModel->read(['project_id' => $this->param['post_id'],'type'=>$this->param['type'],'updated_at'=>['>', date('Y-m-d H:i:s', strtotime('-48 hours'))]]);
|
|
|
|
$cateInfo = $project5CateModel->read(['project_id' => $this->param['post_id'],'type'=>$this->param['type'],'updated_at'=>['>', date('Y-m-d H:i:s', strtotime('-24 hours'))]]);
|
|
|
|
if($cateInfo !== false){
|
|
|
|
$resultData = $cateInfo['text'];
|
|
|
|
$this->response('success', Code::SUCCESS, $resultData);
|
|
...
|
...
|
@@ -125,4 +125,68 @@ class Project5CateController extends BaseController |
|
|
|
}
|
|
|
|
$this->response('请求失败',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :提交数据
|
|
|
|
* @name :save
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/11/10 11:01
|
|
|
|
*/
|
|
|
|
public function save()
|
|
|
|
{
|
|
|
|
$this->request->validate([
|
|
|
|
'post_id' => 'required',
|
|
|
|
'type' => 'required',
|
|
|
|
'text' => 'required'
|
|
|
|
], [
|
|
|
|
'post_od.required' => 'project_id不能为空',
|
|
|
|
'type.required' => '上传类型不能为空',
|
|
|
|
'text' => '数据详情不为空'
|
|
|
|
]);
|
|
|
|
if(empty($this->param['text']['image'])){
|
|
|
|
$this->response('参数错误',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
if(empty($this->param['text']['title'])){
|
|
|
|
$this->response('参数错误,标题不能为空',Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
//验证当前数据是否已提交
|
|
|
|
$this->param['text'] = json_encode($this->param['text'], true);
|
|
|
|
$this->pushTicketByBots($this->param['post_id'],$this->param['type']);
|
|
|
|
if(isset($this->param['id']) && !empty($this->param['id'])){
|
|
|
|
//执行编辑
|
|
|
|
$info = $this->model->read(['id'=>$this->param['id']]);
|
|
|
|
if($info['status'] == 0){
|
|
|
|
$this->model->edit($this->param,['id'=>$this->param['id']]);
|
|
|
|
}else{
|
|
|
|
$this->response('当前状态不允许编辑', Code::SYSTEM_ERROR);
|
|
|
|
}
|
|
|
|
$this->response('success');
|
|
|
|
}else{
|
|
|
|
$info = $this->model->read(['project_id' => $this->param['project_id'], 'type' => $this->param['type'], 'text' => $this->param['text'], 'status' => 0]);
|
|
|
|
if ($info === false) {
|
|
|
|
$id = $this->model->addReturnId($this->param);
|
|
|
|
} else {
|
|
|
|
$id = $info['id'];
|
|
|
|
}
|
|
|
|
$data = ['id' => $id];
|
|
|
|
$this->response('success', Code::SUCCESS, $data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :钉钉通知
|
|
|
|
* @name :pushTicketByBots
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/11/10 11:10
|
|
|
|
*/
|
|
|
|
public function pushTicketByBots($post_id,$type = 1)
|
|
|
|
{
|
|
|
|
$project = TicketProject::where('post_id', $post_id)->where('project_cate',$type)->where('is_del', 0)->first();
|
|
|
|
if (!$project){
|
|
|
|
return response()->json(['message' => '未找到对应的工单项目'], 404);
|
|
|
|
}
|
|
|
|
return $project->pushWechatGroupMsg("您好,用户已上传数据,请审核!");
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|