OrderData.php
4.52 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php
namespace LibModels\Wap\Home;
use Api\Yohobuy;
use Api\Sign;
/**
* 订单相关的数据模型
*
*/
class OrderData
{
/*
* 获取订单数据
*/
public static function getOrderData($type, $page, $limit, $gender, $channel, $uid)
{
//构建必传参数
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['limit'] = $limit;
$param['method'] = 'app.SpaceOrders.get';
$param['page'] = $page;
$param['type'] = $type;
$param['uid'] = $uid;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(API_URL, $param);
}
/*
* 取消订单
*/
public static function cancelOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.close';
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(API_URL, $param);
}
/*
* 删除订单
*/
public static function deleteOrderData($orderCode, $uid, $gender, $channel)
{
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $channel;
$param['method'] = 'app.SpaceOrders.delOrderByCode';
$param['client_secret'] = Sign::getSign($param);
//调用接口删除订单
return Yohobuy::get(API_URL, $param);
}
/**
* 查看订单详情
*
* @param string $orderCode 订单号
* @param int $uid 用户ID
* @param string $sessionKey 用户会话
* @return array
*/
public static function viewOrderData($orderCode, $uid, $sessionKey)
{
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.info';
$param['order_code'] = $orderCode;
$param['uid'] = $uid;
$param['session_key'] = $sessionKey;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(API_URL, $param);
}
/*
* 我的订单-查看物流
*
* @param int $orderCode 订单号
* @param int $uid 用户ID
* @return array
*/
public static function LogisticsData($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(API_URL, $param);
}
/*
* 支付页面的资源位
*/
public static function paymentData($gender, $yh_channel, $code)
{
//构建必传参数
$param = Yohobuy::param();
$param['content_code'] = $code;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(SERVICE_URL . '/operations/api/v5/resource/get', $param);
}
/*
* 随便逛逛url
*
* 备注:暂不使用
*/
public static function strollData($gender, $yh_channel, $code)
{
//构建必传参数
$param = Yohobuy::param();
$param['content_code'] = $code;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(SERVICE_URL . '/operations/api/v5/resource/get', $param);
}
/**
* 更新订单的支付方式
*
* @param int $orderCode 订单号
* @param int $payment 支付方式
* @param int $uid 用户ID
* @return array
*/
public static function updateOrderPayment($orderCode, $payment, $uid)
{
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.SpaceOrders.updateOrdersPaymentByCode';
$param['order_code'] = (int) $orderCode;
$param['payment'] = $payment;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
// 调用接口获得数据
return Yohobuy::post(API_URL, $param);
}
}