Authored by yangyang

为了更新代码而commit下

framework @ 75bbc3b0
1 -Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05 1 +Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
@@ -18,14 +18,15 @@ class Yohobuy @@ -18,14 +18,15 @@ class Yohobuy
18 { 18 {
19 19
20 /* 正式环境 */ 20 /* 正式环境 */
21 - // const API_URL = 'http://api2.open.yohobuy.com/';  
22 - // const SERVICE_URL = 'http://service.api.yohobuy.com/';  
23 - // const YOHOBUY_URL = 'http://www.yohobuy.com/'; 21 + const API_URL = 'http://api2.open.yohobuy.com/';
  22 + const API_URL2 = 'http://api.open.yohobuy.com/';
  23 + const SERVICE_URL = 'http://service.api.yohobuy.com/';
  24 + const YOHOBUY_URL = 'http://www.yohobuy.com/';
24 25
25 /* 测试环境 */ 26 /* 测试环境 */
26 - const API_URL = 'http://test2.open.yohobuy.com/';  
27 - const SERVICE_URL = 'http://test.service.api.yohobuy.com/';  
28 - const YOHOBUY_URL = 'http://www.yohobuy.com/'; 27 +// const API_URL = 'http://test2.open.yohobuy.com/';
  28 +// const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
  29 +// const YOHOBUY_URL = 'http://www.yohobuy.com/';
29 30
30 /** 31 /**
31 * 私钥列表 32 * 私钥列表
@@ -19,7 +19,7 @@ class GradeData @@ -19,7 +19,7 @@ class GradeData
19 * @param string $uid 用户id 19 * @param string $uid 用户id
20 * @return array 接口返回的会员等级数据 20 * @return array 接口返回的会员等级数据
21 */ 21 */
22 - public function getGradeData($gender,$channel, $uid) { 22 + public function getGradeData($gender, $channel, $uid) {
23 $urlList = array(); 23 $urlList = array();
24 //获取会员等级数据 24 //获取会员等级数据
25 $param = Yohobuy::param(); 25 $param = Yohobuy::param();
@@ -27,8 +27,8 @@ class GradeData @@ -27,8 +27,8 @@ class GradeData
27 $param['uid'] = $uid; 27 $param['uid'] = $uid;
28 $param['method'] = 'app.Passport.vip'; 28 $param['method'] = 'app.Passport.vip';
29 $param['client_secret'] = Sign::getSign($param); 29 $param['client_secret'] = Sign::getSign($param);
30 - $urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
31 - 30 + $urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  31 +
32 //获取用户基本信息数据(用来得到username) 32 //获取用户基本信息数据(用来得到username)
33 $param = Yohobuy::param(); 33 $param = Yohobuy::param();
34 $param['gender'] = $gender; 34 $param['gender'] = $gender;
@@ -36,8 +36,8 @@ class GradeData @@ -36,8 +36,8 @@ class GradeData
36 $param['yh_channel'] = $channel; 36 $param['yh_channel'] = $channel;
37 $param['method'] = 'app.passport.profile'; 37 $param['method'] = 'app.passport.profile';
38 $param['client_secret'] = Sign::getSign($param); 38 $param['client_secret'] = Sign::getSign($param);
39 - $urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL,$param);  
40 - 39 + $urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
  40 +
41 return Yohobuy::getMulti($urlList); 41 return Yohobuy::getMulti($urlList);
42 } 42 }
43 43
@@ -4,6 +4,7 @@ namespace LibModels\Wap\Home; @@ -4,6 +4,7 @@ namespace LibModels\Wap\Home;
4 4
5 use Api\Yohobuy; 5 use Api\Yohobuy;
6 use Api\Sign; 6 use Api\Sign;
  7 +
7 /* 8 /*
8 * To change this license header, choose License Headers in Project Properties. 9 * To change this license header, choose License Headers in Project Properties.
9 * To change this template file, choose Tools | Templates 10 * To change this template file, choose Tools | Templates
@@ -18,11 +19,12 @@ use Api\Sign; @@ -18,11 +19,12 @@ use Api\Sign;
18 class OrderData 19 class OrderData
19 { 20 {
20 /* 21 /*
21 - * 获取订单数据  
22 - * To change this template file, choose Tools | Templates  
23 - * and open the template in the editor.  
24 - */  
25 - public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){ 22 + * 获取订单数据
  23 + * To change this template file, choose Tools | Templates
  24 + * and open the template in the editor.
  25 + */
  26 +
  27 + public function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) {
26 $param = Yohobuy::param(); 28 $param = Yohobuy::param();
27 $param['gender'] = $gender; 29 $param['gender'] = $gender;
28 $param['limit'] = $limit; 30 $param['limit'] = $limit;
@@ -32,7 +34,8 @@ class OrderData @@ -32,7 +34,8 @@ class OrderData
32 $param['uid'] = $uid; 34 $param['uid'] = $uid;
33 $param['yh_channel'] = $yh_channel; 35 $param['yh_channel'] = $yh_channel;
34 $param['client_secret'] = Sign::getSign($param); 36 $param['client_secret'] = Sign::getSign($param);
35 - print_r($param);  
36 - return Yohobuy::get(Yohobuy::API_URL,$param); 37 + //print_r($param);
  38 + return Yohobuy::get(Yohobuy::API_URL2, $param);
37 } 39 }
  40 +
