<?php /** * Created by PhpStorm. * User: liyifei2012it * Date: 17/5/18 * Time: 11:34 */ namespace Common\Model; class CustomtaskModel extends AbstractModel { /** * 任务状态(1=草稿;2=未开始;3=进行中;4=已结束;5=已终止) */ const TASK_STATUS_ING = 3; /** * 是否自动提醒(1=否;2=是) */ const IS_AUTO_REMIND_TRUE = 2; const IS_AUTO_REMIND_FALSE = 1; // 构造方法 public function __construct() { parent::__construct(); } /** * 没有企业标识的统计 * @param $conds * @return array|bool */ public function countWithOutDomain($conds) { $params = array(); // 更新条件 $wheres = array(); if (!$this->_parse_where($wheres, $params, $conds)) { return false; } // 状态条件 $wheres[] = "`{$this->prefield}status`<?"; $params[] = $this->get_st_delete(); return $this->_m->result('SELECT COUNT(*) FROM __TABLE__ WHERE ' . implode(' AND ', $wheres), $params); } /** * 没有企业标识的查询 * @param $conds * @param null $page_option * @param array $order_option * @param string $fields * @return array|bool */ public function listWithOutDomian($conds, $page_option = null, $order_option = array(), $fields = '*') { $params = array(); // 条件 $wheres = array(); if (!$this->_parse_where($wheres, $params, $conds)) { return false; } // 状态条件 $wheres[] = "`{$this->prefield}status`<?"; $params[] = $this->get_st_delete(); // 排序 $orderby = ''; if (!$this->_order_by($orderby, $order_option)) { return false; } // 分页参数 $limit = ''; if (!$this->_limit($limit, $page_option)) { return false; } // 读取记录 return $this->_m->fetch_array("SELECT {$fields} FROM __TABLE__ WHERE " . implode(' AND ', $wheres) . "{$orderby}{$limit}", $params); } /** * 增加完成数 * @param $customtaskId * @return array|bool */ public function addCompleteTotal($customtaskId) { if (empty($customtaskId)) { return true; } return $this->_m->execute(" UPDATE __TABLE__ SET complete_total = complete_total + 1, count_time = " . MILLI_TIME . " WHERE customtask_id = {$customtaskId} "); } }