* adjust for async send webhook.

This commit is contained in:
z
2020-09-02 12:18:47 +08:00
parent a9df6f3b9c
commit 6e576929b7
2 changed files with 19 additions and 1 deletions
+17 -1
View File
@@ -118,7 +118,9 @@ class webhookModel extends model
*/
public function getDataList()
{
return $this->dao->select('*')->from(TABLE_NOTIFY)->where('status')->eq('wait')->andWhere('objectType')->eq('webhook')->orderBy('id')->fetchAll('id');
$dataList = $this->dao->select('*')->from(TABLE_NOTIFY)->where('status')->eq('wait')->andWhere('objectType')->eq('webhook')->orderBy('id')->fetchAll('id');
$dataList += $this->dao->select('*')->from(TABLE_NOTIFY)->where('status')->eq('senting')->andWhere('sendTime')->ge(date('Y-m-d H:i:s', time() - 3 * 3600))->andWhere('objectType')->eq('webhook')->orderBy('id')->fetchAll('id');
return $dataList;
}
/**
@@ -675,4 +677,18 @@ class webhookModel extends model
$this->dao->insert(TABLE_LOG)->data($log)->exec();
return !dao::isError();
}
/**
* Set sent status.
*
* @param array $idList
* @param string $status
* @access public
* @return void
*/
public function setSentStatus($idList, $status)
{
$now = helper::now();
$this->dao->update(TABLE_NOTIFY)->set('status')->eq($status)->set('sendTime')->eq($now)->where('id')->id($idList)->exec();
}
}