38 } 41 }
@@ -16,24 +16,24 @@ use Plugin\Helpers; @@ -16,24 +16,24 @@ use Plugin\Helpers;
16 */ 16 */
17 class HomeController extends AbstractAction 17 class HomeController extends AbstractAction
18 { 18 {
  19 +
19 /** 20 /**
20 * 个人中心入口 21 * 个人中心入口
21 */ 22 */
22 - public function indexAction()  
23 - {  
24 - // 设置网站标题 23 + public function indexAction() {
  24 + // 设置网站标题
25 $this->setTitle('个人中心'); 25 $this->setTitle('个人中心');
26 - $this->setNavHeader('个人中心', true, SITE_MAIN); 26 + $this->setNavHeader('个人中心', true, SITE_MAIN);
27 27
28 - // $uid = $this->getUid();  
29 - $uid = 967016;  
30 - $data = \Index\UserModel::getUserProfileData($uid);  
31 - $data += \Index\UserModel::getInfoNumData($uid); 28 + // $uid = $this->getUid();
  29 + $uid = 967016;
  30 + $data = \Index\UserModel::getUserProfileData($uid);
  31 + $data += \Index\UserModel::getInfoNumData($uid);
32 32
33 - // 优选新品数据  
34 - $channel = Helpers::getChannelByCookie();  
35 - $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);  
36 - // print_r($data); 33 + // 优选新品数据
  34 + $channel = Helpers::getChannelByCookie();
  35 + $data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
  36 + // print_r($data);
37 37
38 $data['myIndexPage'] = true; 38 $data['myIndexPage'] = true;
39 $data['pageFooter'] = true; 39 $data['pageFooter'] = true;
@@ -41,63 +41,60 @@ class HomeController extends AbstractAction @@ -41,63 +41,60 @@ class HomeController extends AbstractAction
41 $this->_view->display('index', $data); 41 $this->_view->display('index', $data);
42 } 42 }
43 43
44 - /**  
45 - * 用户订单  
46 - */  
47 - public function ordersAction()  
48 - {  
49 - // $uid = $this->getUid();  
50 - // $type = $this->get('type', 1);  
51 -  
52 - // $orders = \Index\UserModel::getUserOrderData(967016, $type);  
53 -  
54 - $order = array(  
55 - 'orders' => array(  
56 - array(  
57 - 'orderNum' => '408539077',  
58 - 'tradingStatus' => '交易成功',  
59 - 'goods' => array(  
60 - array(  
61 - 'id' => 1,  
62 - 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
63 - 'name' => 'Adidas Originals ZX FLUXM22508',  
64 - 'color' => '黄',  
65 - 'size' => '43',  
66 - 'price' => '699.00',  
67 - 'count' => '2'  
68 - ),  
69 - array(  
70 - 'id' => 1,  
71 - 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',  
72 - 'name' => 'B.Duck浴室玩伴mini浮水鸭',  
73 - 'gift' => true,  
74 - 'color' => '黄',  
75 - 'size' => '43',  
76 - 'price' => '0.00',  
77 - 'count' => '1'  
78 - )  
79 - ),  
80 - 'count' => 2,  
81 - 'sumCost' => '699.00',  
82 - 'unpaid' => true,  
83 - )  
84 - )  
85 - );  
86 -  
87 - $this->_view->display('order', array('order' => $order, 'orderPage' => true));  
88 - // print_r($orders);  
89 - }  
90 -  
91 - /**  
92 - * 用户收藏的商品  
93 - */  
94 - public function favoriteAction()  
95 - {  
96 - $uid = $this->getUid();  
97 -  
98 - $favProducts = \Index\UserModel::getFavProductData($uid);  
99 -  
100 - //print_r($favProducts); 44 + /**
  45 + * 用户订单
  46 + */
  47 + public function ordersAction() {
  48 + // $uid = $this->getUid();
  49 + // $type = $this->get('type', 1);
  50 + // $orders = \Index\UserModel::getUserOrderData(967016, $type);
  51 +
  52 + $order = array(
  53 + 'orders' => array(
  54 + array(
  55 + 'orderNum' => '408539077',
  56 + 'tradingStatus' => '交易成功',
  57 + 'goods' => array(
  58 + array(
  59 + 'id' => 1,
  60 + 'thumb' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
  61 + 'name' => 'Adidas Originals ZX FLUXM22508',
  62 + 'color' => '黄',
  63 + 'size' => '43',
  64 + 'price' => '699.00',
  65 + 'count' => '2'
  66 + ),
  67 + array(
  68 + 'id' => 1,
  69 + 'thumb' => 'http://img10.static.yhbimg.com/goodsimg/2015/11/04/05/0188f1aca49ac478a565ec029b5d2d4a6c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
  70 + 'name' => 'B.Duck浴室玩伴mini浮水鸭',
  71 + 'gift' => true,
  72 + 'color' => '黄',
  73 + 'size' => '43',
  74 + 'price' => '0.00',
  75 + 'count' => '1'
  76 + )
  77 + ),
  78 + 'count' => 2,
  79 + 'sumCost' => '699.00',
  80 + 'unpaid' => true,
  81 + )
  82 + )
  83 + );
  84 +
  85 + $this->_view->display('order', array('order' => $order, 'orderPage' => true));
  86 + // print_r($orders);
  87 + }
  88 +
  89 + /**
  90 + * 用户收藏的商品
  91 + */
  92 + public function favoriteAction() {
  93 + $uid = $this->getUid();
  94 +
  95 + $favProducts = \Index\UserModel::getFavProductData($uid);
  96 +
  97 + //print_r($favProducts);
101 98
102 $this->_view->display('favorite', array( 99 $this->_view->display('favorite', array(
103 'favPage' => true, 100 'favPage' => true,
@@ -111,115 +108,104 @@ class HomeController extends AbstractAction @@ -111,115 +108,104 @@ class HomeController extends AbstractAction
111 'hasFavProduct' => false, 108 'hasFavProduct' => false,
112 'hasFavBrand' => false 109 'hasFavBrand' => false
113 )); 110 ));
114 - }  
115 -  
116 - /**  
117 - * 用户收藏的品牌  
118 - */  
119 - public function favoritebrandAction()  
120 - {  
121 - $uid = $this->getUid();  
122 - $gender = Helpers::getGenderByCookie();  
123 -  
124 - $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);  
125 -  
126 - print_r($favBrands);  
127 - }  
128 -  
129 - /**  
130 - * 个人信息  
131 - */  
132 - public function personalDetailsAction()  
133 - {  
134 - $this->setTitle('个人信息');  
135 - $this->setNavHeader('个人信息', true, SITE_MAIN); 111 + }
136 112
137 - // $uid = $this->getUid();  
138 - $uid = 967016;  
139 - $data = \Index\UserModel::getUserProfileData($uid);  
140 - $data['pageFooter'] = true;  
141 - $this->_view->display('personal-details', $data); 113 + /**
  114 + * 用户收藏的品牌
  115 + */
  116 + public function favoritebrandAction() {
  117 + $uid = $this->getUid();
  118 + $gender = Helpers::getGenderByCookie();
  119 +
  120 + $favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
  121 +
  122 + print_r($favBrands);
  123 + }
