|
@@ -33,7 +33,7 @@ class UserModel |
|
@@ -33,7 +33,7 @@ class UserModel |
33
|
$userData = UserData::userData($uid);
|
33
|
$userData = UserData::userData($uid);
|
34
|
|
34
|
|
35
|
// 处理个人详情数
|
35
|
// 处理个人详情数
|
36
|
- if ($userData) {
|
36
|
+ if (!isset($userData['code'])) {
|
37
|
$result = $userData;
|
37
|
$result = $userData;
|
38
|
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
|
38
|
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
|
39
|
$result['head_ico'] = $result['head_ico'] ? Images::getImageUrl($result['head_ico'], 128, 128) : '';
|
39
|
$result['head_ico'] = $result['head_ico'] ? Images::getImageUrl($result['head_ico'], 128, 128) : '';
|
|
@@ -82,11 +82,30 @@ class UserModel |
|
@@ -82,11 +82,30 @@ class UserModel |
82
|
$result = array();
|
82
|
$result = array();
|
83
|
|
83
|
|
84
|
// 用户优惠券数量
|
84
|
// 用户优惠券数量
|
85
|
- $couponNum = UserData::couponNum($uid) ?: 0;
|
85
|
+ $couponNum = UserData::couponNum($uid);
|
|
|
86
|
+ if(!isset($couponNum['code'])) {
|
|
|
87
|
+ $result['coupon_num'] = $couponNum;
|
|
|
88
|
+ }
|
86
|
// 用户收藏的品牌数量
|
89
|
// 用户收藏的品牌数量
|
87
|
- $favBrandNum = UserData::favoriteBrandNum($uid) ?: 0;
|
90
|
+ $favBrandNum = UserData::favoriteBrandNum($uid);
|
|
|
91
|
+ if(!isset($favBrandNum['code'])) {
|
|
|
92
|
+ $result['brand_favorite_total'] = $favBrandNum;
|
|
|
93
|
+ }
|
88
|
// 用户收藏的商品数量
|
94
|
// 用户收藏的商品数量
|
89
|
- $favProductNum = UserData::favoriteProductNum($uid) ?: 0;
|
95
|
+ $favProductNum = UserData::favoriteProductNum($uid);
|
|
|
96
|
+ if(!isset($favProductNum['code'])) {
|
|
|
97
|
+ $result['product_favorite_total'] = $favProductNum;
|
|
|
98
|
+ }
|
|
|
99
|
+ // 未读消息数目
|
|
|
100
|
+ $messageNum = UserData::messageNum($uid);
|
|
|
101
|
+ if(!isset($messageNum['code'])) {
|
|
|
102
|
+ $result['inbox_total'] = $messageNum;
|
|
|
103
|
+ }
|
|
|
104
|
+ // 有货币数量
|
|
|
105
|
+ $coinNum = UserData::yohoCoinData($uid);
|
|
|
106
|
+ if(!isset($coinNum['code'])) {
|
|
|
107
|
+ $result['yoho_coin_num'] = $coinNum;
|
|
|
108
|
+ }
|
90
|
|
109
|
|
91
|
return $result;
|
110
|
return $result;
|
92
|
}
|
111
|
}
|
|
@@ -175,12 +194,12 @@ class UserModel |
|
@@ -175,12 +194,12 @@ class UserModel |
175
|
$favProduct = UserData::favoriteProductData($uid);
|
194
|
$favProduct = UserData::favoriteProductData($uid);
|
176
|
|
195
|
|
177
|
// 处理用户收藏的商品数据
|
196
|
// 处理用户收藏的商品数据
|
178
|
- if (isset($favProduct['data']) && !empty($favProduct['data'])) {
|
197
|
+ if (isset($favProduct['list']) && !empty($favProduct['list'])) {
|
179
|
$product = array();
|
198
|
$product = array();
|
180
|
- foreach ($favProduct['data']['product_list'] as $val) {
|
199
|
+ foreach ($favProduct['list'] as $val) {
|
181
|
$product = array();
|
200
|
$product = array();
|
182
|
$product['fav_id'] = $val['product_id'];
|
201
|
$product['fav_id'] = $val['product_id'];
|
183
|
- $product['imgUrl'] = $val['image'];
|
202
|
+ $product['imgUrl'] = Helpers::getImageUrl($val['image'], 140, 140);
|
184
|
$product['title'] = $val['product_name'];
|
203
|
$product['title'] = $val['product_name'];
|
185
|
$product['price'] = '¥'.$val['market_price'];
|
204
|
$product['price'] = '¥'.$val['market_price'];
|
186
|
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.$val['sales_price'] : false;
|
205
|
$product['discountPrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.$val['sales_price'] : false;
|
|
@@ -199,20 +218,22 @@ class UserModel |
|
@@ -199,20 +218,22 @@ class UserModel |
199
|
* 处理用户收藏的品牌数据
|
218
|
* 处理用户收藏的品牌数据
|
200
|
*
|
219
|
*
|
201
|
* @param int $uid 用户ID
|
220
|
* @param int $uid 用户ID
|
202
|
- * @param string $gender 性别 1,3表示男,2,3表示女,1,2,3表示全部
|
221
|
+ * @param int $size 每页条数,size会覆盖limit值
|
|
|
222
|
+ * @param int $page 第几页,默认1
|
|
|
223
|
+ * @param int $limit 限制读取的数目,默认10
|
203
|
* @return array|mixed 处理之后的收藏的品牌数据
|
224
|
* @return array|mixed 处理之后的收藏的品牌数据
|
204
|
*/
|
225
|
*/
|
205
|
- public static function getFavBrandData($uid, $gender)
|
226
|
+ public static function getFavBrandData($uid, $size, $page, $limit)
|
206
|
{
|
227
|
{
|
207
|
$result = array();
|
228
|
$result = array();
|
208
|
|
229
|
|
209
|
// 调用接口获取户收藏的品牌数据
|
230
|
// 调用接口获取户收藏的品牌数据
|
210
|
- $favBrand = UserData::favoriteBrandData($uid, $gender);
|
231
|
+ $favBrand = UserData::favoriteBrandData($uid, $size, $page, $limit);
|
211
|
|
232
|
|
212
|
// 处理用户收藏的品牌数据
|
233
|
// 处理用户收藏的品牌数据
|
213
|
- if (isset($favBrand['data']) && !empty($favBrand['data'])) {
|
234
|
+ if (isset($favBrand['list']) && !empty($favBrand['list'])) {
|
214
|
$brand = array();
|
235
|
$brand = array();
|
215
|
- foreach ($favBrand['data']['brand_list'] as $val) {
|
236
|
+ foreach ($favBrand['list'] as $val) {
|
216
|
$brand = array();
|
237
|
$brand = array();
|
217
|
$brand['id'] = $val['brand_id'];
|
238
|
$brand['id'] = $val['brand_id'];
|
218
|
$brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
|
239
|
$brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
|