CustomtaskModel.class.php
2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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}
");
}
}