142 124
  125 + /**
  126 + * 个人信息
  127 + */
  128 + public function personalDetailsAction() {
  129 + $this->setTitle('个人信息');
  130 + $this->setNavHeader('个人信息', true, SITE_MAIN);
143 131
144 - } 132 + // $uid = $this->getUid();
  133 + $uid = 967016;
  134 + $data = \Index\UserModel::getUserProfileData($uid);
  135 + $data['pageFooter'] = true;
  136 + $this->_view->display('personal-details', $data);
  137 + }
145 138
146 - /**  
147 - * YOHO币  
148 - */  
149 - public function currencyAction()  
150 - {  
151 - // $uid = $this->getUid();  
152 - $this->setNavHeader('YOHO币', true, false); 139 + /**
  140 + * YOHO币
  141 + */
  142 + public function currencyAction() {
  143 + // $uid = $this->getUid();
  144 + $this->setNavHeader('YOHO币', true, false);
153 145
154 - $uid = 967016;  
155 - $currency = \Index\UserModel::getYohoCoinData($uid); 146 + $uid = 967016;
  147 + $currency = \Index\UserModel::getYohoCoinData($uid);
156 148
157 - $this->_view->display('currency', $currency);  
158 - } 149 + $this->_view->display('currency', $currency);
  150 + }
