Dao.php
1.93 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
<?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\Delivery;
class YHMOrders_Models_Delivery_Dao extends YHMOrders_Dao
{
private $_tag = 'orders_delivery_';
public function __construct()
{
$this->router = 'delivery.yhm_orders';
}
/**
* 查询订单收货地址
* @param int $order_code
* @return int
*/
function getOneByOrderCode($order_code)
{
return $this->dao()->tag($this->_tag . $order_code)->key('getOneByOrderCode')->fetchRow(Delivery\Delivery::SELECT_DELIVERY_BY_ORDER_CODE, array('order_code' => $order_code));
}
/**
* 存储订单送货地址
* @param $orderCode
* @param $receiverName
* @param $receiverMobile
* @param $areaCode
* @param $address
* @param $zipCode
* @return int
*/
function addDelivery($orderCode, $receiverName, $receiverMobile, $areaCode, $address, $zipCode)
{
return $this->dao()->tag($this->_tag . $orderCode)->insert(Delivery\Delivery::INSERT_DELIVERY, array(
'order_code' => $orderCode,
'receiver_name' => $receiverName,
'receiver_mobile' => $receiverMobile,
'area_code' => $areaCode,
'address' => $address,
'zip_code' => $zipCode
))->rowCount();
}
function setDelivery($order_code,$deliver_company_id,$deliver_company_name,$delivery_code){
$data = array(
'order_code' => $order_code,
'deliver_company_id' => $deliver_company_id,
'deliver_company_name' => $deliver_company_name,
'delivery_code' => $delivery_code
);
return $this->dao()->tag($this->_tag . $order_code)->key('setDelivery')->update(Delivery\Delivery::UPDATE_DELIVERY_BY_ORDER_CODE, $data);
}
}