array( 'desc' => '等待发送', 'kw' => 'STATUS_WAIT_SEND', ), self::STATUS_SEND_SUCCESS => array( 'desc' => '发送成功', 'kw' => 'STATUS_SEND_SUCCESS', ), self::STATUS_SEND_FAIL => array( 'desc' => '发送失败', 'kw' => 'STATUS_SEND_FAIL', ), self::STATUS_SEND_DONE => array( 'desc' => '发送完成', 'kw' => 'STATUS_SEND_DONE', ), self::STATUS_CLOSED_SEND => array( 'desc' => '取消发送', 'kw' => 'STATUS_CLOSED_SEND', ), ); static public function getsStatusDesc() { return self::$statusDesc; } /** * * 置为“等待发送” * @param int $id * @return boolean */ public function setWaitSend($id) { $statusCondition = array(self::STATUS_CLOSED_SEND); return $this->updateStatus($id, self::STATUS_WAIT_SEND, $statusCondition); } /** * * 置为“取消发送” * @param int $id * @return boolean */ public function setClosedSend($id) { $statusCondition = array(self::STATUS_WAIT_SEND); return $this->updateStatus($id, self::STATUS_CLOSED_SEND, $statusCondition); } public function updateStatus($id, $status, array $statusCondition = null) { if (!Verify::unsignedInt($id)) { return false; } if (!in_array($status, array_keys(self::$statusDesc))) { return false; } $tableInfo = array( 'status' => $status, 'update_time' => time(), ); $condition = array( 'id' => $id, ); if (!is_null($statusCondition)) { $condition['status'] = $statusCondition; } return $this->update($tableInfo, $condition); } }