Authored by wenjiekong

修改个人资料编辑接口

@@ -108,11 +108,11 @@ exports.editUserLikeBrand = (req, res, next) => { @@ -108,11 +108,11 @@ exports.editUserLikeBrand = (req, res, next) => {
108 */ 108 */
109 exports.isBrandName = (req, res, next) => { 109 exports.isBrandName = (req, res, next) => {
110 110
111 - let uid = '8039836'; 111 + // let uid = '8039836';
112 112
113 // 真实数据输出 113 // 真实数据输出
114 userService.isBrandName(req).then(result => { 114 userService.isBrandName(req).then(result => {
115 - // console.info(result); 115 + console.info(result);
116 }).catch(next); 116 }).catch(next);
117 117
118 }; 118 };
@@ -207,6 +207,30 @@ const isEmpty = (value) => { @@ -207,6 +207,30 @@ const isEmpty = (value) => {
207 (Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0); 207 (Object.prototype.isPrototypeOf(value) && Object.keys(value).length === 0);
208 }; 208 };
209 209
  210 +const getHotBrands = (brandList) => {
  211 + let hotBrands = [],
  212 + i = 20;
  213 +
  214 + if (brandList) {
  215 + for (let j = 0; j < brandList.length; j++) {
  216 + if (brandList[j].is_hot === 'Y') {
  217 + hotBrands.push({
  218 + id: 'pp-' + brandList[j].id,
  219 + name: 'pp[]',
  220 + value: brandList[j].id,
  221 + text: brandList[j].brand_name
  222 + });
  223 + i--;
  224 + }
  225 + if (i <= 0) {
  226 + break;
  227 + }
  228 + }
  229 + }
  230 +
  231 + return hotBrands;
  232 +};
  233 +
210 /** 234 /**
211 * 联动取地区信息 235 * 联动取地区信息
212 */ 236 */
@@ -382,12 +406,9 @@ const getUserInfo = (channel, uid) => { @@ -382,12 +406,9 @@ const getUserInfo = (channel, uid) => {
382 406
383 if (result[3].code === 200) { 407 if (result[3].code === 200) {
384 let contactInfo = result[3].data || '', 408 let contactInfo = result[3].data || '',
385 - areaCode = contactInfo.areaCode || '',  
386 - prov; 409 + areaCode;
387 410
388 - // getProviceCityInfo(0, areaCode.substr(0, 2)).then(result => {  
389 - // console.info(result);  
390 - // }); 411 + getProviceCityInfo(0, areaCode.substr(0, 2));
391 412
392 finalResult.contactInfo = { 413 finalResult.contactInfo = {
393 subTitle: '联系信息', 414 subTitle: '联系信息',
@@ -396,15 +417,18 @@ const getUserInfo = (channel, uid) => { @@ -396,15 +417,18 @@ const getUserInfo = (channel, uid) => {
396 labelText: '来自:', 417 labelText: '来自:',
397 selects: [ 418 selects: [
398 { 419 {
399 - key: 'province', 420 + key: 'province'
  421 +
400 // options: getProviceCityInfo(0, areaCode.substr(0, 2)) 422 // options: getProviceCityInfo(0, areaCode.substr(0, 2))
401 }, 423 },
402 { 424 {
403 - key: 'city', 425 + key: 'city'
  426 +
404 // options: getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4)) 427 // options: getProviceCityInfo(areaCode.substr(0, 2), areaCode.substr(0, 4))
405 }, 428 },
406 { 429 {
407 - key: 'areaCode', 430 + key: 'areaCode'
  431 +
408 // options: getProviceCityInfo(areaCode.substr(0, 4), areaCode) 432 // options: getProviceCityInfo(areaCode.substr(0, 4), areaCode)
409 } 433 }
410 ] 434 ]
@@ -495,7 +519,7 @@ const getUserInfo = (channel, uid) => { @@ -495,7 +519,7 @@ const getUserInfo = (channel, uid) => {
495 519
496 for (let i; i < brandArr.length; i++) { 520 for (let i; i < brandArr.length; i++) {
497 for (let j; j < brandList.length; j++) { 521 for (let j; j < brandList.length; j++) {
498 - if (brandList.id == brandArr[i]) { 522 + if (brandList.id === brandArr[i]) {
499 favBrands.push({ 523 favBrands.push({
500 name: brandList.brand_name, 524 name: brandList.brand_name,
501 id: 'brand-' . brandList.id 525 id: 'brand-' . brandList.id
@@ -508,7 +532,7 @@ const getUserInfo = (channel, uid) => { @@ -508,7 +532,7 @@ const getUserInfo = (channel, uid) => {
508 finalResult.favorite = { 532 finalResult.favorite = {
509 subTitle: '喜爱品牌', 533 subTitle: '喜爱品牌',
510 submitId: 'favorite-brand', 534 submitId: 'favorite-brand',
511 - likebrand: (likeBrandStr.substr(0, 1) == ',') ? likeBrandStr : ',' + likeBrandStr, 535 + likebrand: (likeBrandStr.substr(0, 1) === ',') ? likeBrandStr : ',' + likeBrandStr,
512 favoriteBrands: favBrands, 536 favoriteBrands: favBrands,
513 hotBrands: hotBrands 537 hotBrands: hotBrands
514 }; 538 };
@@ -520,30 +544,6 @@ const getUserInfo = (channel, uid) => { @@ -520,30 +544,6 @@ const getUserInfo = (channel, uid) => {
520 }); 544 });
521 }; 545 };
522 546
523 -const getHotBrands = (brandList) => {  
524 - let hotBrands = [],  
525 - i = 20;  
526 -  
527 - if (brandList) {  
528 - for (let j = 0; j < brandList.length; j++) {  
529 - if (brandList[j].is_hot == 'Y') {  
530 - hotBrands.push({  
531 - id: 'pp-' + brandList[j].id,  
532 - name: 'pp[]',  
533 - value: brandList[j].id,  
534 - text: brandList[j].brand_name  
535 - });  
536 - i--;  
537 - }  
538 - if (i <= 0) {  
539 - break;  
540 - }  
541 - }  
542 - }  
543 -  
544 - return hotBrands;  
545 -};  
546 -  
547 const editUserInfo = (req, uid) => { 547 const editUserInfo = (req, uid) => {
548 let userInfo = {}, 548 let userInfo = {},
549 respData; 549 respData;