env:后端的请求地址,调整到 env 里

pull/38/head
YunaiV 2024-01-20 13:13:28 +08:00
parent 80f80e358f
commit 33d57fd7e5
33 changed files with 130 additions and 145 deletions

15
.env
View File

@ -1,18 +1,19 @@
# 版本号 # 版本号
SHOPRO_VERSION = v1.8.3 SHOPRO_VERSION = v1.8.3
# 正式环境接口域名 # 后端接口 - 正式环境(通过 process.env.NODE_ENV = development
SHOPRO_BASE_URL = https://api.shopro.sheepjs.com SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn
# 开发环境接口域名 # 后端接口 - 测试环境(通过 process.env.NODE_ENV 非 development
SHOPRO_DEV_BASE_URL = https://api.shopro.sheepjs.com SHOPRO_DEV_BASE_URL = http://127.0.0.1:48080
### SHOPRO_DEV_BASE_URL = http://yunai.natapp1.cc
# 后端接口前缀(一般不建议调整)
SHOPRO_API_PATH = /app-api
# 开发环境运行端口 # 开发环境运行端口
SHOPRO_DEV_PORT = 3000 SHOPRO_DEV_PORT = 3000
# 接口地址前缀
SHOPRO_API_PATH = /shop/api/
# 客户端静态资源地址 空=默认使用服务端指定的CDN资源地址前缀 | local=本地 | http(s)://xxx.xxx=自定义静态资源地址前缀 # 客户端静态资源地址 空=默认使用服务端指定的CDN资源地址前缀 | local=本地 | http(s)://xxx.xxx=自定义静态资源地址前缀
SHOPRO_STATIC_URL = https://file.sheepjs.com SHOPRO_STATIC_URL = https://file.sheepjs.com

View File