159 151
160 - /**  
161 - * 优惠券  
162 - */  
163 - public function couponsAction()  
164 - { 152 + /**
  153 + * 优惠券
  154 + */
  155 + public function couponsAction() {
165 156
166 $this->setTitle('优惠券'); 157 $this->setTitle('优惠券');
167 - $this->setNavHeader('优惠券', true, SITE_MAIN);  
168 - // $uid = $this->getUid();  
169 - $uid = 967016;  
170 - $status = $this->get('status', 0);  
171 - $coupons = array(  
172 - 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),  
173 - 'couponsPage' => true  
174 - ); 158 + $this->setNavHeader('优惠券', true, SITE_MAIN);
  159 + // $uid = $this->getUid();
  160 + $uid = 967016;
  161 + $status = $this->get('status', 0);
  162 + $coupons = array(
  163 + 'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
  164 + 'couponsPage' => true
  165 + );
175 $this->_view->display('coupons', $coupons); 166 $this->_view->display('coupons', $coupons);
  167 + }
176 168
177 - }  
178 -  
179 - /**  
180 - * 我的消息  
181 - */  
182 - public function messageAction()  
183 - {  
184 - // $uid = $this->getUid();  
185 - $page = $this->get('page', 0);  
186 - $size = $this->get('size', 10);  
187 -  
188 - $uid = 967016;  
189 - $messages = \Index\UserModel::getMessageData($uid, $page, $size); 169 + /**
  170 + * 我的消息
  171 + */
  172 + public function messageAction() {
  173 + // $uid = $this->getUid();
  174 + $page = $this->get('page', 0);
  175 + $size = $this->get('size', 10);
190 176
191 - print_r($messages); 177 + $uid = 967016;
  178 + $messages = \Index\UserModel::getMessageData($uid, $page, $size);
192 179
193 - } 180 + print_r($messages);
  181 + }
