OnlineCheckLogic.php
1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\OnlineCheck;
class OnlineCheckLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new OnlineCheck();
}
public function onlineCheck($param){
$data = [
'project_id' => $param['id'],
$param['type'] . '_mid' => $param['manage_id'],
$param['type'] . '_check_time' => date('Y-m-d H:i:s'),
$param['type'] . '_status' => $param['status'],
'remark' => $param['remark'] ??'',
];
$info = $this->model->where('project_id', $data['project_id'])->first();
if(!$info){
$this->fail('项目未提交审核');
}
$data['id'] = $info['id'];
return $this->save($data);
}
/**
* @remark :提交审核
* @name :submitCheck
* @author :lyh
* @method :post
* @time :2023/7/31 11:06
*/
public function saveOnlineCheck(){
$info = $this->model->read(['project_id'=>$this->param['id']]);
if($info !== false){
$rs = $this->model->edit($this->param,['id'=>$info['id']]);
}else{
//组装数据
$data = [
'project_id' => $this->param['id'],
'created_manage_id' => $this->manager['id'],
'optimist_mid' => $this->param['optimist_mid'],
'created_at'=>date('Y-m-d H:i:s')
];
$rs = $this->model->add($data);
}
if($rs === false){
$this->fail('error');
}
return $this->success();
}
}