|
@@ -7,6 +7,7 @@ |
|
@@ -7,6 +7,7 @@ |
7
|
'use strict';
|
7
|
'use strict';
|
8
|
const api = global.yoho.API;
|
8
|
const api = global.yoho.API;
|
9
|
const userApi = require('./user-api');
|
9
|
const userApi = require('./user-api');
|
|
|
10
|
+const searchApi = global.yoho.SearchAPI;
|
10
|
const Images = require('../../../utils/images');
|
11
|
const Images = require('../../../utils/images');
|
11
|
const headerModel = require('../../../doraemon/models/header');
|
12
|
const headerModel = require('../../../doraemon/models/header');
|
12
|
|
13
|
|
|
@@ -88,49 +89,49 @@ const configData = { |
|
@@ -88,49 +89,49 @@ const configData = { |
88
|
// 着装习惯
|
89
|
// 着装习惯
|
89
|
dressHabits: [{
|
90
|
dressHabits: [{
|
90
|
type: 'checkbox',
|
91
|
type: 'checkbox',
|
91
|
- key: 'dress[]',
|
92
|
+ key: 'dress',
|
92
|
index: 'dress-1',
|
93
|
index: 'dress-1',
|
93
|
value: '1',
|
94
|
value: '1',
|
94
|
text: '正装'
|
95
|
text: '正装'
|
95
|
},
|
96
|
},
|
96
|
{
|
97
|
{
|
97
|
type: 'checkbox',
|
98
|
type: 'checkbox',
|
98
|
- key: 'dress[]',
|
99
|
+ key: 'dress',
|
99
|
index: 'dress-2',
|
100
|
index: 'dress-2',
|
100
|
value: '2',
|
101
|
value: '2',
|
101
|
text: '商务'
|
102
|
text: '商务'
|
102
|
},
|
103
|
},
|
103
|
{
|
104
|
{
|
104
|
type: 'checkbox',
|
105
|
type: 'checkbox',
|
105
|
- key: 'dress[]',
|
106
|
+ key: 'dress',
|
106
|
index: 'dress-3',
|
107
|
index: 'dress-3',
|
107
|
value: '3',
|
108
|
value: '3',
|
108
|
text: '街头流行'
|
109
|
text: '街头流行'
|
109
|
},
|
110
|
},
|
110
|
{
|
111
|
{
|
111
|
type: 'checkbox',
|
112
|
type: 'checkbox',
|
112
|
- key: 'dress[]',
|
113
|
+ key: 'dress',
|
113
|
index: 'dress-4',
|
114
|
index: 'dress-4',
|
114
|
value: '4',
|
115
|
value: '4',
|
115
|
text: '运动休闲'
|
116
|
text: '运动休闲'
|
116
|
},
|
117
|
},
|
117
|
{
|
118
|
{
|
118
|
type: 'checkbox',
|
119
|
type: 'checkbox',
|
119
|
- key: 'dress[]',
|
120
|
+ key: 'dress',
|
120
|
index: 'dress-5',
|
121
|
index: 'dress-5',
|
121
|
value: '5',
|
122
|
value: '5',
|
122
|
text: '文艺气质'
|
123
|
text: '文艺气质'
|
123
|
},
|
124
|
},
|
124
|
{
|
125
|
{
|
125
|
type: 'checkbox',
|
126
|
type: 'checkbox',
|
126
|
- key: 'dress[]',
|
127
|
+ key: 'dress',
|
127
|
index: 'dress-6',
|
128
|
index: 'dress-6',
|
128
|
value: '6',
|
129
|
value: '6',
|
129
|
text: '甜美可爱'
|
130
|
text: '甜美可爱'
|
130
|
},
|
131
|
},
|
131
|
{
|
132
|
{
|
132
|
type: 'checkbox',
|
133
|
type: 'checkbox',
|
133
|
- key: 'dress[]',
|
134
|
+ key: 'dress',
|
134
|
index: 'dress-7',
|
135
|
index: 'dress-7',
|
135
|
value: '7',
|
136
|
value: '7',
|
136
|
text: '另类'
|
137
|
text: '另类'
|
|
@@ -248,7 +249,12 @@ const getUserInfo = (channel, uid) => { |
|
@@ -248,7 +249,12 @@ const getUserInfo = (channel, uid) => { |
248
|
]).then(result => {
|
249
|
]).then(result => {
|
249
|
let finalResult = {},
|
250
|
let finalResult = {},
|
250
|
headerData = {},
|
251
|
headerData = {},
|
251
|
- userInfo = {};
|
252
|
+ userInfo = {},
|
|
|
253
|
+ brandList;
|
|
|
254
|
+
|
|
|
255
|
+ brandList = searchApi.get('/brand/list.json', {is_hot: 'Y'}, {
|
|
|
256
|
+ cache: true
|
|
|
257
|
+ });
|
252
|
|
258
|
|
253
|
if (result[0].code === 200) {
|
259
|
if (result[0].code === 200) {
|
254
|
headerData = result[0];
|
260
|
headerData = result[0];
|
|
@@ -471,11 +477,10 @@ const getUserInfo = (channel, uid) => { |
|
@@ -471,11 +477,10 @@ const getUserInfo = (channel, uid) => { |
471
|
}
|
477
|
}
|
472
|
|
478
|
|
473
|
if (result[5].code === 200) {
|
479
|
if (result[5].code === 200) {
|
474
|
- // let brandInfo = result[4].data || '';
|
480
|
+ // let brandInfo = result[5].data || '';
|
475
|
finalResult.favorite = {
|
481
|
finalResult.favorite = {
|
476
|
subTitle: '喜爱品牌',
|
482
|
subTitle: '喜爱品牌',
|
477
|
submitId: 'favorite-brand'
|
483
|
submitId: 'favorite-brand'
|
478
|
-
|
|
|
479
|
// likebrand: (substr($userLikeBrandInfo['likeBrandStr'], 0, 1) == ',') ?
|
484
|
// likebrand: (substr($userLikeBrandInfo['likeBrandStr'], 0, 1) == ',') ?
|
480
|
// $userLikeBrandInfo['likeBrandStr'] : ',' . $userLikeBrandInfo['likeBrandStr'],
|
485
|
// $userLikeBrandInfo['likeBrandStr'] : ',' . $userLikeBrandInfo['likeBrandStr'],
|
481
|
// favoriteBrands: $userLikeBrandInfo['favBrands'],
|
486
|
// favoriteBrands: $userLikeBrandInfo['favBrands'],
|
|
@@ -514,7 +519,39 @@ const editUserInfo = (req, uid) => { |
|
@@ -514,7 +519,39 @@ const editUserInfo = (req, uid) => { |
514
|
return respData;
|
519
|
return respData;
|
515
|
};
|
520
|
};
|
516
|
|
521
|
|
|
|
522
|
+const editUserHabitsInfo = (req, uid) => {
|
|
|
523
|
+ let habitsInfo = {},
|
|
|
524
|
+ dressArr = [],
|
|
|
525
|
+ respData;
|
|
|
526
|
+
|
|
|
527
|
+ habitsInfo.uid = uid;
|
|
|
528
|
+ habitsInfo.shopping = req.body.shopping;
|
|
|
529
|
+
|
|
|
530
|
+ if (req.body.dress) {
|
|
|
531
|
+ dressArr = req.body.dress;
|
|
|
532
|
+ habitsInfo.dress = dressArr.join(',');
|
|
|
533
|
+ }else {
|
|
|
534
|
+ habitsInfo.dress = '';
|
|
|
535
|
+ }
|
|
|
536
|
+
|
|
|
537
|
+ console.info(habitsInfo);
|
|
|
538
|
+ if (!habitsInfo.shopping) {
|
|
|
539
|
+ respData = {
|
|
|
540
|
+ code: 400,
|
|
|
541
|
+ message: '缺失必填项',
|
|
|
542
|
+ data: ''
|
|
|
543
|
+ };
|
|
|
544
|
+
|
|
|
545
|
+ } else {
|
|
|
546
|
+ respData = userApi.editUserHabitsInfo(habitsInfo);
|
|
|
547
|
+ }
|
|
|
548
|
+
|
|
|
549
|
+ console.info(respData);
|
|
|
550
|
+ return respData;
|
|
|
551
|
+};
|
|
|
552
|
+
|
517
|
module.exports = {
|
553
|
module.exports = {
|
518
|
getUserInfo,
|
554
|
getUserInfo,
|
519
|
- editUserInfo
|
555
|
+ editUserInfo,
|
|
|
556
|
+ editUserHabitsInfo
|
520
|
}; |
557
|
}; |