194 182
195 - /**  
196 - * 地址管理  
197 - */  
198 - public function addressAction()  
199 - {  
200 - // 设置网站标题 183 + /**
  184 + * 地址管理
  185 + */
  186 + public function addressAction() {
  187 + // 设置网站标题
201 $this->setTitle('地址管理'); 188 $this->setTitle('地址管理');
202 $this->setNavHeader('地址管理', true, SITE_MAIN); 189 $this->setNavHeader('地址管理', true, SITE_MAIN);
203 190
204 // $uid = $this->getUid(); 191 // $uid = $this->getUid();
205 $uid = 967016; 192 $uid = 967016;
206 193
207 - $address = \Index\UserModel::getAddressData($uid); 194 + $address = \Index\UserModel::getAddressData($uid);
208 195
209 - // print_r($address); 196 + // print_r($address);
210 197
211 $this->_view->display('address', array( 198 $this->_view->display('address', array(
212 'addressPage' => true, 199 'addressPage' => true,
213 'pageFooter' => true, 200 'pageFooter' => true,
214 'address' => $address 201 'address' => $address
215 )); 202 ));
216 - } 203 + }
217 204
218 /** 205 /**
219 * 修改地址 206 * 修改地址
220 */ 207 */
221 - public function editAddressAction()  
222 - { 208 + public function editAddressAction() {
223 // 设置网站标题 209 // 设置网站标题
224 $this->setTitle('修改地址'); 210 $this->setTitle('修改地址');
225 $this->setNavHeader('修改地址', true, SITE_MAIN); 211 $this->setNavHeader('修改地址', true, SITE_MAIN);
@@ -238,36 +224,33 @@ class HomeController extends AbstractAction @@ -238,36 +224,33 @@ class HomeController extends AbstractAction
238 )); 224 ));
239 } 225 }
240 226
241 - /**  
242 - * 在线客服  
243 - */  
244 - public function onlineServiceAction()  
245 - {  
246 - $service = \Index\UserModel::getOnlineServiceData();  
247 -  
248 - print_r($service);  
249 - }  
250 -  
251 - /**  
252 - * 我的逛  
253 - */  
254 - public function myGuangAction()  
255 - {  
256 - echo 'My Guang';  
257 - }  
258 -  
259 - /**  
260 - * 意见反馈  
261 - */  
262 - public function suggestAction()  
263 - {  
264 - $udid = $this->getUdid();  
265 - $page = $this->get('page', 1);  
266 - $limit = $this->get('limit', 30);  
267 -  
268 - $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);  
269 -  
270 - //print_r($suggest); 227 + /**
  228 + * 在线客服
  229 + */
  230 + public function onlineServiceAction() {
  231 + $service = \Index\UserModel::getOnlineServiceData();
  232 +
  233 + print_r($service);
  234 + }
  235 +
  236 + /**
  237 + * 我的逛
  238 + */
  239 + public function myGuangAction() {
  240 + echo 'My Guang';
  241 + }
  242 +
  243 + /**
  244 + * 意见反馈
  245 + */
  246 + public function suggestAction() {
  247 + $udid = $this->getUdid();
  248 + $page = $this->get('page', 1);
  249 + $limit = $this->get('limit', 30);
  250 +
  251 + $suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
  252 +
  253 + //print_r($suggest);
271 $this->_view->display('suggest', array( 254 $this->_view->display('suggest', array(
272 'suggestPage' => true, 255 'suggestPage' => true,
273 'pageHeader' => array( 256 'pageHeader' => array(
@@ -297,84 +280,85 @@ class HomeController extends AbstractAction @@ -297,84 +280,85 @@ class HomeController extends AbstractAction
297 'bad' => false) 280 'bad' => false)
298 ) 281 )
299 )); 282 ));
  283 + }
