WokerTask/app/common/model/task_scheduling_plan/TaskSchedulingPlan.php

63 lines
2.1 KiB
PHP
Raw Normal View History

2023-12-27 14:06:33 +08:00
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model\task_scheduling_plan;
use app\common\model\BaseModel;
use app\common\model\Company;
use app\common\model\task_scheduling\TaskScheduling;
use app\common\model\task_template\TaskTemplate;
use app\common\model\user\User;
use think\model\concern\SoftDelete;
/**
* 任务排期日历模型
* Class TaskSchedulingPlan
* @package app\common\model\task_scheduling_plan
*/
class TaskSchedulingPlan extends BaseModel
{
use SoftDelete;
protected $name = 'task_scheduling_plan';
protected $deleteTime = 'delete_time';
public function getStartTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
public function getEndTimeAttr($value)
{
return date('Y-m-d H:i:s', $value);
}
public function template()
{
return $this->hasOne(TaskTemplate::class, 'id', 'template_id')->bind(['template_name'=>'title']);
}
public function templateInfo()
{
return $this->hasOne(TaskTemplate::class, 'id', 'template_id');
}
public function company()
{
return $this->hasOne(Company::class, 'id', 'company_id')->field('id,day_count,user_id');
}
public function scheduling(){
return $this->hasOne(TaskScheduling::class,'id','scheduling_id');
}
public function settlement($id=0){
TaskSchedulingPlan::where('id', $id)->update(['is_pay' => 1]);
}
}