Dao.php
2.49 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
<?php
/**
* Created by JetBrains PhpStorm.
* User: elkan
* Date: 14-8-18
* Time: 下午6:04
* To change this template use File | Settings | File Templates.
*/
use YHMSupport\SqlMap\Activity;
class YHMSupport_Models_AdminActivity_Dao extends YHMSupport_Dao {
private $_tag = 'support_activity';
public function __construct() {
$this->router = 'activity.yhm_support';
}
/**
* 活动列表
* @return type
*/
function getActivityListPage($offset, $num) {
return $this->dao()->cache(false)->fetchAll(Activity\Activity::SELECT_ACTIVITY_LIST, array('offset' => $offset, 'num' => $num));
}
function add($pid, $activity_name, $start_time, $end_time, $activity_banner, $activity_describe) {
$data = array(
'create_pid' => $pid,
'activity_name' => $activity_name,
'start_time' => $start_time,
'end_time' => $end_time,
'activity_banner' => $activity_banner,
'activity_describe' => $activity_describe
);
return $this->dao()->cache(false)->insert(Activity\Activity::INSERT_INTO_ACTIVITY, $data)->lastInsertId();
}
function getActivityGoods($activity_id, $product_skc) {
return $this->dao()->cache(false)->fetchRow(Activity\Activity::SELECT_ACTIVITY_GOODS, array('activity_id' => $activity_id, 'product_skc' => $product_skc));
}
/**
* 添加单品
* @param type $activity_id
* @param type $product_skc
* @return type
*/
function addGoods($activity_id, $product_skc) {
return $this->dao()->cache(false)->insert(Activity\Activity::INSERT_INTO_ACTIVITY_GOODS, array('activity_id' => $activity_id, 'product_skc' => $product_skc))->lastInsertId();
}
function set($activity_id, $pid, $activity_name, $start_time, $end_time, $activity_banner, $activity_describe, $status) {
$data = array(
'id' => $activity_id,
'create_pid' => $pid,
'activity_name' => $activity_name,
'start_time' => $start_time,
'end_time' => $end_time,
'activity_banner' => $activity_banner,
'activity_describe' => $activity_describe,
'status' => $status
);
return $this->dao()->update(Activity\Activity::UPDATE_ACTIVITY_BY_ID, $data);
}
function getActivityGoodsList($activity_id) {
return $this->dao()->cache(false)->fetchAll(Activity\Activity::SELECT_ACTIVITY_GOODS_LIST, array('activity_id' => $activity_id));
}
}