300 284
301 - }  
302 -  
303 - /**  
304 - * 异步保存意见反馈数据  
305 - */  
306 - public function savesuggestAction()  
307 - {  
308 - if($this->isAjax()) {  
309 - $uid = $this->getUid();  
310 - $content = $this->post('content', '');  
311 - $suggest_type = $this->get('suggest_type', 2);  
312 -  
313 - $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);  
314 -  
315 - $this->echoJson($result);  
316 - }  
317 -  
318 - }  
319 -  
320 - /**  
321 - * 会员等级展示页  
322 - */  
323 - public function gradeAction(){  
324 - //设置网站seo信息  
325 - $this->setTitle('会员等级');  
326 - //显示网站导航头部信息  
327 - $this->setNavHeader('会员等级');  
328 -  
329 - $gender = Helpers::getGenderByCookie();  
330 - $channel = Helpers::getChannelByCookie();  
331 - $uid = $this -> getUid();  
332 - $uid = '7566245';//临时测试用  
333 - $data = GradeModel::getGrade($gender,$channel,$uid);  
334 - $data['pageFooter'] = true;  
335 - $this -> _view -> display('vip-grade',$data);  
336 - }  
337 - /*  
338 - *会员特权查看页  
339 - */  
340 - public function preferentialAction(){  
341 - //设置网站seo信息  
342 - $this->setTitle('会员等级');  
343 - //显示网站导航头部信息  
344 - $this->setNavHeader('会员特权详情');  
345 -  
346 - $channel = Helpers::getChannelByCookie();  
347 - $uid = $this -> getUid();  
348 - $data = GradeModel::getPreferential($channel,$uid);  
349 - $data['pageFooter'] = true;  
350 - $this -> _view -> display('privilege',$data);  
351 - }  
352 -  
353 - /*  
354 - *我的订单页面  
355 - */  
356 - public function orderAction(){  
357 -  
358 - do{  
359 - //判断是不是ajax请求 285 + /**
  286 + * 异步保存意见反馈数据
  287 + */
  288 + public function savesuggestAction() {
  289 + if ($this->isAjax()) {
  290 + $uid = $this->getUid();
  291 + $content = $this->post('content', '');
  292 + $suggest_type = $this->get('suggest_type', 2);
  293 +
  294 + $result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
  295 +
  296 + $this->echoJson($result);
  297 + }
  298 + }
  299 +
  300 + /**
  301 + * 会员等级展示页
  302 + */
  303 + public function gradeAction() {
  304 + //设置网站seo信息
  305 + $this->setTitle('会员等级');
  306 + //显示网站导航头部信息
  307 + $this->setNavHeader('会员等级');
  308 +
  309 + $gender = Helpers::getGenderByCookie();
  310 + $channel = Helpers::getChannelByCookie();
  311 + $uid = $this->getUid();
  312 + $uid = '7566245'; //临时测试用
  313 + $data = GradeModel::getGrade($gender, $channel, $uid);
  314 + $data['pageFooter'] = true;
  315 + $this->_view->display('vip-grade', $data);
  316 + }
  317 +
  318 + /*
  319 + * 会员特权查看页
  320 + */
  321 +
  322 + public function preferentialAction() {
  323 + //设置网站seo信息
  324 + $this->setTitle('会员等级');
  325 + //显示网站导航头部信息
  326 + $this->setNavHeader('会员特权详情');
  327 +
  328 + $channel = Helpers::getChannelByCookie();
  329 + $uid = $this->getUid();
  330 + $data = GradeModel::getPreferential($channel, $uid);
  331 + $data['pageFooter'] = true;
  332 + $this->_view->display('privilege', $data);
  333 + }
  334 +
  335 + /*
  336 + * 我的订单页面
  337 + */
  338 +
  339 + public function orderAction() {
  340 +
  341 +// do {
  342 +// //判断是不是ajax请求
360 // if(!$this -> isAjax()){ 343 // if(!$this -> isAjax()){
361 // break; 344 // break;
362 // } 345 // }
363 - //判断参数是否有效  
364 - $type = $this -> get('type',1);  
365 - $page = $this -> get('page',1);  
366 - $limit = $this -> get('limit',10);  
367 - $gender = Helpers::getGenderByCookie();  
368 - $yh_channel = $this -> get('yh_channel',1);  
369 - $uid = $this -> getUid();  
370 - if(!empty($type) && !is_numeric($type)){  
371 - break;  
372 - }  
373 - //$data = OrderModel::getOrder();  
374 - $data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);  
375 - //print_r($data);  
376 - }  
377 - while(false);  
378 - //$this -> _view -> display('order',$data); 346 + //判断参数是否有效
  347 + $type = $this->get('type', 1);
  348 + $page = $this->get('page', 1);
  349 + $limit = $this->get('limit', 10);
  350 + $gender = Helpers::getGenderByCookie();
  351 + $yh_channel = $this->get('yh_channel', 1);
  352 + //$uid = $this->getUid();
  353 + $uid = '7566245';
  354 + if (!empty($type) && !is_numeric($type)) {
  355 + break;
379 } 356 }
  357 + //$data = OrderModel::getOrder();
  358 + $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
  359 + print_r($data);
  360 + //} while (false);
  361 + //$this -> _view -> display('order',$data);
  362 + }
  363 +
