Authored by 沈志敏

fix bug client_type

... ... @@ -271,7 +271,6 @@ exports.floor = (params, isApp, appVersion) => {
let result = {},
resource = yield api.get('', Object.assign(params, {
method: 'app.promotion.queryCouponCenter',
client_type: isApp ? 'iphone' : 'h5' // 根据不同设备 java端会返回不同的数据
}));
if (resource && resource.code === 200) {
... ...
... ... @@ -2,14 +2,6 @@
const _ = require('lodash');
const api = global.yoho.API;
const privateKeyList = {
android: 'fd4ad5fcfa0de589ef238c0e7331b585',
iphone: 'a85bb0674e08986c6b115d5e3a4884fa',
ipad: 'ad9fcda2e679cf9229e37feae2cdcf80',
web: '0ed29744ed318fd28d2c07985d3ba633',
h5: 'fd4ad5fcfa0de589ef238c0e7331b585'
};
/**
* 购物车结算
* doc: http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/订单/shopping.md
... ... @@ -163,7 +155,6 @@ exports.orderSub = (uid, addressId, cartType, deliveryTime,
}
let params = {
private_key: privateKeyList.h5,
method: activityInfo ? 'app.Shopping.easySubmit' : 'app.Shopping.submit',
address_id: addressId,
cart_type: cartType,
... ...
... ... @@ -89,7 +89,6 @@ const getDetailData = (req, res, next) => {
let udid = req.sessionID || 'yoho';
let gender = req.query.gender || req.cookies._Channel && channels[req.cookies._Channel] || '1,3';
let isApp = req.query.app_version || req.query.appVersion || false;
let clientType = (req.body.client_type || '').toLowerCase();
let userAgent = req.get('User-Agent');
let isWeixin = userAgent.includes('MicroMessenger'); // 标识是否是微信访问
... ... @@ -101,15 +100,7 @@ const getDetailData = (req, res, next) => {
uid = req.user.uid;
}
if (clientType === 'ios' && isApp) {
clientType = 'iphone';
} else if (clientType === 'android' && isApp) {
clientType = 'android';
} else {
clientType = 'h5';
}
plustarModel.getDetailData(id, uid, udid, gender, isApp, clientType).then((result) => {
plustarModel.getDetailData(id, uid, udid, gender, isApp).then((result) => {
result.brand_intro = htmlProcess.removeHtml(result.brand_intro);
if (!isApp & !isWeixin) {
... ... @@ -144,7 +135,6 @@ const getDetailData = (req, res, next) => {
const getDetailDataAsync = (req, res, next) => {
let uid;
let udid = req.sessionID || 'yoho';
let clientType = req.body.client_type || '';
let brandId = req.body.brand_id || 0;
let isApp = req.body.isApp || false;
... ... @@ -159,7 +149,7 @@ const getDetailDataAsync = (req, res, next) => {
if (!brandId) {
return res.json({code: 400, message: '参数错误'});
}
plustarModel.getDetailDataAsync(brandId, uid, udid, clientType, isApp).then((result) => {
plustarModel.getDetailDataAsync(brandId, uid, udid, isApp).then((result) => {
res.json({
isLike: result.isLike,
infos: result.infos
... ...
... ... @@ -9,14 +9,6 @@ const helpers = global.yoho.helpers;
const htmlProcess = require(`${global.utils}/html-process`);
const imageProcess = require(`${global.utils}/image`);
const privateKeyList = {
android: 'fd4ad5fcfa0de589ef238c0e7331b585',
iphone: 'a85bb0674e08986c6b115d5e3a4884fa',
ipad: 'ad9fcda2e679cf9229e37feae2cdcf80',
web: '0ed29744ed318fd28d2c07985d3ba633',
h5: 'fd4ad5fcfa0de589ef238c0e7331b585'
};
const formaData = (data, gender) => {
let build = [];
... ... @@ -232,15 +224,13 @@ const getNewProduct = (brandId, gender, url, isApp) => {
};
// 相关资讯--不能加cache,否则点赞有缓存.
const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => {
const getRelatedEditorial = (brandId, uid, udid, isApp) => {
return serviceAPI.get('guang/service/v1/article/getArticleByBrand', {
brand_id: brandId,
uid: uid,
udid: udid,
client_type: clientType,
limit: 3,
private_key: privateKeyList[clientType]
limit: 3
}).then((result) => {
if (result && result.code === 200) {
... ... @@ -271,12 +261,10 @@ const getRelatedEditorial = (brandId, uid, udid, clientType, isApp) => {
};
// 是否收藏
const isCollection = (brandId, clientType, uid) => {
const isCollection = (brandId, uid) => {
let param = {
brandId: brandId,
client_type: clientType,
private_key: privateKeyList[clientType]
brandId: brandId
};
if (uid) {
... ... @@ -299,11 +287,10 @@ const isCollection = (brandId, clientType, uid) => {
};
// 品牌详情
const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
const getDetailData = (id, uid, udid, gender, isApp) => {
return serviceAPI.get('guang/api/v1/plustar/getbrandinfo', {
id: id,
client_type: clientType
id: id
}, {cache: true}).then((result) => {
if (result && result.code === 200) {
let list = result.data || [];
... ... @@ -337,8 +324,7 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
shareLink: '//guang.m.yohobuy.com/plustar/brandinfo?id=' + id,
shareTitle: list.brand_name,
shareImg: list.brand_ico,
shareDesc: htmlProcess.removeHtml(list.brand_intro),
clientType: clientType
shareDesc: htmlProcess.removeHtml(list.brand_intro)
});
});
... ... @@ -352,10 +338,10 @@ const getDetailData = (id, uid, udid, gender, isApp, clientType) => {
/**
* [品牌详情异步数据]
*/
const getDetailDataAsync = (brandId, uid, udid, clientType, isApp) => {
const getDetailDataAsync = (brandId, uid, udid, isApp) => {
return Promise.all([
isCollection(brandId, clientType, uid),
getRelatedEditorial(brandId, uid, udid, clientType, isApp)
isCollection(brandId, uid),
getRelatedEditorial(brandId, uid, udid, isApp)
]).then((result) => {
return {
isLike: result[0],
... ...
... ... @@ -23,7 +23,7 @@ const contentCode = contentCodeConfig.guang;
const _getResources = (page) => {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: contentCode[page],
client_type: 'iphone'
platform: 'iphone'
}, {
cache: true
}).then((result) => {
... ... @@ -162,8 +162,7 @@ const _processGuangData = (list, flag) => {
const getIndexData = () => {
return api.get('', {
method: 'app.starClass.index',
code: '8adc27fcf5676f356602889afcfd2a8e',
client_type: 'iphone'
code: '8adc27fcf5676f356602889afcfd2a8e'
}, {
cache: true
}).then((result) => {
... ... @@ -185,8 +184,7 @@ const getDetailData = (params, uid) => {
tag: params.tag,
page: params.page || 1,
size: 10,
uid: uid,
client_type: 'iphone'
uid: uid
}, {
cache: true
}).then((result) => {
... ...
... ... @@ -101,7 +101,6 @@
<input id="jump-to-app" type="hidden" value="{{jumpToApp}}">
<input id="brandId" type="hidden" value="{{brand_id}}">
<input id="clientType" type="hidden" value="{{clientType}}">
{{#unless @root.wap.plustar.removeRelatedPost}}
<input id="related-infos-demote" type="hidden" value="1">
{{/unless}}
... ...
<ul class="head-tab" {{#if notIndex}}style="position: fixed;"{{/if}}>
<ul class="head-tab">
{{#each headTab}}
<li {{#if cur}} class="cur" {{/if}} ><a href="{{ url }}" data-bp-id="guang_tab_{{name}}_false">{{ name }}</a></li>
{{/each}}
... ...
... ... @@ -539,8 +539,7 @@ const setMasterCard = (params) => {
const getNotices = () => {
return middleApi('', {
method: 'app.resources.getNotices',
position: 8,
client_type: 'iphone'
position: 8
}, {
cache: true
}).then((res) => {
... ...
... ... @@ -5,14 +5,12 @@ let dbClass = 'data-bind',
module.exports = function(callback) {
let brandId = $('#brandId').val();
let clientType = $('#clientType').val();
if (brandId && $('#related-infos-demote').length) {
$.ajax({
type: 'POST',
url: '/guang/plustar/brandinfoAsync',
data: {
client_type: clientType,
brand_id: brandId,
isApp: isApp,
uid: uid
... ...
.star-page {
.collocation-list {
padding-top: 88px;
}
.collocation-list,
.detail-list {
width: 100%;
... ...
... ... @@ -3,7 +3,6 @@
width: 100%;
height: auto;
overflow: hidden;
padding-top: 88px;
li {
width: 100%;
... ...
... ... @@ -33,8 +33,6 @@
}
.head-tab {
position: fixed;
top: 0;
width: 640px;
height: 88px;
background: #000;
... ...