This commit is contained in:
xushenjie
2023-04-28 03:07:15 +00:00
4 changed files with 17 additions and 8 deletions
+4 -4
View File
@@ -286,7 +286,7 @@ class todo extends control
}
/**
* 开启一个待办事项
* 开启待办事项
* Start a todo.
*
* @param string $todoID
@@ -296,7 +296,7 @@ class todo extends control
public function start(string $todoID)
{
$todoID = (int)$todoID;
$todo = $this->todo->getById($todoID);
$todo = $this->todo->getByID($todoID);
if($todo->status == 'wait') $this->todo->start($todoID);
if(in_array($todo->type, array('bug', 'task', 'story'))) return $this->todoZen->printConfirm($todo);
@@ -307,7 +307,7 @@ class todo extends control
/**
* 激活待办事项
* Activated todo.
* Activated a todo.
*
* @param string $todoID
* @access public
@@ -316,7 +316,7 @@ class todo extends control
public function activate(string $todoID)
{
$todoID = (int)$todoID;
$todo = $this->todo->getById($todoID);
$todo = $this->todo->getByID($todoID);
if($todo->status == 'done' or $todo->status == 'closed') $this->todo->activate($todoID);
if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success'));
+11 -4
View File
@@ -230,8 +230,8 @@ class todoModel extends model
}
/**
* 开启一个待办事项
* Start one todo.
* 开启待办事项
* Start a todo.
*
* @param int $todoID
* @access public
@@ -277,6 +277,7 @@ class todoModel extends model
}
/**
* 获取待办事项详情数据
* Get info of a todo.
*
* @param int $todoID
@@ -284,9 +285,13 @@ class todoModel extends model
* @access public
* @return object|false
*/
<<<<<<< Updated upstream
public function getByID(int $todoID, $setImgSize = false): object|false
=======
public function getByID(int $todoID, bool $setImgSize = false): object|bool
>>>>>>> Stashed changes
{
$todo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch();
$todo = $this->dao->findById($todoID)->from(TABLE_TODO)->fetch();
if(!$todo) return false;
$todo = $this->loadModel('file')->replaceImgURL((object)$todo, 'desc');
@@ -301,6 +306,7 @@ class todoModel extends model
if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_TESTTASK)->fetch('name');
if($todo->type == 'feedback') $todo->name = $this->dao->findById($todo->objectID)->from(TABLE_FEEDBACK)->fetch('title');
$todo->date = str_replace('-', '', $todo->date);
return $todo;
}
@@ -527,7 +533,7 @@ class todoModel extends model
/**
* 激活待办事项
* Activate todo.
* Activated a todo.
*
* @param int $todoID
* @access public
@@ -537,6 +543,7 @@ class todoModel extends model
{
$this->dao->update(TABLE_TODO)->set('status')->eq('wait')->where('id')->eq($todoID)->exec();
$this->loadModel('action')->create('todo', $todoID, 'activated', '', 'wait');
return !dao::isError();
}
+1
View File
@@ -9,6 +9,7 @@ function initData()
$todo = zdTable('todo');
$todo->id->range('1-3');
$todo->account->prefix('admin')->range('1-3');
$todo->date->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD');
$todo->begin->range('1710');
$todo->end->range('1740');
$todo->feedback->range('0');
+1
View File
@@ -9,6 +9,7 @@ function initData()
$todo = zdTable('todo');
$todo->id->range('1-3');
$todo->account->prefix('admin')->range('1-3');
$todo->date->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD');
$todo->begin->range('1710');
$todo->end->range('1740');
$todo->feedback->range('0');