380 } 364 }
@@ -26,41 +26,41 @@ class GradeModel @@ -26,41 +26,41 @@ class GradeModel
26 } 26 }
27 } 27 }
28 //调用接口获取数据 28 //调用接口获取数据
29 - $data = GradeData::getGradeData($gender,$channel, $uid);  
30 - switch (intval($data['grade']['current_vip_level'])) {  
31 - case 0://普通会员  
32 - $result['vipGrade']['vip0'] = true;  
33 - break;  
34 - case 1://银卡会员  
35 - $result['vipGrade']['vip1'] = true;  
36 - break;  
37 - case 2://金卡会员  
38 - $result['vipGrade']['vip2'] = true;  
39 - break;  
40 - case 3://白金会员  
41 - $result['vipGrade']['vip3'] = true;  
42 - break;  
43 - }  
44 -  
45 - //今年总消费  
46 - $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];  
47 - //升级下一等级会员的进度;  
48 - $result['vipGrade']['percent'] = 100*(round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));  
49 - //距离升级所需消费金额  
50 -  
51 - if ($data['grade']['current_vip_level'] != 3) {  
52 - $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];  
53 - }  
54 - //消费总计  
55 - $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];  
56 - //username 调用获取用户基本信息数据,获得username;  
57 - //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);  
58 - $result['vipGrade']['name'] = $data['userProfile']['username'];  
59 - //跳转url(会员特权详情)  
60 - $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null);  
61 - //当前vip等级享受的特权  
62 - $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];  
63 - 29 + $data = GradeData::getGradeData($gender, $channel, $uid);
  30 + switch (intval($data['grade']['current_vip_level'])) {
  31 + case 0://普通会员
  32 + $result['vipGrade']['vip0'] = true;
  33 + break;
  34 + case 1://银卡会员
  35 + $result['vipGrade']['vip1'] = true;
  36 + break;
  37 + case 2://金卡会员
  38 + $result['vipGrade']['vip2'] = true;
  39 + break;
  40 + case 3://白金会员
  41 + $result['vipGrade']['vip3'] = true;
  42 + break;
  43 + }
  44 +
  45 + //今年总消费
  46 + $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
  47 + //升级下一等级会员的进度;
  48 + $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
  49 + //距离升级所需消费金额
  50 +
  51 + if ($data['grade']['current_vip_level'] != 3) {
  52 + $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
  53 + }
  54 + //消费总计
  55 + $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
  56 + //username 调用获取用户基本信息数据,获得username;
  57 + //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
  58 + $result['vipGrade']['name'] = $data['userProfile']['username'];
  59 + //跳转url(会员特权详情)
  60 + $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
  61 + //当前vip等级享受的特权
  62 + $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
  63 +