@ -1,27 +1,25 @@
import { baseUrl, apiPath } from '@/sheep/config';
const FileApi = { const FileApi = {
// 上传文件 // 上传文件
uploadFile: (file) => { uploadFile: (file) => {
// TODO 芋艿:访问令牌的接入;
const token = uni.getStorageSync('token'); const token = uni.getStorageSync('token');
uni.showLoading({ uni.showLoading({
title: '上传中', title: '上传中',
}); });
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// 此处先换成yudao
// TODO 芋艿:后续搞下
uni.uploadFile({ uni.uploadFile({
// url: 'http://api-dashboard.yudao.iocoder.cn' + '/app-api/infra/file/upload', url: baseUrl + apiPath + '/infra/file/upload',
url: 'http://127.0.0.1:48080' + '/app-api/infra/file/upload',
filePath: file, filePath: file,
name: 'file', name: 'file',
header: { header: {
// Accept: 'text/json', // Accept: 'text/json',
// Authorization: token,
Accept : '*/*', Accept : '*/*',
'tenant-id' :'1', 'tenant-id' :'1',
// Authorization: 'Bearer test247', // Authorization: 'Bearer test247',
}, },
success: (uploadFileRes) => { success: (uploadFileRes) => {
debugger
let result = JSON.parse(uploadFileRes.data); let result = JSON.parse(uploadFileRes.data);
if (result.error === 1) { if (result.error === 1) {
uni.showToast({ uni.showToast({

View File

@ -4,14 +4,14 @@ const AddressApi = {
// 获得用户收件地址列表 // 获得用户收件地址列表
getAddressList: () => { getAddressList: () => {
return request({ return request({
url: '/app-api/member/address/list', url: '/member/address/list',
method: 'GET' method: 'GET'
}); });
}, },
// 创建用户收件地址 // 创建用户收件地址
createAddress: (data) => { createAddress: (data) => {
return request({ return request({
url: '/app-api/member/address/create', url: '/member/address/create',
method: 'POST', method: 'POST',
data data
}); });
@ -19,7 +19,7 @@ const AddressApi = {
// 更新用户收件地址 // 更新用户收件地址
updateAddress: (data) => { updateAddress: (data) => {
return request({ return request({
url: '/app-api/member/address/update', url: '/member/address/update',
method: 'PUT', method: 'PUT',
data data
}); });
@ -27,7 +27,7 @@ const AddressApi = {
// 获得用户收件地址 // 获得用户收件地址
getAddress: (id) => { getAddress: (id) => {
return request({ return request({
url: '/app-api/member/address/get', url: '/member/address/get',
method: 'GET', method: 'GET',
params: { id } params: { id }
}); });
@ -35,7 +35,7 @@ const AddressApi = {
// 删除用户收件地址 // 删除用户收件地址
deleteAddress: (id) => { deleteAddress: (id) => {
return request({ return request({
url: '/app-api/member/address/delete', url: '/member/address/delete',
method: 'DELETE', method: 'DELETE',
params: { id } params: { id }
}); });

View File

@ -4,7 +4,7 @@ const AuthUtil = {
// 使用手机 + 密码登录 // 使用手机 + 密码登录
login: (data) => { login: (data) => {
return request({ return request({
url: '/app-api/member/auth/login', url: '/member/auth/login',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
@ -17,7 +17,7 @@ const AuthUtil = {
// 使用手机 + 验证码登录 // 使用手机 + 验证码登录
smsLogin: (data) => { smsLogin: (data) => {
return request({ return request({
url: '/app-api/member/auth/sms-login', url: '/member/auth/sms-login',
method: 'POST', method: 'POST',
data, data,
custom: { custom: {
@ -30,7 +30,7 @@ const AuthUtil = {
// 发送手机验证码 // 发送手机验证码
sendSmsCode: (mobile, scene) => { sendSmsCode: (mobile, scene) => {
return request({ return request({
url: '/app-api/member/auth/send-sms-code', url: '/member/auth/send-sms-code',
method: 'POST', method: 'POST',
data: { data: {
mobile, mobile,
@ -46,14 +46,14 @@ const AuthUtil = {
// 登出系统 // 登出系统
logout: () => { logout: () => {
return request({ return request({
url: '/app-api/member/auth/logout', url: '/member/auth/logout',
method: 'POST', method: 'POST',
}); });
}, },
// 刷新令牌 // 刷新令牌
refreshToken: (refreshToken) => { refreshToken: (refreshToken) => {
return request({ return request({
url: '/app-api/member/auth/refresh-token', url: '/member/auth/refresh-token',
method: 'POST', method: 'POST',
params: { params: {
refreshToken refreshToken
@ -67,7 +67,7 @@ const AuthUtil = {
// 社交授权的跳转 // 社交授权的跳转
socialAuthRedirect: (type, redirectUri) => { socialAuthRedirect: (type, redirectUri) => {
return request({ return request({
url: '/app-api/member/auth/social-auth-redirect', url: '/member/auth/social-auth-redirect',
method: 'GET', method: 'GET',
params: { params: {
type, type,
@ -82,7 +82,7 @@ const AuthUtil = {
// 社交快捷登录 // 社交快捷登录
socialLogin: (type, code, state) => { socialLogin: (type, code, state) => {
return request({ return request({
url: '/app-api/member/auth/social-login', url: '/member/auth/social-login',
method: 'POST', method: 'POST',
data: { data: {
type, type,
@ -98,7 +98,7 @@ const AuthUtil = {
// 微信小程序的一键登录 // 微信小程序的一键登录
weixinMiniAppLogin: (phoneCode, loginCode, state) => { weixinMiniAppLogin: (phoneCode, loginCode, state) => {
return request({ return request({
url: '/app-api/member/auth/weixin-mini-app-login', url: '/member/auth/weixin-mini-app-login',
method: 'POST', method: 'POST',
data: { data: {
phoneCode, phoneCode,
@ -115,7 +115,7 @@ const AuthUtil = {
// 创建微信 JS SDK 初始化所需的签名 // 创建微信 JS SDK 初始化所需的签名
createWeixinMpJsapiSignature: (url) => { createWeixinMpJsapiSignature: (url) => {
return request({ return request({
url: '/app-api/member/auth/create-weixin-jsapi-signature', url: '/member/auth/create-weixin-jsapi-signature',
method: 'POST', method: 'POST',
params: { params: {
url url

View File

@ -10,7 +10,7 @@ const PointApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/member/point/record/page?${queryString}`, url: `/member/point/record/page?${queryString}`,
method: 'GET', method: 'GET',
}); });
} }

View File

@ -4,21 +4,21 @@ const SignInApi = {
// 获得签到规则列表 // 获得签到规则列表
getSignInConfigList: () => { getSignInConfigList: () => {
return request({ return request({
url: '/app-api/member/sign-in/config/list', url: '/member/sign-in/config/list',
method: 'GET', method: 'GET',
}); });
}, },
// 获得个人签到统计 // 获得个人签到统计
getSignInRecordSummary: () => { getSignInRecordSummary: () => {
return request({ return request({
url: '/app-api/member/sign-in/record/get-summary', url: '/member/sign-in/record/get-summary',
method: 'GET', method: 'GET',
}); });
}, },
// 签到 // 签到
createSignInRecord: () => { createSignInRecord: () => {
return request({ return request({
url: '/app-api/member/sign-in/record/create', url: '/member/sign-in/record/create',
method: 'POST', method: 'POST',
}); });
}, },
@ -28,7 +28,7 @@ const SignInApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/member/sign-in/record/page?${queryString}`, url: `/member/sign-in/record/page?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },

View File

@ -4,7 +4,7 @@ const SocialApi = {
// 获得社交用户 // 获得社交用户
getSocialUser: (type) => { getSocialUser: (type) => {
return request({ return request({
url: '/app-api/member/social-user/get', url: '/member/social-user/get',
method: 'GET', method: 'GET',
params: { params: {
type type
@ -17,7 +17,7 @@ const SocialApi = {
// 社交绑定 // 社交绑定
socialBind: (type, code, state) => { socialBind: (type, code, state) => {
return request({ return request({
url: '/app-api/member/social-user/bind', url: '/member/social-user/bind',
method: 'POST', method: 'POST',
data: { data: {
type, type,
@ -36,7 +36,7 @@ const SocialApi = {
// 社交绑定 // 社交绑定
socialUnbind: (type, openid) => { socialUnbind: (type, openid) => {
return request({ return request({
url: '/app-api/member/social-user/unbind', url: '/member/social-user/unbind',
method: 'DELETE', method: 'DELETE',
data: { data: {
type, type,

View File

@ -4,7 +4,7 @@ const UserApi = {
// 获得基本信息 // 获得基本信息
getUserInfo: () => { getUserInfo: () => {
return request({ return request({
url: '/app-api/member/user/get', url: '/member/user/get',
method: 'GET', method: 'GET',
custom: { custom: {
showLoading: false, showLoading: false,
@ -15,7 +15,7 @@ const UserApi = {
// 修改基本信息 // 修改基本信息
updateUser: (data) => { updateUser: (data) => {
return request({ return request({
url: '/app-api/member/user/update', url: '/member/user/update',
method: 'PUT', method: 'PUT',
data, data,
custom: { custom: {
@ -27,7 +27,7 @@ const UserApi = {
// 修改用户手机 // 修改用户手机
updateUserMobile: (data) => { updateUserMobile: (data) => {
return request({ return request({
url: '/app-api/member/user/update-mobile', url: '/member/user/update-mobile',
method: 'PUT', method: 'PUT',
data, data,
custom: { custom: {
@ -40,7 +40,7 @@ const UserApi = {
// 基于微信小程序的授权码,修改用户手机 // 基于微信小程序的授权码,修改用户手机
updateUserMobileByWeixin: (code) => { updateUserMobileByWeixin: (code) => {
return request({ return request({
url: '/app-api/member/user/update-mobile-by-weixin', url: '/member/user/update-mobile-by-weixin',
method: 'PUT', method: 'PUT',
data: { data: {
code code
@ -55,7 +55,7 @@ const UserApi = {
// 修改密码 // 修改密码
updateUserPassword: (data) => { updateUserPassword: (data) => {
return request({ return request({
url: '/app-api/member/user/update-password', url: '/member/user/update-password',
method: 'PUT', method: 'PUT',
data, data,
custom: { custom: {
@ -68,7 +68,7 @@ const UserApi = {
// 重置密码 // 重置密码
resetUserPassword: (data) => { resetUserPassword: (data) => {
return request({ return request({
url: '/app-api/member/user/reset-password', url: '/member/user/reset-password',
method: 'PUT', method: 'PUT',
data, data,
custom: { custom: {

View File

@ -4,7 +4,7 @@ const PayChannelApi = {
// 获得指定应用的开启的支付渠道编码列表 // 获得指定应用的开启的支付渠道编码列表
getEnableChannelCodeList: (appId) => { getEnableChannelCodeList: (appId) => {
return request({ return request({
url: '/app-api/pay/channel/get-enable-code-list', url: '/pay/channel/get-enable-code-list',
method: 'GET', method: 'GET',
params: { appId } params: { appId }
}); });

View File

@ -4,7 +4,7 @@ const PayOrderApi = {
// 获得支付订单 // 获得支付订单
getOrder: (id) => { getOrder: (id) => {
return request({ return request({
url: '/app-api/pay/order/get', url: '/pay/order/get',
method: 'GET', method: 'GET',
params: { id } params: { id }
}); });
@ -12,7 +12,7 @@ const PayOrderApi = {
// 提交支付订单 // 提交支付订单
submitOrder: (data) => { submitOrder: (data) => {
return request({ return request({
url: '/app-api/pay/order/submit', url: '/pay/order/submit',
method: 'POST', method: 'POST',
data data
}); });

View File

@ -4,7 +4,7 @@ const PayWalletApi = {
// 获取钱包 // 获取钱包
getPayWallet() { getPayWallet() {
return request({ return request({
url: '/app-api/pay/wallet/get', url: '/pay/wallet/get',
method: 'GET', method: 'GET',
custom: { custom: {
showLoading: false, showLoading: false,
@ -18,7 +18,7 @@ const PayWalletApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/pay/wallet-transaction/page?${queryString}`, url: `/pay/wallet-transaction/page?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },
@ -26,8 +26,8 @@ const PayWalletApi = {
getWalletTransactionSummary: (params) => { getWalletTransactionSummary: (params) => {
const queryString = `createTime=${params.createTime[0]}&createTime=${params.createTime[1]}`; const queryString = `createTime=${params.createTime[0]}&createTime=${params.createTime[1]}`;
return request({ return request({
url: `/app-api/pay/wallet-transaction/get-summary?${queryString}`, url: `/pay/wallet-transaction/get-summary?${queryString}`,
// url: `/app-api/pay/wallet-transaction/get-summary`, // url: `/pay/wallet-transaction/get-summary`,
method: 'GET', method: 'GET',
// params: params // params: params
}); });
@ -35,7 +35,7 @@ const PayWalletApi = {
// 获得钱包充值套餐列表 // 获得钱包充值套餐列表
getWalletRechargePackageList: () => { getWalletRechargePackageList: () => {
return request({ return request({
url: '/app-api/pay/wallet-recharge-package/list', url: '/pay/wallet-recharge-package/list',
method: 'GET', method: 'GET',
custom: { custom: {
showError: false, showError: false,
@ -46,7 +46,7 @@ const PayWalletApi = {
// 创建钱包充值记录(发起充值) // 创建钱包充值记录(发起充值)
createWalletRecharge: (data) => { createWalletRecharge: (data) => {
return request({ return request({
url: '/app-api/pay/wallet-recharge/create', url: '/pay/wallet-recharge/create',
method: 'POST', method: 'POST',
data, data,
}); });
@ -54,7 +54,7 @@ const PayWalletApi = {
// 获得钱包充值记录分页 // 获得钱包充值记录分页
getWalletRechargePage: (params) => { getWalletRechargePage: (params) => {
return request({ return request({
url: '/app-api/pay/wallet-recharge/page', url: '/pay/wallet-recharge/page',
method: 'GET', method: 'GET',
params, params,
custom: { custom: {

View File

@ -4,14 +4,14 @@ const CategoryApi = {
// 查询分类列表 // 查询分类列表
getCategoryList: () => { getCategoryList: () => {
return request({ return request({
url: '/app-api/product/category/list', url: '/product/category/list',
method: 'GET', method: 'GET',
}); });
}, },
// 查询分类列表,指定编号 // 查询分类列表,指定编号
getCategoryListByIds: (ids) => { getCategoryListByIds: (ids) => {
return request({ return request({
url: '/app-api/product/category/list-by-ids', url: '/product/category/list-by-ids',
method: 'GET', method: 'GET',
params: { ids }, params: { ids },
}); });

View File

@ -4,7 +4,7 @@ const CommentApi = {
// 获得商品评价分页 // 获得商品评价分页
getCommentPage: (spuId, pageNo, pageSize, type) => { getCommentPage: (spuId, pageNo, pageSize, type) => {
return request({ return request({
url: '/app-api/product/comment/page', url: '/product/comment/page',
method: 'GET', method: 'GET',
params: { params: {
spuId, spuId,

View File

@ -4,7 +4,7 @@ const FavoriteApi = {
// 获得商品收藏分页 // 获得商品收藏分页
getFavoritePage: (data) => { getFavoritePage: (data) => {
return request({ return request({
url: '/app-api/product/favorite/page', url: '/product/favorite/page',
method: 'GET', method: 'GET',
params: data params: data
}); });
@ -12,7 +12,7 @@ const FavoriteApi = {
// 检查是否收藏过商品 // 检查是否收藏过商品
isFavoriteExists: (spuId) => { isFavoriteExists: (spuId) => {
return request({ return request({
url: '/app-api/product/favorite/exits', url: '/product/favorite/exits',
method: 'GET', method: 'GET',
params: { params: {
spuId spuId
@ -22,7 +22,7 @@ const FavoriteApi = {
// 添加商品收藏 // 添加商品收藏
createFavorite: (spuId) => { createFavorite: (spuId) => {
return request({ return request({
url: '/app-api/product/favorite/create', url: '/product/favorite/create',
method: 'POST', method: 'POST',
data: { data: {
spuId spuId
@ -32,7 +32,7 @@ const FavoriteApi = {
// 取消商品收藏 // 取消商品收藏
deleteFavorite: (spuId) => { deleteFavorite: (spuId) => {
return request({ return request({
url: '/app-api/product/favorite/delete', url: '/product/favorite/delete',
method: 'DELETE', method: 'DELETE',
data: { data: {
spuId spuId

View File

@ -4,7 +4,7 @@ const SpuHistoryApi = {
// 删除商品浏览记录 // 删除商品浏览记录
deleteBrowseHistory: (spuIds) => { deleteBrowseHistory: (spuIds) => {
return request({ return request({
url: '/app-api/product/browse-history/delete', url: '/product/browse-history/delete',
method: 'DELETE', method: 'DELETE',
data: { spuIds }, data: { spuIds },
}); });
@ -12,14 +12,14 @@ const SpuHistoryApi = {
// 清空商品浏览记录 // 清空商品浏览记录
cleanBrowseHistory: () => { cleanBrowseHistory: () => {
return request({ return request({
url: '/app-api/product/browse-history/clean', url: '/product/browse-history/clean',
method: 'DELETE', method: 'DELETE',
}); });
}, },
// 获得商品浏览记录分页 // 获得商品浏览记录分页
getBrowseHistoryPage: (data) => { getBrowseHistoryPage: (data) => {
return request({ return request({
url: '/app-api/product/browse-history/page', url: '/product/browse-history/page',
method: 'GET', method: 'GET',
data data
}); });

View File

@ -4,7 +4,7 @@ const SpuApi = {
// 获得商品 SPU 列表 // 获得商品 SPU 列表
getSpuList: (recommendType) => { getSpuList: (recommendType) => {
return request({ return request({
url: '/app-api/product/spu/list', url: '/product/spu/list',
method: 'GET', method: 'GET',
params: {recommendType}, params: {recommendType},
}); });
@ -12,7 +12,7 @@ const SpuApi = {
// 获得商品 SPU 列表 // 获得商品 SPU 列表
getSpuListByIds: (ids) => { getSpuListByIds: (ids) => {
return request({ return request({
url: '/app-api/product/spu/list-by-ids', url: '/product/spu/list-by-ids',
method: 'GET', method: 'GET',
params: {ids}, params: {ids},
}); });
@ -20,7 +20,7 @@ const SpuApi = {
// 获得商品 SPU 分页 // 获得商品 SPU 分页
getSpuPage: (data) => { getSpuPage: (data) => {
return request({ return request({
url: '/app-api/product/spu/page', url: '/product/spu/page',
method: 'GET', method: 'GET',
data data
}); });
@ -28,7 +28,7 @@ const SpuApi = {
// 查询商品 // 查询商品
getSpuDetail: (id) => { getSpuDetail: (id) => {
return request({ return request({
url: '/app-api/product/spu/get-detail', url: '/product/spu/get-detail',
method: 'GET', method: 'GET',
params: { id }, params: { id },
}); });

View File

@ -4,7 +4,7 @@ const ActivityApi = {
// 获得单个商品,近期参与的每个活动 // 获得单个商品,近期参与的每个活动
getActivityListBySpuId: (spuId) => { getActivityListBySpuId: (spuId) => {
return request({ return request({
url: '/app-api/promotion/activity/list-by-spu-id', url: '/promotion/activity/list-by-spu-id',
method: 'GET', method: 'GET',
params: { params: {
spuId, spuId,

View File

@ -4,7 +4,7 @@ export default {
// 获得文章详情 // 获得文章详情
getArticle: (id, title) => { getArticle: (id, title) => {
return request({ return request({
url: '/app-api/promotion/article/get', url: '/promotion/article/get',
method: 'GET', method: 'GET',
params: { id, title } params: { id, title }
}); });

View File

@ -4,21 +4,21 @@ const BargainApi = {
// 获得砍价记录的概要信息 // 获得砍价记录的概要信息
getBargainRecordSummary: () => { getBargainRecordSummary: () => {
return request({ return request({
url: '/app-api/promotion/bargain-record/get-summary', url: '/promotion/bargain-record/get-summary',
method: 'GET', method: 'GET',
}); });
}, },
// 获得砍价活动分页 // 获得砍价活动分页
getBargainActivityPage: () => { getBargainActivityPage: () => {
return request({ return request({
url: '/app-api/promotion/bargain-activity/page', url: '/promotion/bargain-activity/page',
method: 'GET', method: 'GET',
}); });
}, },
// 获得砍价活动详情 // 获得砍价活动详情
getBargainActivityDetail(params) { getBargainActivityDetail(params) {
return request({ return request({
url: '/app-api/promotion/bargain-activity/get-detail', url: '/promotion/bargain-activity/get-detail',
method: 'GET', method: 'GET',
params, params,
}); });

View File

@ -5,7 +5,7 @@ const CombinationApi = {
// 获得拼团活动列表 // 获得拼团活动列表
getCombinationActivityList: (count) => { getCombinationActivityList: (count) => {
return request({ return request({
url: '/app-api/promotion/combination-activity/list', url: '/promotion/combination-activity/list',
method: 'GET', method: 'GET',
params: { count }, params: { count },
}); });
@ -14,7 +14,7 @@ const CombinationApi = {
// 获得拼团活动分页 // 获得拼团活动分页
getCombinationActivityPage: (params) => { getCombinationActivityPage: (params) => {
return request({ return request({
url: '/app-api/promotion/combination-activity/page', url: '/promotion/combination-activity/page',
method: 'GET', method: 'GET',
params, params,
}); });
@ -23,7 +23,7 @@ const CombinationApi = {
// 获得拼团活动明细 // 获得拼团活动明细
getCombinationActivity: (id) => { getCombinationActivity: (id) => {
return request({ return request({
url: '/app-api/promotion/combination-activity/get-detail', url: '/promotion/combination-activity/get-detail',
method: 'GET', method: 'GET',
params: { params: {
id, id,
@ -34,7 +34,7 @@ const CombinationApi = {
// 获得最近 n 条拼团记录(团长发起的) // 获得最近 n 条拼团记录(团长发起的)
getHeadCombinationRecordList: (activityId, status, count) => { getHeadCombinationRecordList: (activityId, status, count) => {
return request({ return request({
url: '/app-api/promotion/combination-record/get-head-list', url: '/promotion/combination-record/get-head-list',
method: 'GET', method: 'GET',
params: { params: {
activityId, activityId,
@ -47,7 +47,7 @@ const CombinationApi = {
// 获得我的拼团记录分页 // 获得我的拼团记录分页
getCombinationRecordPage: (params) => { getCombinationRecordPage: (params) => {
return request({ return request({
url: "/app-api/promotion/combination-record/page", url: "/promotion/combination-record/page",
method: 'GET', method: 'GET',
params params
}); });
@ -56,7 +56,7 @@ const CombinationApi = {
// 获得拼团记录明细 // 获得拼团记录明细
getCombinationRecordDetail: (id) => { getCombinationRecordDetail: (id) => {
return request({ return request({
url: '/app-api/promotion/combination-record/get-detail', url: '/promotion/combination-record/get-detail',
method: 'GET', method: 'GET',
params: { params: {
id, id,
@ -67,7 +67,7 @@ const CombinationApi = {
// 获得拼团记录的概要信息 // 获得拼团记录的概要信息
getCombinationRecordSummary: () => { getCombinationRecordSummary: () => {
return request({ return request({
url: '/app-api/promotion/combination-record/get-summary', url: '/promotion/combination-record/get-summary',
method: 'GET', method: 'GET',
}); });
}, },

View File

@ -4,7 +4,7 @@ const CouponApi = {
// 获得优惠劵模板列表 // 获得优惠劵模板列表
getCouponTemplateListByIds: (ids) => { getCouponTemplateListByIds: (ids) => {
return request({ return request({
url: '/app-api/promotion/coupon-template/list-by-ids', url: '/promotion/coupon-template/list-by-ids',
method: 'GET', method: 'GET',
params: { ids }, params: { ids },
}); });
@ -12,7 +12,7 @@ const CouponApi = {
// 获得优惠劵模版列表 // 获得优惠劵模版列表
getCouponTemplateList: (spuId, productScope, count) => { getCouponTemplateList: (spuId, productScope, count) => {
return request({ return request({
url: '/app-api/promotion/coupon-template/list', url: '/promotion/coupon-template/list',
method: 'GET', method: 'GET',
params: { spuId, productScope, count }, params: { spuId, productScope, count },
}); });
@ -20,7 +20,7 @@ const CouponApi = {
// 获得优惠劵模版分页 // 获得优惠劵模版分页
getCouponTemplatePage: (params) => { getCouponTemplatePage: (params) => {
return request({ return request({
url: '/app-api/promotion/coupon-template/page', url: '/promotion/coupon-template/page',
method: 'GET', method: 'GET',
params, params,
}); });
@ -28,7 +28,7 @@ const CouponApi = {
// 获得优惠劵模版 // 获得优惠劵模版
getCouponTemplate: (id) => { getCouponTemplate: (id) => {
return request({ return request({
url: '/app-api/promotion/coupon-template/get', url: '/promotion/coupon-template/get',
method: 'GET', method: 'GET',
params: { id }, params: { id },
}); });
@ -36,7 +36,7 @@ const CouponApi = {
// 我的优惠劵列表 // 我的优惠劵列表
getCouponPage: (params) => { getCouponPage: (params) => {
return request({ return request({
url: '/app-api/promotion/coupon/page', url: '/promotion/coupon/page',
method: 'GET', method: 'GET',
params, params,
}); });
@ -44,7 +44,7 @@ const CouponApi = {
// 领取优惠券 // 领取优惠券
takeCoupon: (templateId) => { takeCoupon: (templateId) => {
return request({ return request({
url: '/app-api/promotion/coupon/take', url: '/promotion/coupon/take',
method: 'POST', method: 'POST',
data: { templateId }, data: { templateId },
}); });
@ -52,7 +52,7 @@ const CouponApi = {
// 获得优惠劵 // 获得优惠劵
getCoupon: (id) => { getCoupon: (id) => {
return request({ return request({
url: '/app-api/promotion/coupon/get', url: '/promotion/coupon/get',
method: 'GET', method: 'GET',
params: { id }, params: { id },
}); });
@ -60,7 +60,7 @@ const CouponApi = {
// 获得未使用的优惠劵数量 // 获得未使用的优惠劵数量
getUnusedCouponCount: () => { getUnusedCouponCount: () => {
return request({ return request({
url: '/app-api/promotion/coupon/get-unused-count', url: '/promotion/coupon/get-unused-count',
method: 'GET', method: 'GET',
custom: { custom: {
showLoading: false, showLoading: false,
@ -71,7 +71,7 @@ const CouponApi = {
// 获得匹配指定商品的优惠劵列表 // 获得匹配指定商品的优惠劵列表
getMatchCouponList: (price, spuIds, skuIds, categoryIds) => { getMatchCouponList: (price, spuIds, skuIds, categoryIds) => {
return request({ return request({
url: '/app-api/promotion/coupon/match-list', url: '/promotion/coupon/match-list',
method: 'GET', method: 'GET',
params: { params: {
price, price,

View File

@ -3,7 +3,7 @@ import request from '@/sheep/request';
const DiyPageApi = { const DiyPageApi = {
getDiyPage: (id) => { getDiyPage: (id) => {
return request({ return request({
url: '/app-api/promotion/diy-page/get', url: '/promotion/diy-page/get',
method: 'GET', method: 'GET',
params: { params: {
id id

View File

@ -3,13 +3,13 @@ import request from '@/sheep/request';
const DiyTemplateApi = { const DiyTemplateApi = {
getUsedDiyTemplate: () => { getUsedDiyTemplate: () => {
return request({ return request({
url: '/app-api/promotion/diy-template/used', url: '/promotion/diy-template/used',
method: 'GET', method: 'GET',
}); });
}, },
getDiyTemplate: (id) => { getDiyTemplate: (id) => {
return request({ return request({
url: '/app-api/promotion/diy-template/get', url: '/promotion/diy-template/get',
method: 'GET', method: 'GET',
params: { params: {
id id

View File

@ -4,7 +4,7 @@ const RewardActivityApi = {
// 获得满减送活动 // 获得满减送活动
getRewardActivity: (id) => { getRewardActivity: (id) => {
return request({ return request({
url: '/app-api/promotion/reward-activity/get', url: '/promotion/reward-activity/get',
method: 'GET', method: 'GET',
params: { id }, params: { id },
}); });

View File

@ -4,7 +4,7 @@ const AreaApi = {
// 获得地区树 // 获得地区树
getAreaTree: () => { getAreaTree: () => {
return request({ return request({
url: '/app-api/system/area/tree', url: '/system/area/tree',
method: 'GET' method: 'GET'
}); });
}, },

View File

@ -4,7 +4,7 @@ const AfterSaleApi = {
// 获得售后分页 // 获得售后分页
getAfterSalePage: (params) => { getAfterSalePage: (params) => {
return request({ return request({
url: `/app-api/trade/after-sale/page`, url: `/trade/after-sale/page`,
method: 'GET', method: 'GET',
params, params,
custom: { custom: {
@ -15,7 +15,7 @@ const AfterSaleApi = {
// 创建售后 // 创建售后
createAfterSale: (data) => { createAfterSale: (data) => {
return request({ return request({
url: `/app-api/trade/after-sale/create`, url: `/trade/after-sale/create`,
method: 'POST', method: 'POST',
data, data,
}); });
@ -23,7 +23,7 @@ const AfterSaleApi = {
// 获得售后 // 获得售后
getAfterSale: (id) => { getAfterSale: (id) => {
return request({ return request({
url: `/app-api/trade/after-sale/get`, url: `/trade/after-sale/get`,
method: 'GET', method: 'GET',
params: { params: {
id, id,
@ -33,7 +33,7 @@ const AfterSaleApi = {
// 取消售后 // 取消售后
cancelAfterSale: (id) => { cancelAfterSale: (id) => {
return request({ return request({
url: `/app-api/trade/after-sale/cancel`, url: `/trade/after-sale/cancel`,
method: 'DELETE', method: 'DELETE',
params: { params: {
id, id,
@ -43,7 +43,7 @@ const AfterSaleApi = {
// 获得售后日志列表 // 获得售后日志列表
getAfterSaleLogList: (afterSaleId) => { getAfterSaleLogList: (afterSaleId) => {
return request({ return request({
url: `/app-api/trade/after-sale-log/list`, url: `/trade/after-sale-log/list`,
method: 'GET', method: 'GET',
params: { params: {
afterSaleId, afterSaleId,
@ -53,7 +53,7 @@ const AfterSaleApi = {
// 退回货物 // 退回货物
deliveryAfterSale: (data) => { deliveryAfterSale: (data) => {
return request({ return request({
url: `/app-api/trade/after-sale/delivery`, url: `/trade/after-sale/delivery`,
method: 'PUT', method: 'PUT',
data, data,
}); });

View File

@ -4,14 +4,14 @@ const BrokerageApi = {
// 获得个人分销信息 // 获得个人分销信息
getBrokerageUser: () => { getBrokerageUser: () => {
return request({ return request({
url: '/app-api/trade/brokerage-user/get', url: '/trade/brokerage-user/get',
method: 'GET' method: 'GET'
}); });
}, },
// 获得个人分销统计 // 获得个人分销统计
getBrokerageUserSummary: () => { getBrokerageUserSummary: () => {
return request({ return request({
url: '/app-api/trade/brokerage-user/get-summary', url: '/trade/brokerage-user/get-summary',
method: 'GET', method: 'GET',
}); });
}, },
@ -24,14 +24,14 @@ const BrokerageApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/trade/brokerage-record/page?${queryString}`, url: `/trade/brokerage-record/page?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },
// 创建分销提现 // 创建分销提现
createBrokerageWithdraw: (data) => { createBrokerageWithdraw: (data) => {
return request({ return request({
url: '/app-api/trade/brokerage-withdraw/create', url: '/trade/brokerage-withdraw/create',
method: 'POST', method: 'POST',
data, data,
}); });
@ -39,7 +39,7 @@ const BrokerageApi = {
// 获得商品的分销金额 // 获得商品的分销金额
getProductBrokeragePrice: (spuId) => { getProductBrokeragePrice: (spuId) => {
return request({ return request({
url: '/app-api/trade/brokerage-record/get-product-brokerage-price', url: '/trade/brokerage-record/get-product-brokerage-price',
method: 'GET', method: 'GET',
params: { params: {
spuId spuId
@ -50,7 +50,7 @@ const BrokerageApi = {
getRankByPrice: (params) => { getRankByPrice: (params) => {
const queryString = `times=${params.times[0]}&times=${params.times[1]}`; const queryString = `times=${params.times[0]}&times=${params.times[1]}`;
return request({ return request({
url: `/app-api/trade/brokerage-user/get-rank-by-price?${queryString}`, url: `/trade/brokerage-user/get-rank-by-price?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },
@ -60,7 +60,7 @@ const BrokerageApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/trade/brokerage-user/rank-page-by-price?${queryString}`, url: `/trade/brokerage-user/rank-page-by-price?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },
@ -70,14 +70,14 @@ const BrokerageApi = {
.map((key) => encodeURIComponent(key) + '=' + params[key]) .map((key) => encodeURIComponent(key) + '=' + params[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/trade/brokerage-user/rank-page-by-user-count?${queryString}`, url: `/trade/brokerage-user/rank-page-by-user-count?${queryString}`,
method: 'GET', method: 'GET',
}); });
}, },
// 获得下级分销统计分页 // 获得下级分销统计分页
getBrokerageUserChildSummaryPage: (params) => { getBrokerageUserChildSummaryPage: (params) => {
return request({ return request({
url: '/app-api/trade/brokerage-user/child-summary-page', url: '/trade/brokerage-user/child-summary-page',
method: 'GET', method: 'GET',
params, params,
}) })

View File

@ -3,7 +3,7 @@ import request from '@/sheep/request';
const CartApi = { const CartApi = {
addCart: (data) => { addCart: (data) => {
return request({ return request({
url: '/app-api/trade/cart/add', url: '/trade/cart/add',
method: 'POST', method: 'POST',
data: data, data: data,
custom: { custom: {
@ -14,21 +14,21 @@ const CartApi = {
}, },
updateCartCount: (data) => { updateCartCount: (data) => {
return request({ return request({
url: '/app-api/trade/cart/update-count', url: '/trade/cart/update-count',
method: 'PUT', method: 'PUT',
data: data data: data
}); });
}, },
updateCartSelected: (data) => { updateCartSelected: (data) => {
return request({ return request({
url: '/app-api/trade/cart/update-selected', url: '/trade/cart/update-selected',
method: 'PUT', method: 'PUT',
data: data data: data
}); });
}, },
deleteCart: (ids) => { deleteCart: (ids) => {
return request({ return request({
url: '/app-api/trade/cart/delete', url: '/trade/cart/delete',
method: 'DELETE', method: 'DELETE',
params: { params: {
ids ids
@ -37,7 +37,7 @@ const CartApi = {
}, },
getCartList: () => { getCartList: () => {
return request({ return request({
url: '/app-api/trade/cart/list', url: '/trade/cart/list',
method: 'GET', method: 'GET',
}); });
}, },

View File

@ -4,7 +4,7 @@ const TradeConfigApi = {
// 获得交易配置 // 获得交易配置
getTradeConfig: () => { getTradeConfig: () => {
return request({ return request({
url: `/app-api/trade/config/get`, url: `/trade/config/get`,
method: 'GET', method: 'GET',
}); });
}, },

View File

@ -4,7 +4,7 @@ const DeliveryApi = {
// 获得快递公司列表 // 获得快递公司列表
getDeliveryExpressList: () => { getDeliveryExpressList: () => {
return request({ return request({
url: `/app-api/trade/delivery/express/list`, url: `/trade/delivery/express/list`,
method: 'get', method: 'get',
}); });
} }

View File

@ -35,7 +35,7 @@ const OrderApi = {
.map((key) => key + '=' + data2[key]) .map((key) => key + '=' + data2[key])
.join('&'); .join('&');
return request({ return request({
url: `/app-api/trade/order/settlement?${queryString}`, url: `/trade/order/settlement?${queryString}`,
method: 'GET', method: 'GET',
custom: { custom: {
showError: true, showError: true,
@ -46,7 +46,7 @@ const OrderApi = {
// 创建订单 // 创建订单
createOrder: (data) => { createOrder: (data) => {
return request({ return request({
url: `/app-api/trade/order/create`, url: `/trade/order/create`,
method: 'POST', method: 'POST',
data, data,
}); });
@ -54,7 +54,7 @@ const OrderApi = {
// 获得订单 // 获得订单
getOrder: (id) => { getOrder: (id) => {
return request({ return request({
url: `/app-api/trade/order/get-detail`, url: `/trade/order/get-detail`,
method: 'GET', method: 'GET',
params: { params: {
id, id,
@ -64,7 +64,7 @@ const OrderApi = {
// 订单列表 // 订单列表
getOrderPage: (params) => { getOrderPage: (params) => {
return request({ return request({
url: '/app-api/trade/order/page', url: '/trade/order/page',
method: 'GET', method: 'GET',
params, params,
custom: { custom: {
@ -75,7 +75,7 @@ const OrderApi = {
// 确认收货 // 确认收货
receiveOrder: (id) => { receiveOrder: (id) => {
return request({ return request({
url: `/app-api/trade/order/receive`, url: `/trade/order/receive`,
method: 'PUT', method: 'PUT',
params: { params: {
id, id,
@ -85,7 +85,7 @@ const OrderApi = {
// 取消订单 // 取消订单
cancelOrder: (id) => { cancelOrder: (id) => {
return request({ return request({
url: `/app-api/trade/order/cancel`, url: `/trade/order/cancel`,
method: 'DELETE', method: 'DELETE',
params: { params: {
id, id,
@ -95,7 +95,7 @@ const OrderApi = {
// 删除订单 // 删除订单
deleteOrder: (id) => { deleteOrder: (id) => {
return request({ return request({
url: `/app-api/trade/order/delete`, url: `/trade/order/delete`,
method: 'DELETE', method: 'DELETE',
params: { params: {
id, id,
@ -105,7 +105,7 @@ const OrderApi = {
// 获得交易订单的物流轨迹 // 获得交易订单的物流轨迹
getOrderExpressTrackList: (id) => { getOrderExpressTrackList: (id) => {
return request({ return request({
url: `/app-api/trade/order/get-express-track-list`, url: `/trade/order/get-express-track-list`,
method: 'GET', method: 'GET',
params: { params: {
id, id,
@ -115,7 +115,7 @@ const OrderApi = {
// 获得交易订单数量 // 获得交易订单数量
getOrderCount: () => { getOrderCount: () => {
return request({ return request({
url: '/app-api/trade/order/get-count', url: '/trade/order/get-count',
method: 'GET', method: 'GET',
custom: { custom: {
showLoading: false, showLoading: false,
@ -126,7 +126,7 @@ const OrderApi = {
// 创建单个评论 // 创建单个评论
createOrderItemComment: (data) => { createOrderItemComment: (data) => {
return request({ return request({
url: `/app-api/trade/order/item/create-comment`, url: `/trade/order/item/create-comment`,
method: 'POST', method: 'POST',
data, data,
}); });

View File

@ -7,9 +7,9 @@ if (process.env.NODE_ENV === 'development') {
baseUrl = import.meta.env.SHOPRO_BASE_URL; baseUrl = import.meta.env.SHOPRO_BASE_URL;
} }
version = import.meta.env.SHOPRO_VERSION; version = import.meta.env.SHOPRO_VERSION;
console.log(`[Shopro ${version}] http://api-dashboard.yudao.iocoder.cn/`); console.log(`[芋道商城 ${version}] http://doc.iocoder.cn`);
export const apiPath = import.meta.env.SHOPRO_API_PATH;
export const apiPath = import.meta.env.SHOPRO_API_PATH;
export const staticUrl = import.meta.env.SHOPRO_STATIC_URL; export const staticUrl = import.meta.env.SHOPRO_STATIC_URL;
export default { export default {

View File

@ -4,10 +4,7 @@
*/ */
import Request from 'luch-request'; import Request from 'luch-request';
import { import { baseUrl, apiPath } from '@/sheep/config';
baseUrl,
apiPath
} from '@/sheep/config';
import $store from '@/sheep/store'; import $store from '@/sheep/store';
import $platform from '@/sheep/platform'; import $platform from '@/sheep/platform';
import { import {
@ -51,7 +48,7 @@ function closeLoading() {
* @description 请求基础配置 可直接使用访问自定义请求 * @description 请求基础配置 可直接使用访问自定义请求
*/ */
const http = new Request({ const http = new Request({
baseURL: baseUrl, baseURL: baseUrl + apiPath,
timeout: 8000, timeout: 8000,
method: 'GET', method: 'GET',
header: { header: {
@ -99,12 +96,10 @@ http.interceptors.request.use(
config.header['Authorization'] = token; config.header['Authorization'] = token;
} }
// TODO 芋艿:特殊处理 // TODO 芋艿:特殊处理
if (config.url.indexOf('/app-api/') !== -1) {
config.header['Accept'] = '*/*' config.header['Accept'] = '*/*'
config.header['tenant-id'] = '1'; config.header['tenant-id'] = '1';
config.header['terminal'] = '20'; config.header['terminal'] = '20';
// config.header['Authorization'] = 'Bearer test247'; // config.header['Authorization'] = 'Bearer test247';
}
return config; return config;
}, },
(error) => { (error) => {
@ -301,15 +296,6 @@ const getRefreshToken = () => {
} }
const request = (config) => { const request = (config) => {
if (config.url[0] !== '/') {
config.url = apiPath + config.url;
}
// TODO 芋艿:额外拼接
if (config.url.indexOf('/app-api/') >= 0) {
// config.url = 'http://api-dashboard.yudao.iocoder.cn' + config.url; // 调用【云端】
config.url = 'http://127.0.0.1:48080' + config.url; // 调用【本地】
// config.url = 'http://yunai.natapp1.cc' + config.url; // 调用【natapp】
}
return http.middleware(config); return http.middleware(config);
}; };