Dao.php
2.98 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
<?php
/**
* Created by JetBrains PhpStorm.
* User: elkan
* Date: 14-8-20
* Time: 下午6:04
* To change this template use File | Settings | File Templates.
*/
use YHMOrders\SqlMap\Status;
class YHMOrders_Models_Status_Dao extends YHMOrders_Dao {
private $_tag = 'orders_status_';
public function __construct() {
$this->router = 'status.yhm_orders';
}
/**
*
* @param int $store_id
*/
function getByOrderCode($order_code) {
return $this->dao()->tag($this->_tag . $order_code)->key('getByOrderCode')->fetchAll(Status\Status::SELECT_ORDER_STATUS_HISTORY_BY_ORDER_CODE, array(
'order_code' => $order_code));
}
/**
* 查看是否已有相同的状态
* @param type $order_code
* @param type $status
*/
function getRepeatStatusByOrderCode($order_code, $status) {
return $this->dao()->tag($this->_tag . $order_code)->key('getRepeatStatusByOrderCode_' . $status)->fetchRow(Status\Status::SELECT_ORDER_STATUS_BY_ORDER_CODE, array(
'order_code' => $order_code, 'status' => $status));
}
/**
* 添加订单状态
* @param integer $order_code
* @param integer $order_status
* @param integer $trigger_user
*/
public function setOrderstatus($order_code, $order_status, $trigger_user) {
$params = array(
'order_code' => $order_code,
'order_status' => $order_status,
'trigger_user' => $trigger_user
);
return $this->dao()->tag($this->_tag . $order_code)->insert(Status\Status::SET_STATUS, $params)->lastInsertId();
}
/**
* 查询订单状态
* @param type $order_code
*
*/
function getOrderStatus($order_code) {
return $this->dao()->tag($this->_tag . $order_code)->key('getOrderStatusByList')->fetchAll(Status\Status::SELECT_ORDER_STATUS_BY_LIST, array(
'order_code' => $order_code));
}
/**
* 获取某阶段内订单状态列表
* @param type $time
*
*/
function getOrderStatusByTime($time,$order_status,$type) {
if ($type==1)
{
echo $this->dao()->getSql(Status\Status::SELECT_ORDER_STATUS_BY_TIME_LIST, array(
'order_status' => $order_status,
'time' => $time
));
return $this->dao()->fetchAll(Status\Status::SELECT_ORDER_STATUS_BY_TIME_LIST, array(
'order_status' => $order_status,
'time' => $time
));
}
else {
// $sql="SELECT_ORDER_STATUS_BY_EQTIME_LIST";
echo $this->dao()->getSql(Status\Status::SELECT_ORDER_STATUS_BY_EQTIME_LIST, array(
'order_status' => $order_status,
'time' => $time
));
return $this->dao()->fetchAll(Status\Status::SELECT_ORDER_STATUS_BY_EQTIME_LIST, array(
'order_status' => $order_status,
'time' => $time
));
}
}
}