This commit is contained in:
mkm 2024-01-08 14:56:47 +08:00
parent 99e271bc31
commit 931805aa1e

View File

@ -21,22 +21,6 @@ class Task extends CommonModel
{
protected $append = ['priText', 'statusText', 'liked', 'stared', 'tags', 'childCount', 'hasUnDone', 'parentDone', 'hasComment', 'hasSource', 'canRead'];
public function getExchangeListAttr($value)
{
if($value){
return explode(',',$value);
}else{
return[];
}
}
public function getTransferredtAttr($value)
{
if($value){
return explode(',',$value);
}else{
return[];
}
}
public function read($code)
{
if (!$code) {
@ -251,7 +235,7 @@ class Task extends CommonModel
* @throws DbException
* @throws ModelNotFoundException
*/
public function createTask($stageCode, $projectCode, $name, $memberCode, $assignTo = '', $parentCode = '', $pri = '', $description = '', $tagCodes = [], $beginTime = '', $endTime = '',$data)
public function createTask($stageCode, $projectCode, $name, $memberCode, $assignTo = '', $parentCode = '', $pri = '', $description = '', $tagCodes = [], $beginTime = '', $endTime = '',$data=[])
{
if (!$name) {
return error(1, '请填写任务标题');
@ -456,7 +440,20 @@ class Task extends CommonModel
if (!$taskCode) {
throw new Exception('请选择任务', 1);
}
$task = self::where(['code' => $taskCode])->find();
$task = self::where(['code' => $taskCode])->withAttr('exchange_list', function($value) {
if($value){
return explode(',',$value);
}else{
return [];
}
})->withAttr('transferred', function($value) {
if($value){
return explode(',',$value);
}else{
return [];
}
})
->find();
if (!$task) {
throw new Exception('任务已失效', 2);
}