评论统计不做TK校验

feature/comment-0620-ch
ch 3 years ago
parent 6892041093
commit a27ce47f65

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-06-20 11:38:48 * @Date: 2022-06-20 11:38:48
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-24 11:15:09 * @LastEditTime: 2022-06-29 16:04:59
* @Description: file content * @Description: file content
*/ */
@ -15,13 +15,18 @@ const BASE_URL = '/mall/comment';
* @param {*} param0 * @param {*} param0
*/ */
export const ApiGetCommentList = (params) => export const ApiGetCommentList = (params) =>
ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment`, params)); ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment`, {
...params,
notVerifyToken : true
}));
/** /**
* 根据商品获取评论总数 * 根据商品获取评论总数
* @param {*} param0 * @param {*} param0
*/ */
export const ApiGetCommentCount = ({productId}) => export const ApiGetCommentCount = ({productId}) =>
ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`)); ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getAllCommentCountByProductId/${productId}`, {
notVerifyToken : true
}));
/** /**
* 根据商品获取标签评论总数 * 根据商品获取标签评论总数
* @param {*} param0 * @param {*} param0
@ -39,7 +44,9 @@ export const ApiGetOrderCommentDetail = ({orderId}) =>
* @param {*} param0 * @param {*} param0
*/ */
export const ApiGetCommentDetail = ({commentId}) => export const ApiGetCommentDetail = ({commentId}) =>
ToAsyncAwait(MsbRequest.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`)); ToAsyncAwait(MsbRequestTk.get(`${BASE_URL}/app/comment/getCommentDetail/${commentId}`, {
notVerifyToken : true
}));
/** /**
* 新增评论 * 新增评论
* @param {*} param0 * @param {*} param0

@ -2,7 +2,7 @@
* @Author: ch * @Author: ch
* @Date: 2022-03-17 17:42:32 * @Date: 2022-03-17 17:42:32
* @LastEditors: ch * @LastEditors: ch
* @LastEditTime: 2022-06-28 11:38:02 * @LastEditTime: 2022-06-29 16:02:20
* @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法 * @Description: 项目接口请求统一处理器返回一个需要token和不需要token的请求封装方法
*/ */
@ -107,24 +107,25 @@ MsbRequestTk.baseUrl = ENV.baseUrl;
MsbRequestTk.use('request', (option) => { MsbRequestTk.use('request', (option) => {
const token = $store.state.token; const token = $store.state.token;
option.header.uid = uuid; option.header.uid = uuid;
if(!token){
if(!token && && !config.headers.notVerifyToken){
// 登录状态处理没有token直接跳转至登录 // 登录状态处理没有token直接跳转至登录
uni.redirectTo({ uni.redirectTo({
url: '/login' url: '/login'
}); });
return Promise.reject({message:'要先登录才能操作哦~'}); return Promise.reject({message:'要先登录才能操作哦~'});
}else{ }
option.header = {...option.header, Authorization:token}; delete config.headers.notVerifyToken
option.header = {...option.header, Authorization:token};
if(option.header.repeat){
// 如果当前请求不允许重复调用,则检查重复请求,当前接口有正在请求则不发起请求 if(option.header.repeat){
const isRepeatVerify = repeatVerify(option); // 如果当前请求不允许重复调用,则检查重复请求,当前接口有正在请求则不发起请求
if(isRepeatVerify){ const isRepeatVerify = repeatVerify(option);
return isRepeatVerify; if(isRepeatVerify){
} return isRepeatVerify;
} }
return option;
} }
return option;
}) })
MsbRequestTk.use('success', successIntercept); MsbRequestTk.use('success', successIntercept);
MsbRequestTk.use('error', errorIntercept); MsbRequestTk.use('error', errorIntercept);

Loading…
Cancel
Save