ProcessRecordsLogic.php 889 字节
<?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('保存失败');
        }
    }
}