WokerTask/app/common/model/task_template/TaskTemplate.php

60 lines
1.9 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_template;
use app\common\model\auth\Admin;
use app\common\model\BaseModel;
use app\common\model\Company;
use app\common\model\dict\DictData;
use think\model\concern\SoftDelete;
/**
* 任务模板模型
* Class TaskTemplate
* @package app\common\model\task_template
*/
class TaskTemplate extends BaseModel
{
use SoftDelete;
protected $name = 'task_template';
protected $deleteTime = 'delete_time';
public function admin()
{
return $this->hasOne(Admin::class, 'id', 'admin_id')->bind(['admin_name'=>'name']);
}
public function company()
{
return $this->hasOne(Company::class, 'id', 'company_id')->field('id,day_count,user_id');
}
public function dataType()
{
return $this->hasOne(DictData::class, 'id', 'type')->bind(['type_name'=>'name']);
}
public function getExtendAttr($value){
if($value==null){
return [];
}else{
return json_decode($value,true);
}
}
public function updateTransactionPool($id, $transactionPool)
{
return TaskTemplate::where('id', $id)->save(['transaction_pool' => $transactionPool]);
}
}