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,7 +27,7 @@ class GradeData @@ -27,7 +27,7 @@ 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); 30 + $urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
31 31
32 //获取用户基本信息数据(用来得到username) 32 //获取用户基本信息数据(用来得到username)
33 $param = Yohobuy::param(); 33 $param = Yohobuy::param();
@@ -36,7 +36,7 @@ class GradeData @@ -36,7 +36,7 @@ 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); 39 + $urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
40 40
41 return Yohobuy::getMulti($urlList); 41 return Yohobuy::getMulti($urlList);
42 } 42 }
@@ -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
@@ -22,7 +23,8 @@ class OrderData @@ -22,7 +23,8 @@ class OrderData
22 * To change this template file, choose Tools | Templates 23 * To change this template file, choose Tools | Templates
23 * and open the template in the editor. 24 * and open the template in the editor.
24 */ 25 */
25 - public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){ 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,11 +16,11 @@ use Plugin\Helpers; @@ -16,11 +16,11 @@ 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 - { 23 + public function indexAction() {
24 // 设置网站标题 24 // 设置网站标题
25 $this->setTitle('个人中心'); 25 $this->setTitle('个人中心');
26 $this->setNavHeader('个人中心', true, SITE_MAIN); 26 $this->setNavHeader('个人中心', true, SITE_MAIN);
@@ -44,11 +44,9 @@ class HomeController extends AbstractAction @@ -44,11 +44,9 @@ class HomeController extends AbstractAction
44 /** 44 /**
45 * 用户订单 45 * 用户订单
46 */ 46 */
47 - public function ordersAction()  
48 - { 47 + public function ordersAction() {
49 // $uid = $this->getUid(); 48 // $uid = $this->getUid();
50 // $type = $this->get('type', 1); 49 // $type = $this->get('type', 1);
51 -  
52 // $orders = \Index\UserModel::getUserOrderData(967016, $type); 50 // $orders = \Index\UserModel::getUserOrderData(967016, $type);
53 51
54 $order = array( 52 $order = array(
@@ -91,8 +89,7 @@ class HomeController extends AbstractAction @@ -91,8 +89,7 @@ class HomeController extends AbstractAction
91 /** 89 /**
92 * 用户收藏的商品 90 * 用户收藏的商品
93 */ 91 */
94 - public function favoriteAction()  
95 - { 92 + public function favoriteAction() {
96 $uid = $this->getUid(); 93 $uid = $this->getUid();
97 94
98 $favProducts = \Index\UserModel::getFavProductData($uid); 95 $favProducts = \Index\UserModel::getFavProductData($uid);
@@ -116,8 +113,7 @@ class HomeController extends AbstractAction @@ -116,8 +113,7 @@ class HomeController extends AbstractAction
116 /** 113 /**
117 * 用户收藏的品牌 114 * 用户收藏的品牌
118 */ 115 */
119 - public function favoritebrandAction()  
120 - { 116 + public function favoritebrandAction() {
121 $uid = $this->getUid(); 117 $uid = $this->getUid();
122 $gender = Helpers::getGenderByCookie(); 118 $gender = Helpers::getGenderByCookie();
123 119
@@ -129,8 +125,7 @@ class HomeController extends AbstractAction @@ -129,8 +125,7 @@ class HomeController extends AbstractAction
129 /** 125 /**
130 * 个人信息 126 * 个人信息
131 */ 127 */
132 - public function personalDetailsAction()  
133 - { 128 + public function personalDetailsAction() {
134 $this->setTitle('个人信息'); 129 $this->setTitle('个人信息');
135 $this->setNavHeader('个人信息', true, SITE_MAIN); 130 $this->setNavHeader('个人信息', true, SITE_MAIN);
136 131
@@ -139,15 +134,12 @@ class HomeController extends AbstractAction @@ -139,15 +134,12 @@ class HomeController extends AbstractAction
139 $data = \Index\UserModel::getUserProfileData($uid); 134 $data = \Index\UserModel::getUserProfileData($uid);
140 $data['pageFooter'] = true; 135 $data['pageFooter'] = true;
141 $this->_view->display('personal-details', $data); 136 $this->_view->display('personal-details', $data);
142 -  
143 -  
144 } 137 }
145 138
146 /** 139 /**
147 * YOHO币 140 * YOHO币
148 */ 141 */
149 - public function currencyAction()  
150 - { 142 + public function currencyAction() {
151 // $uid = $this->getUid(); 143 // $uid = $this->getUid();
152 $this->setNavHeader('YOHO币', true, false); 144 $this->setNavHeader('YOHO币', true, false);
153 145
@@ -160,8 +152,7 @@ class HomeController extends AbstractAction @@ -160,8 +152,7 @@ class HomeController extends AbstractAction
160 /** 152 /**
161 * 优惠券 153 * 优惠券
162 */ 154 */
163 - public function couponsAction()  
164 - { 155 + public function couponsAction() {
165 156
166 $this->setTitle('优惠券'); 157 $this->setTitle('优惠券');
167 $this->setNavHeader('优惠券', true, SITE_MAIN); 158 $this->setNavHeader('优惠券', true, SITE_MAIN);
@@ -173,14 +164,12 @@ class HomeController extends AbstractAction @@ -173,14 +164,12 @@ class HomeController extends AbstractAction
173 'couponsPage' => true 164 'couponsPage' => true
174 ); 165 );
175 $this->_view->display('coupons', $coupons); 166 $this->_view->display('coupons', $coupons);
176 -  
177 } 167 }
178 168
179 /** 169 /**
180 * 我的消息 170 * 我的消息
181 */ 171 */
182 - public function messageAction()  
183 - { 172 + public function messageAction() {
184 // $uid = $this->getUid(); 173 // $uid = $this->getUid();
185 $page = $this->get('page', 0); 174 $page = $this->get('page', 0);
186 $size = $this->get('size', 10); 175 $size = $this->get('size', 10);
@@ -189,14 +178,12 @@ class HomeController extends AbstractAction @@ -189,14 +178,12 @@ class HomeController extends AbstractAction
189 $messages = \Index\UserModel::getMessageData($uid, $page, $size); 178 $messages = \Index\UserModel::getMessageData($uid, $page, $size);
190 179
191 print_r($messages); 180 print_r($messages);
192 -  
193 } 181 }
194 182
195 /** 183 /**
196 * 地址管理 184 * 地址管理
197 */ 185 */
198 - public function addressAction()  
199 - { 186 + public function addressAction() {
200 // 设置网站标题 187 // 设置网站标题
201 $this->setTitle('地址管理'); 188 $this->setTitle('地址管理');
202 $this->setNavHeader('地址管理', true, SITE_MAIN); 189 $this->setNavHeader('地址管理', true, SITE_MAIN);
@@ -218,8 +205,7 @@ class HomeController extends AbstractAction @@ -218,8 +205,7 @@ class HomeController extends AbstractAction
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);
@@ -241,8 +227,7 @@ class HomeController extends AbstractAction @@ -241,8 +227,7 @@ class HomeController extends AbstractAction
241 /** 227 /**
242 * 在线客服 228 * 在线客服
243 */ 229 */
244 - public function onlineServiceAction()  
245 - { 230 + public function onlineServiceAction() {
246 $service = \Index\UserModel::getOnlineServiceData(); 231 $service = \Index\UserModel::getOnlineServiceData();
247 232
248 print_r($service); 233 print_r($service);
@@ -251,16 +236,14 @@ class HomeController extends AbstractAction @@ -251,16 +236,14 @@ class HomeController extends AbstractAction
251 /** 236 /**
252 * 我的逛 237 * 我的逛
253 */ 238 */
254 - public function myGuangAction()  
255 - { 239 + public function myGuangAction() {
256 echo 'My Guang'; 240 echo 'My Guang';
257 } 241 }
258 242
259 /** 243 /**
260 * 意见反馈 244 * 意见反馈
261 */ 245 */
262 - public function suggestAction()  
263 - { 246 + public function suggestAction() {
264 $udid = $this->getUdid(); 247 $udid = $this->getUdid();
265 $page = $this->get('page', 1); 248 $page = $this->get('page', 1);
266 $limit = $this->get('limit', 30); 249 $limit = $this->get('limit', 30);
@@ -297,15 +280,13 @@ class HomeController extends AbstractAction @@ -297,15 +280,13 @@ class HomeController extends AbstractAction
297 'bad' => false) 280 'bad' => false)
298 ) 281 )
299 )); 282 ));
300 -  
301 } 283 }
302 284
303 /** 285 /**
304 * 异步保存意见反馈数据 286 * 异步保存意见反馈数据
305 */ 287 */
306 - public function savesuggestAction()  
307 - {  
308 - if($this->isAjax()) { 288 + public function savesuggestAction() {
  289 + if ($this->isAjax()) {
309 $uid = $this->getUid(); 290 $uid = $this->getUid();
310 $content = $this->post('content', ''); 291 $content = $this->post('content', '');
311 $suggest_type = $this->get('suggest_type', 2); 292 $suggest_type = $this->get('suggest_type', 2);
@@ -314,13 +295,12 @@ class HomeController extends AbstractAction @@ -314,13 +295,12 @@ class HomeController extends AbstractAction
314 295
315 $this->echoJson($result); 296 $this->echoJson($result);
316 } 297 }
317 -  
318 } 298 }
319 299
320 /** 300 /**
321 * 会员等级展示页 301 * 会员等级展示页
322 */ 302 */
323 - public function gradeAction(){ 303 + public function gradeAction() {
324 //设置网站seo信息 304 //设置网站seo信息
325 $this->setTitle('会员等级'); 305 $this->setTitle('会员等级');
326 //显示网站导航头部信息 306 //显示网站导航头部信息
@@ -328,53 +308,57 @@ class HomeController extends AbstractAction @@ -328,53 +308,57 @@ class HomeController extends AbstractAction
328 308
329 $gender = Helpers::getGenderByCookie(); 309 $gender = Helpers::getGenderByCookie();
330 $channel = Helpers::getChannelByCookie(); 310 $channel = Helpers::getChannelByCookie();
331 - $uid = $this -> getUid();  
332 - $uid = '7566245';//临时测试用  
333 - $data = GradeModel::getGrade($gender,$channel,$uid); 311 + $uid = $this->getUid();
  312 + $uid = '7566245'; //临时测试用
  313 + $data = GradeModel::getGrade($gender, $channel, $uid);
334 $data['pageFooter'] = true; 314 $data['pageFooter'] = true;
335 - $this -> _view -> display('vip-grade',$data); 315 + $this->_view->display('vip-grade', $data);
336 } 316 }
  317 +
337 /* 318 /*
338 - *会员特权查看页 319 + * 会员特权查看页
339 */ 320 */
340 - public function preferentialAction(){ 321 +
  322 + public function preferentialAction() {
341 //设置网站seo信息 323 //设置网站seo信息
342 $this->setTitle('会员等级'); 324 $this->setTitle('会员等级');
343 //显示网站导航头部信息 325 //显示网站导航头部信息
344 $this->setNavHeader('会员特权详情'); 326 $this->setNavHeader('会员特权详情');
345 327
346 $channel = Helpers::getChannelByCookie(); 328 $channel = Helpers::getChannelByCookie();
347 - $uid = $this -> getUid();  
348 - $data = GradeModel::getPreferential($channel,$uid); 329 + $uid = $this->getUid();
  330 + $data = GradeModel::getPreferential($channel, $uid);
349 $data['pageFooter'] = true; 331 $data['pageFooter'] = true;
350 - $this -> _view -> display('privilege',$data); 332 + $this->_view->display('privilege', $data);
351 } 333 }
352 334
353 /* 335 /*
354 - *我的订单页面 336 + * 我的订单页面
355 */ 337 */
356 - public function orderAction(){  
357 338
358 - do{  
359 - //判断是不是ajax请求 339 + public function orderAction() {
  340 +
  341 +// do {
  342 +// //判断是不是ajax请求
360 // if(!$this -> isAjax()){ 343 // if(!$this -> isAjax()){
361 // break; 344 // break;
362 // } 345 // }
363 //判断参数是否有效 346 //判断参数是否有效
364 - $type = $this -> get('type',1);  
365 - $page = $this -> get('page',1);  
366 - $limit = $this -> get('limit',10); 347 + $type = $this->get('type', 1);
  348 + $page = $this->get('page', 1);
  349 + $limit = $this->get('limit', 10);
367 $gender = Helpers::getGenderByCookie(); 350 $gender = Helpers::getGenderByCookie();
368 - $yh_channel = $this -> get('yh_channel',1);  
369 - $uid = $this -> getUid();  
370 - if(!empty($type) && !is_numeric($type)){ 351 + $yh_channel = $this->get('yh_channel', 1);
  352 + //$uid = $this->getUid();
  353 + $uid = '7566245';
  354 + if (!empty($type) && !is_numeric($type)) {
371 break; 355 break;
372 } 356 }
373 //$data = OrderModel::getOrder(); 357 //$data = OrderModel::getOrder();
374 - $data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);  
375 - //print_r($data);  
376 - }  
377 - while(false); 358 + $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
  359 + print_r($data);
  360 + //} while (false);
378 //$this -> _view -> display('order',$data); 361 //$this -> _view -> display('order',$data);
379 } 362 }
  363 +
380 } 364 }
@@ -26,7 +26,7 @@ class GradeModel @@ -26,7 +26,7 @@ class GradeModel
26 } 26 }
27 } 27 }
28 //调用接口获取数据 28 //调用接口获取数据
29 - $data = GradeData::getGradeData($gender,$channel, $uid); 29 + $data = GradeData::getGradeData($gender, $channel, $uid);
30 switch (intval($data['grade']['current_vip_level'])) { 30 switch (intval($data['grade']['current_vip_level'])) {
31 case 0://普通会员 31 case 0://普通会员
32 $result['vipGrade']['vip0'] = true; 32 $result['vipGrade']['vip0'] = true;
@@ -45,7 +45,7 @@ class GradeModel @@ -45,7 +45,7 @@ class GradeModel
45 //今年总消费 45 //今年总消费
46 $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost']; 46 $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
47 //升级下一等级会员的进度; 47 //升级下一等级会员的进度;
48 - $result['vipGrade']['percent'] = 100*(round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2)); 48 + $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
49 //距离升级所需消费金额 49 //距离升级所需消费金额
50 50
51 if ($data['grade']['current_vip_level'] != 3) { 51 if ($data['grade']['current_vip_level'] != 3) {
@@ -57,7 +57,7 @@ class GradeModel @@ -57,7 +57,7 @@ class GradeModel
57 //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); 57 //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
58 $result['vipGrade']['name'] = $data['userProfile']['username']; 58 $result['vipGrade']['name'] = $data['userProfile']['username'];
59 //跳转url(会员特权详情) 59 //跳转url(会员特权详情)
60 - $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential',null); 60 + $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
61 //当前vip等级享受的特权 61 //当前vip等级享受的特权
62 $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential']; 62 $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
63 63
1 <?php 1 <?php
2 2
3 - namespace home; 3 +namespace home;
  4 +
  5 +use LibModels\Wap\Home\OrderData;
4 6
5 - use LibModels\Wap\Home\OrderData;  
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
@@ -19,10 +20,54 @@ class OrderModel @@ -19,10 +20,54 @@ class OrderModel
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); 23 + public function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
25 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