Authored by 郭成尧

格式化输出结果

... ... @@ -15,9 +15,11 @@ exports.index = (req, res) => {
var id = req.params.id;
detail({
id: id
id: id,
ua: req.get('user-agent') || ''
}).then((result) => {
res.render('detail', {
resultShow: JSON.stringify(result, null, 4),
result: result,
devEnv: true,
module: 'product',
... ...
... ... @@ -98,7 +98,7 @@ const procShowStatus = (data, showStatus, isBeginSale) => {
* @param {[string]} skn 限购商品skn
* @return {[string]} 限购商品跳转url
*/
const getLimitCodeUrl = (productCode, skn) => {
const getLimitCodeUrl = (productCode, skn, ua) => {
var url = 'yohoapp://yoho.app/openwith?limit_product_code=' + productCode + '&product_skn=' + skn;
return url;
... ... @@ -109,7 +109,7 @@ const getLimitCodeUrl = (productCode, skn) => {
* @param origin Object 原始数据
* @return dest Object 格式化数据
*/
const detailDataPkg = (origin, uid, vipLevel) => {
const detailDataPkg = (origin, uid, vipLevel, ua) => {
var dest = {}, // 结果输出
colorGroup = {},
thumbImageList = {},
... ... @@ -462,7 +462,7 @@ const detailDataPkg = (origin, uid, vipLevel) => {
dest = procShowStatus(dest, showStatus, isBeginSale);
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = getLimitCodeUrl(origin.limitProductCode, origin.erpProductId);
dest.cartInfo.limitCodeUrl = getLimitCodeUrl(origin.limitProductCode, origin.erpProductId, ua);
dest.cartInfo.limitProductPay = helpers.url('/cart/index/orderEnsure');
} else {
dest.cartInfo.addToCartUrl = helpers.url('/product/buy_' + origin.id + '_' +
... ... @@ -495,7 +495,7 @@ module.exports = (data) => {
productId: data.id,
method: 'h5.product.data'
})).then(result => {
finalResult = detailDataPkg(result, null, 0);
finalResult = detailDataPkg(result, null, 0, data.ua);
return api.get('', sign.apiSign({
method: 'app.shop.queryShopsByBrandId',
... ...
hello, I am product hbs
<pre>
{{resultShow}}
</pre>
{{# result}}
<div class="good-detail-page yoho-page">
<div class="banner-container">
... ...