64 64
65 if (USE_CACHE) { 65 if (USE_CACHE) {
66 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 66 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
@@ -72,7 +72,7 @@ class GradeModel @@ -72,7 +72,7 @@ class GradeModel
72 Cache::set(CacheConfig::KEY_ACTION_HOME_GRADE, $result); 72 Cache::set(CacheConfig::KEY_ACTION_HOME_GRADE, $result);
73 } 73 }
74 } 74 }
75 - 75 +
76 return $result; 76 return $result;
77 } 77 }
78 78
@@ -95,7 +95,7 @@ class GradeModel @@ -95,7 +95,7 @@ class GradeModel
95 if (isset($data['code']) && $data['code'] == 200) { 95 if (isset($data['code']) && $data['code'] == 200) {
96 $result['vipGrade']['privilege'] = $data['data']; 96 $result['vipGrade']['privilege'] = $data['data'];
97 } 97 }
98 - 98 +
99 99
100 if (USE_CACHE) { 100 if (USE_CACHE) {
101 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据. 101 // 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
@@ -107,7 +107,7 @@ class GradeModel @@ -107,7 +107,7 @@ class GradeModel
107 Cache::set(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, $result); 107 Cache::set(CacheConfig::KEY_ACTION_HOME_PREFERENTIAL, $result);
108 } 108 }
109 } 109 }
110 - 110 +
111 return $result; 111 return $result;
112 } 112 }
113 113
1 <?php 1 <?php
2 2
3 - namespace home;  
4 -  
5 - use LibModels\Wap\Home\OrderData; 3 +namespace home;
  4 +
  5 +use LibModels\Wap\Home\OrderData;
  6 +
6 /* 7 /*
7 * To change this license header, choose License Headers in Project Properties. 8 * To change this license header, choose License Headers in Project Properties.
8 * To change this template file, choose Tools | Templates 9 * To change this template file, choose Tools | Templates
@@ -15,15 +16,59 @@ @@ -15,15 +16,59 @@
15 */ 16 */
16 class OrderModel 17 class OrderModel
17 { 18 {
18 - 19 +
19 /** 20 /**
20 * 订单相关数据处理 21 * 订单相关数据处理
21 */ 22 */
22 - public function getOrder($type = 1,$page = 1,$limit,$gender,$yh_channel,$uid){  
23 -  
24 - $data = OrderData::getOrderData($type,$page,$limit,$gender,$yh_channel,$uid);  
25 - 23 + public function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
  24 +
  25 + $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
  26 + $result = array();
  27 + if($data['code'] == 200 && isset($data['data'])){
  28 + foreach($data['data']['order_list'] as $key => $vo){
  29 + $result[$key]['orderNum'] = $vo['order_code'];
  30 + $result[$key]['tradingStatus'] = $vo['status_str'];
  31 + $result[$key]['count'] = count($vo['order_goods']);
  32 + $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
  33 + if($vo['payment_type'] != 2){
  34 + switch ($vo['status']) {
  35 + case 0:
  36 + $result[$key]['unpaid'] = true;
  37 + break;
  38 + case 1 || 2 || 3:
  39 + $result[$key]['unshipped'] = true;
  40 + break;
  41 + case 4 || 5:
  42 + $result[$key]['unreceived'] = true;
  43 + break;
  44 + case 6:
  45 + $result[$key]['completed'] = true;
  46 + break;
  47 + default:
  48 + break;
  49 + }
  50 + }else{
  51 +// switch ($vo['status']) {
  52 +// case 0:
  53 +// $result[$key]['unpaid'] = true;
  54 +// break;
  55 +// case 1 || 2 || 3:
  56 +// $result[$key]['unshipped'] = true;
  57 +// break;
  58 +// case 4 || 5:
  59 +// $result[$key]['unreceived'] = true;
  60 +// break;
  61 +// case 6:
  62 +// $result[$key]['completed'] = true;
  63 +// break;
  64 +// default:
  65 +// break;
  66 +// }
  67 + }
  68 + }
  69 + }
  70 + //return $result;
26 return $data; 71 return $data;
27 } 72 }
28 - 73 +
29 } 74 }