OrderData.php
3.2 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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
namespace LibModels\Web\Home;
use Api\Yohobuy;
use Api\Sign;
class OrderData
{
/**
* 我的订单-分页
* @param type $uid
* @param type $page
* @param type $limit
* @param type $type 获取订单类型 type=1全部,type=2待付款,type=3待发货,type=4待收货,type=5待评论(已成功) 7取消
* @return type
*/
public static function getUserOrders($uid, $page = 1, $limit = 10, $type = 1)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.get';
$param['uid'] = $uid;
$param['type'] = $type;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 订单详情
* @param type $uid
* @param type $orderCode
* @return type
*/
public static function getOrderDetail($uid, $orderCode)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.info';
$param['uid'] = $uid;
$param['order_code'] = $orderCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 取消订单
* @param type $uid
* @param type $orderCode
* @return type
*/
public static function cancelUserOrder($uid, $orderCode)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.close';
$param['uid'] = $uid;
$param['order_code'] = $orderCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 确认订单
* @param type $uid
* @param type $orderCode
* @return type
*/
public static function confirmUserOrder($uid, $orderCode)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.confirm';
$param['uid'] = $uid;
$param['order_code'] = $orderCode;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取yohood票
*
* @param string $uid
* @param string $sku
* @return array
*/
public static function getYohoodTicket($uid, $sku)
{
$param = Yohobuy::param();
$param['method'] = 'app.shopping.ticket';
$param['uid'] = $uid;
$param['sku'] = $sku;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 我的订单-查看物流
*
* @param int $orderCode 订单号
* @param int $uid 用户ID
* @return array
*/
public static function getLogisticsData($orderCode, $uid)
{
//构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.express.li';
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}