Showing
6 changed files
with
41 additions
and
116 deletions
@@ -27,8 +27,8 @@ class Yohobuy | @@ -27,8 +27,8 @@ class Yohobuy | ||
27 | const API_URL = 'http://test2.open.yohobuy.com/'; | 27 | const API_URL = 'http://test2.open.yohobuy.com/'; |
28 | const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; | 28 | const SERVICE_URL = 'http://test.service.api.yohobuy.com/'; |
29 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; | 29 | const YOHOBUY_URL = 'http://www.yohobuy.com/'; |
30 | - const YOHOBUY_ORDER = 'http://192.168.102.209:8080/yoho-order/'; | ||
31 | - const API_URL_MYCENTER = 'http://192.168.102.209:8080/yoho-users-web/'; // 我的个人中心接口URL | 30 | + const YOHOBUY_ORDER = 'http://192.168.102.209:8080/yoho-order/'; //我的订单 |
31 | + const API_URL_MYCENTER = 'http://192.168.102.213:8081/yoho-users-web/'; // 我的个人中心接口URL | ||
32 | const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL | 32 | const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL |
33 | const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页 | 33 | const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页 |
34 | 34 |
@@ -18,24 +18,10 @@ class GradeData | @@ -18,24 +18,10 @@ class GradeData | ||
18 | * @param string $uid 用户id | 18 | * @param string $uid 用户id |
19 | * @return array 接口返回的会员等级数据 | 19 | * @return array 接口返回的会员等级数据 |
20 | */ | 20 | */ |
21 | - public static function getGradeData($channel, $uid) { | ||
22 | - $urlList = array(); | 21 | + public static function getGradeData($uid) { |
23 | //获取会员等级数据 | 22 | //获取会员等级数据 |
24 | - $param = Yohobuy::param(); | ||
25 | - $param['yh_channel'] = $channel; | ||
26 | $param['uid'] = $uid; | 23 | $param['uid'] = $uid; |
27 | - $param['method'] = 'app.Passport.vip'; | ||
28 | - $param['client_secret'] = Sign::getSign($param); | ||
29 | - $urlList['grade'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
30 | - | ||
31 | - //获取用户基本信息数据(用来得到username) | ||
32 | - $param = Yohobuy::param(); | ||
33 | - $param['uid'] = $uid; | ||
34 | - $param['method'] = 'app.passport.profile'; | ||
35 | - $param['client_secret'] = Sign::getSign($param); | ||
36 | - $urlList['userProfile'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param); | ||
37 | - | ||
38 | - return Yohobuy::getMulti($urlList); | 24 | + return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER.'UserVipRest/getVipDetailInfo', $param); |
39 | } | 25 | } |
40 | 26 | ||
41 | /** | 27 | /** |
@@ -44,14 +30,9 @@ class GradeData | @@ -44,14 +30,9 @@ class GradeData | ||
44 | * @param string $uid 用户id | 30 | * @param string $uid 用户id |
45 | * @return array 接口返回的会员特权详情数据 | 31 | * @return array 接口返回的会员特权详情数据 |
46 | */ | 32 | */ |
47 | - public static function getPreferentialData($channel, $uid) { | 33 | + public static function getPreferentialData() { |
48 | 34 | ||
49 | - $param = Yohobuy::param(); | ||
50 | - $param['yh_channel'] = $channel; | ||
51 | - $param['uid'] = $uid; | ||
52 | - $param['method'] = 'app.passport.getPrivilege'; | ||
53 | - $param['client_secret'] = Sign::getSign($param); | ||
54 | - return Yohobuy::get(Yohobuy::API_URL, $param); | 35 | + return Yohobuy::jsonPost(Yohobuy::API_URL_MYCENTER.'UserVipRest/getPrivilege'); |
55 | } | 36 | } |
56 | 37 | ||
57 | } | 38 | } |
@@ -24,27 +24,14 @@ class OrderData | @@ -24,27 +24,14 @@ class OrderData | ||
24 | * and open the template in the editor. | 24 | * and open the template in the editor. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | - static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) { | ||
28 | - //构建必传参数 | ||
29 | -// $param = Yohobuy::param(); | ||
30 | -// $param['gender'] = $gender; | ||
31 | -// $param['limit'] = $limit; | ||
32 | -// $param['method'] = 'app.SpaceOrders.get'; | ||
33 | -// $param['page'] = $page; | ||
34 | -// $param['type'] = $type; | ||
35 | -// $param['uid'] = $uid; | ||
36 | -// $param['yh_channel'] = $yh_channel; | ||
37 | -// $param['client_secret'] = Sign::getSign($param); | ||
38 | -// //调用接口获得数据 | ||
39 | -// return Yohobuy::get(Yohobuy::API_URL, $param); | 27 | + static function getOrderData($type, $page, $limit, $uid) { |
40 | $param['limit'] = '10'; | 28 | $param['limit'] = '10'; |
41 | $param['page'] = 1; | 29 | $param['page'] = 1; |
42 | $param['type'] = 1; | 30 | $param['type'] = 1; |
43 | $param['uid'] = '12'; | 31 | $param['uid'] = '12'; |
44 | - $param['iscancel'] = false; | ||
45 | - $param['paymentStatus'] = 'Y'; | ||
46 | - print_r($param); | ||
47 | - var_dump(Yohobuy::jsonPost(Yohobuy::YOHOBUY_ORDER.'orderInfo/getOrderList',$param)); | 32 | +// $param['iscancel'] = false; |
33 | +// $param['paymentStatus'] = 'Y'; | ||
34 | + return Yohobuy::jsonPost(Yohobuy::YOHOBUY_ORDER.'orderInfo/getOrderList',$param); | ||
48 | } | 35 | } |
49 | 36 | ||
50 | /* | 37 | /* |
@@ -437,10 +437,7 @@ class HomeController extends AbstractAction | @@ -437,10 +437,7 @@ class HomeController extends AbstractAction | ||
437 | $this->setTitle('会员等级'); | 437 | $this->setTitle('会员等级'); |
438 | //显示网站导航头部信息 | 438 | //显示网站导航头部信息 |
439 | $this->setNavHeader('会员特权详情'); | 439 | $this->setNavHeader('会员特权详情'); |
440 | - | ||
441 | - $channel = Helpers::getChannelByCookie(); | ||
442 | - $uid = $this->getUid(); | ||
443 | - $data = GradeModel::getPreferential($channel, $uid); | 440 | + $data = GradeModel::getPreferential(); |
444 | $data['pageFooter'] = true; | 441 | $data['pageFooter'] = true; |
445 | 442 | ||
446 | $this->_view->display('privilege', $data); | 443 | $this->_view->display('privilege', $data); |
@@ -480,11 +477,9 @@ class HomeController extends AbstractAction | @@ -480,11 +477,9 @@ class HomeController extends AbstractAction | ||
480 | $type = $this->get('type', 1); | 477 | $type = $this->get('type', 1); |
481 | $page = $this->get('page', 1); | 478 | $page = $this->get('page', 1); |
482 | $limit = $this->get('limit', 10); | 479 | $limit = $this->get('limit', 10); |
483 | - $gender = Helpers::getGenderByCookie(); | ||
484 | - $yh_channel = $this->get('yh_channel', 1); | ||
485 | $uid = $this->getUid(); | 480 | $uid = $this->getUid(); |
486 | //调用模型层getOrder方法获得并处理数据 | 481 | //调用模型层getOrder方法获得并处理数据 |
487 | - $data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid); | 482 | + $data = OrderModel::getOrder($type, $page, $limit, $uid); |
488 | /* 如果取不到订单数据时,分两种情况: | 483 | /* 如果取不到订单数据时,分两种情况: |
489 | 1、page>1时,echo一个空格字符串到浏览器。 | 484 | 1、page>1时,echo一个空格字符串到浏览器。 |
490 | 2、page=1时,就给一个随便逛逛的链接。 | 485 | 2、page=1时,就给一个随便逛逛的链接。 |
@@ -29,9 +29,8 @@ class GradeModel | @@ -29,9 +29,8 @@ class GradeModel | ||
29 | } | 29 | } |
30 | //调用接口获取数据 | 30 | //调用接口获取数据 |
31 | $data = GradeData::getGradeData($uid); | 31 | $data = GradeData::getGradeData($uid); |
32 | - print_r($data); | ||
33 | - if (!empty($data['grade'])) { | ||
34 | - switch (intval($data['grade']['current_vip_level'])) { | 32 | + if (!empty($data['curVipInfo'])) { |
33 | + switch (intval($data['curVipInfo']['curLevel'])) { | ||
35 | case 0://普通会员 | 34 | case 0://普通会员 |
36 | $result['vipGrade']['vip0'] = true; | 35 | $result['vipGrade']['vip0'] = true; |
37 | break; | 36 | break; |
@@ -47,23 +46,23 @@ class GradeModel | @@ -47,23 +46,23 @@ class GradeModel | ||
47 | } | 46 | } |
48 | 47 | ||
49 | //今年总消费 | 48 | //今年总消费 |
50 | - $result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost']; | 49 | + $result['vipGrade']['costOfThisYear'] = $data['costInfo']['yearTotal']; |
51 | //升级下一等级会员的进度; | 50 | //升级下一等级会员的进度; |
52 | - $result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2)); | 51 | + $result['vipGrade']['percent'] = 100 * (round($data['costInfo']['total'] / $data['nextVipInfo']['needCost'], 2)); |
53 | //距离升级所需消费金额 | 52 | //距离升级所需消费金额 |
54 | 53 | ||
55 | - if ($data['grade']['current_vip_level'] != 3) { | ||
56 | - $result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost']; | 54 | + if ($data['curVipInfo']['curLevel'] != 3) { |
55 | + $result['vipGrade']['costGap'] = $data['nextVipInfo']['needCost']; | ||
57 | } | 56 | } |
58 | //消费总计 | 57 | //消费总计 |
59 | - $result['vipGrade']['sumCost'] = $data['grade']['current_total_cost']; | 58 | + $result['vipGrade']['sumCost'] = $data['costInfo']['total']; |
60 | //username 调用获取用户基本信息数据,获得username; | 59 | //username 调用获取用户基本信息数据,获得username; |
61 | //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); | 60 | //$userProfile = GradeData::getUserProfileData($gender,$uid,$channel); |
62 | - $result['vipGrade']['name'] = $data['userProfile']['username']; | 61 | + $result['vipGrade']['name'] = '杨阳'; |
63 | //跳转url(会员特权详情) | 62 | //跳转url(会员特权详情) |
64 | $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null); | 63 | $result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null); |
65 | //当前vip等级享受的特权 | 64 | //当前vip等级享受的特权 |
66 | - $result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential']; | 65 | + $result['vipGrade']['privilege'] = $data['curVipInfo']['premiumScop']; |
67 | } | 66 | } |
68 | 67 | ||
69 | if (USE_CACHE) { | 68 | if (USE_CACHE) { |
@@ -84,7 +83,7 @@ class GradeModel | @@ -84,7 +83,7 @@ class GradeModel | ||
84 | * 获取个人中心-会员特权详情页 | 83 | * 获取个人中心-会员特权详情页 |
85 | */ | 84 | */ |
86 | 85 | ||
87 | - public static function getPreferential($channel, $uid) | 86 | + public static function getPreferential() |
88 | { | 87 | { |
89 | $result = array(); | 88 | $result = array(); |
90 | 89 | ||
@@ -96,9 +95,9 @@ class GradeModel | @@ -96,9 +95,9 @@ class GradeModel | ||
96 | } | 95 | } |
97 | } | 96 | } |
98 | //调取接口获得数据 | 97 | //调取接口获得数据 |
99 | - $data = GradeData::getPreferentialData($channel, $uid); | ||
100 | - if (isset($data['code']) && $data['code'] == 200) { | ||
101 | - $result['vipGrade']['privilege'] = $data['data']; | 98 | + $data = GradeData::getPreferentialData(); |
99 | + if (!empty($data)){ | ||
100 | + $result['vipGrade']['privilege'] = $data; | ||
102 | } | 101 | } |
103 | 102 | ||
104 | 103 |
@@ -28,7 +28,7 @@ class OrderModel | @@ -28,7 +28,7 @@ class OrderModel | ||
28 | * 订单相关数据处理 | 28 | * 订单相关数据处理 |
29 | */ | 29 | */ |
30 | 30 | ||
31 | - static function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) { | 31 | + static function getOrder($type, $page, $limit, $uid) { |
32 | $result = array(); | 32 | $result = array(); |
33 | if (USE_CACHE) { | 33 | if (USE_CACHE) { |
34 | $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER; | 34 | $key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER; |
@@ -39,65 +39,28 @@ class OrderModel | @@ -39,65 +39,28 @@ class OrderModel | ||
39 | } | 39 | } |
40 | } | 40 | } |
41 | //调用接口获得数据 | 41 | //调用接口获得数据 |
42 | - $data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid); | 42 | + $data = OrderData::getOrderData($type, $page, $limit, $uid); |
43 | + print_r($data); | ||
43 | //检查数据返回是否正常,正常则处理数据 | 44 | //检查数据返回是否正常,正常则处理数据 |
44 | - if ($data['code'] == 200 && isset($data['data'])) { | ||
45 | - foreach ($data['data']['order_list'] as $key => $vo) { | ||
46 | - //订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费) | ||
47 | - $result[$key]['orderNum'] = $vo['order_code']; | ||
48 | - $result[$key]['orderStatus'] = $vo['status_str']; | ||
49 | - $result[$key]['count'] = count($vo['order_goods']); | ||
50 | - $result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost']; | ||
51 | - //类内调用格式化订单商品数据方法 | ||
52 | - $result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']); | ||
53 | - //根据订单status判断订单处于什么状态。 | ||
54 | - do { | ||
55 | - //订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。 | ||
56 | - if ($vo['is_cancel'] === 'Y') { | ||
57 | - $result[$key]['canceled'] = true; | ||
58 | - break; | ||
59 | - } | ||
60 | - /* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态) | ||
61 | - * 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付; | ||
62 | - */ | ||
63 | - //支付方式为非货到付款时,计算订单状态。 | ||
64 | - if ($vo['payment_type'] != 2) { | 45 | + if (!empty($data[0])) { |
46 | + $result = array(); | ||
47 | + foreach($data as $key => $vo){ | ||
48 | + $result[$key]['detailUrl'] = $vo['']; | ||
49 | + $result[$key]['orderNum'] = $vo['orderCode']; | ||
50 | + $result[$key]['orderStatus'] = $vo['status']; | ||
51 | + $result[$key]['count'] = count($vo['ordersGoodsList']); | ||
52 | + $result[$key]['sumCost'] = $vo['amount']; | ||
53 | + $result[$key]['sumCost'] = $vo['amount']; | ||
65 | switch ($vo['status']) { | 54 | switch ($vo['status']) { |
66 | - case 0: | ||
67 | - $result[$key]['unpaid'] = true; | ||
68 | - break; | ||
69 | - //未发货&未收货 状态,统一合并到待收货状态。 | ||
70 | case 1: | 55 | case 1: |
71 | - case 2: | ||
72 | - case 3: | ||
73 | - case 4: | ||
74 | - case 5: | ||
75 | - $result[$key]['unreceived'] = true; | ||
76 | - //待收货状态,给查看物流url | ||
77 | - $result[$key]['logisticsUrl'] = "暂无logisticsUrl数据"; | ||
78 | - break; | ||
79 | - case 6: | ||
80 | - $result[$key]['completed'] = true; | ||
81 | - break; | ||
82 | - default: | ||
83 | - break; | ||
84 | - } | ||
85 | - } elseif ($vo['payment_type'] == 2) { | ||
86 | - //订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态) | ||
87 | - switch ($vo['status']) { | ||
88 | - case 0 || 1 || 2 || 3 || 4 || 5: | ||
89 | - $result[$key]['unreceived'] = true; | ||
90 | - //待收货状态,给查看物流url | ||
91 | - $resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据"; | ||
92 | - break; | ||
93 | - case 6: | ||
94 | - $result[$key]['completed'] = true; | 56 | + $result[$key]['sumCost'] = $vo['amount']; |
57 | + | ||
95 | break; | 58 | break; |
59 | + | ||
96 | default: | 60 | default: |
97 | break; | 61 | break; |
98 | } | 62 | } |
99 | - } | ||
100 | - } while (false); | 63 | + $result[$key]['sumCost'] = $vo['amount']; |
101 | } | 64 | } |
102 | } | 65 | } |
103 | 66 |
-
Please register or login to post a comment