ProcessRecordsLogic.php
889 字节
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
<?php
namespace App\Http\Logic\Aside\Project;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Project\ProcessRecords;
class ProcessRecordsLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new ProcessRecords();
}
public function getInfo($project_id)
{
return $this->model->where('project_id', $project_id)->first();
}
public function save($param){
$info = $this->getInfo($param['project_id']);
if($info){
$this->model = $info;
}
$this->model->record = $param['record'];
$this->model->remark = $param['remark'];
$res = $this->model->save();
if($res){
return $this->success(['id' => $this->model->id]); //返回保存的数据id
}else{
$this->fail('保存失败');
}
}
}