Authored by 郝肖肖
Committed by yyq

'代码检查'

... ... @@ -43,8 +43,6 @@ exports.getCouponData = (channel, params) => {
break;
}
let i = 0;
coupon.data.forEach(function(val, index) {
// 头部banner
if (val.templateName === 'focus') {
... ... @@ -74,7 +72,6 @@ exports.getCouponData = (channel, params) => {
});
result.categories.push(obj);
i++;
}
});
}
... ... @@ -98,8 +95,6 @@ exports.getCouponStatus = (params) => {
break;
}
let i = 0;
coupon.data.forEach(function(val) {
if (val.template_name === 'getCoupon' && val.data.length) {
// 优惠券楼层
... ... @@ -120,7 +115,6 @@ exports.getCouponStatus = (params) => {
result.categories.push(cou);
}
});
i++;
}
});
}
... ...
... ... @@ -304,57 +304,55 @@ const _getIntroInfo = (productSkn, additionalData)=> {
* @return result Object 格式化数据
*/
const _detailDataPkg = (origin) => {
return co(function*() {
if (_.isEmpty(origin) || _.isEmpty(origin)) {
return {};
}
if (_.isEmpty(origin) || _.isEmpty(origin)) {
return {};
}
let result = {};
let propOrigin = _.partial(_.get, origin);
let result = {};
let propOrigin = _.partial(_.get, origin);
// 商品名称
if (!propOrigin('product_name')) {
return result;
}
// 商品名称
if (!propOrigin('product_name')) {
return result;
}
result.name = propOrigin('product_name');
result.skn = propOrigin('product_skn');
result.productId = propOrigin('product_id');
result.name = propOrigin('product_name');
result.skn = propOrigin('product_skn');
result.productId = propOrigin('product_id');
// 商品价格
result.marketPrice = propOrigin('format_market_price');
result.salePrice = propOrigin('format_sales_price');
result.hasOtherPrice = true;
// 商品价格
result.marketPrice = propOrigin('format_market_price');
result.salePrice = propOrigin('format_sales_price');
result.hasOtherPrice = true;
if (result.salePrice === '0') {
delete result.salePrice;
result.hasOtherPrice = false;
}
if (result.salePrice === '0') {
delete result.salePrice;
result.hasOtherPrice = false;
}
// 上市期
if (propOrigin('expect_arrival_time')) {
result.arrivalDate = `${propOrigin('expect_arrival_time')}月`;
result.presalePrice = propOrigin('format_sales_price');
delete result.salePrice;
result.hasOtherPrice = false;
}
// 上市期
if (propOrigin('expect_arrival_time')) {
result.arrivalDate = `${propOrigin('expect_arrival_time')}月`;
result.presalePrice = propOrigin('format_sales_price');
delete result.salePrice;
result.hasOtherPrice = false;
}
// sku商品信息
let skuData = _getSkuDataByProductBaseInfo(origin);
// sku商品信息
let skuData = _getSkuDataByProductBaseInfo(origin);
// 商品购买状态
let soldOut = !!(propOrigin('status') === 0 || skuData.totalStorageNum === 0);
let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
// 商品购买状态
let soldOut = !!(propOrigin('status') === 0 || skuData.totalStorageNum === 0);
let virtualGoods = propOrigin('attribute') === 3; // 虚拟商品
if (!soldOut && !virtualGoods) {
result.addToCart = 1;
}
if (!soldOut && !virtualGoods) {
result.addToCart = 1;
}
result.isCollect = propOrigin('is_collect');
result.colors = skuData.skuGoods;
result.isCollect = propOrigin('is_collect');
result.colors = skuData.skuGoods;
return result;
})();
return result;
};
/**
... ... @@ -377,13 +375,9 @@ const getProductInfoAsync = (pid) => {
}
let productSkn = _.get(productData, 'data.product_skn');
let requestData = yield Promise.all([
_getProductIntroAsync(productSkn), // 商品详细介绍
_detailDataPkg(productData.data) // 商品详细价格
]);
let productDescription = requestData[0];
let productInfo = requestData[1];
let productDescription = yield _getProductIntroAsync(productSkn);
let productInfo = _detailDataPkg(productData.data);
let intro = _getIntroInfo(productSkn, productDescription);
return Object.assign(productInfo, intro);
... ... @@ -707,7 +701,6 @@ const addToFav = (uid, skuList, hasPromotion, cartDelList) => {
* @return array
*/
const checkUserIsFav = (uid, skuList) => {
return co(function * () {
let result = {};
... ... @@ -724,7 +717,7 @@ const checkUserIsFav = (uid, skuList) => {
return result;
}
return cartApi.checkUserIsFavProductList(uid, skuList);
return yield cartApi.checkUserIsFavProductList(uid, skuList);
})();
};
... ...
... ... @@ -754,20 +754,18 @@ module.exports = class extends global.yoho.BaseModel {
* 分-验证图形验证码-ajax
*/
checkVerifyCode(req) {
return co(function*() {
let captchaCode = _.trim(req.body.verifyCode || '').toLowerCase(),
resqData = {};
let captchaCode = _.trim(req.body.verifyCode || '').toLowerCase(),
resqData = {};
if (captchaCode && captchaCode !== req.session.captcha) {
resqData.code = 400;
resqData.message = '图形验证码不正确';
} else {
resqData.code = 200;
resqData.message = '';
}
if (captchaCode && captchaCode !== req.session.captcha) {
resqData.code = 400;
resqData.message = '图形验证码不正确';
} else {
resqData.code = 200;
resqData.message = '';
}
return resqData;
})();
return Promise.resolve(resqData);
}
/**
... ...
... ... @@ -262,12 +262,8 @@ exports.getCommentList4Order = (uid, orderCode) => {
};
exports.saveShareOrder = data => {
let process = function*() {
return api.post('', {
method: 'show.saveShareOrder',
parameters: JSON.stringify(data)
});
};
return co(process)();
return api.post('', {
method: 'show.saveShareOrder',
parameters: JSON.stringify(data)
});
};
... ...
... ... @@ -92,21 +92,15 @@ const getComplaintsList = (uid, page, limit) => {
* @return { Object } 添加投诉结果
*/
const addComplaints = (uid, params) => {
let process = function*() {
let res = api.post('', {
method: 'web.complaints.add',
uid: uid,
title: _.trim(params.title),
customer: _.trim(params.customer),
complaintsType: _.trim(params.complaintsType),
orderCode: _.trim(params.orderCode),
content: _.trim(params.content)
});
return res;
};
return co(process)();
return api.post('', {
method: 'web.complaints.add',
uid: uid,
title: _.trim(params.title),
customer: _.trim(params.customer),
complaintsType: _.trim(params.complaintsType),
orderCode: _.trim(params.orderCode),
content: _.trim(params.content)
});
};
/**
... ... @@ -117,17 +111,11 @@ const addComplaints = (uid, params) => {
* @return { Object } 撤销投诉结果
*/
const cancelComplaints = (uid, id) => {
let process = function*() {
let res = api.post('', {
method: 'web.complaints.cancel',
uid: uid,
id: id
});
return res;
};
return co(process)();
return api.post('', {
method: 'web.complaints.cancel',
uid: uid,
id: id
});
};
module.exports = {
... ...
This diff could not be displayed because it is too large.
... ... @@ -66,7 +66,6 @@
"eslint": "^3.16.0",
"eslint-config-yoho": "^1.0.1",
"eslint-loader": "^1.6.3",
"extract-text-webpack-plugin": "^2.1.0",
"happypack": "^3.0.3",
"handlebars": "4.0.5",
... ... @@ -95,6 +94,7 @@
"stylelint": "^7.9.0",
"stylelint-config-yoho": "^1.2.8",
"stylelint-webpack-plugin": "^0.7.0",
"stylelint-formatter-table": "^1.0.3",
"webpack": "^2.3.1",
"webpack-dev-server": "^2.4.2",
"yoho-eventproxy": "^0.3.6",
... ...