From 33d57fd7e559d888d6aec6341e6d7781b58a1caf Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 20 Jan 2024 13:13:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20env=EF=BC=9A=E5=90=8E=E7=AB=AF?= =?UTF-8?q?=E7=9A=84=E8=AF=B7=E6=B1=82=E5=9C=B0=E5=9D=80=EF=BC=8C=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E5=88=B0=20env=20=E9=87=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env | 15 ++++++++------- sheep/api/infra/file.js | 10 ++++------ sheep/api/member/address.js | 10 +++++----- sheep/api/member/auth.js | 18 +++++++++--------- sheep/api/member/point.js | 2 +- sheep/api/member/signin.js | 8 ++++---- sheep/api/member/social.js | 6 +++--- sheep/api/member/user.js | 12 ++++++------ sheep/api/pay/channel.js | 2 +- sheep/api/pay/order.js | 4 ++-- sheep/api/pay/wallet.js | 14 +++++++------- sheep/api/product/category.js | 4 ++-- sheep/api/product/comment.js | 2 +- sheep/api/product/favorite.js | 8 ++++---- sheep/api/product/history.js | 6 +++--- sheep/api/product/spu.js | 8 ++++---- sheep/api/promotion/activity.js | 2 +- sheep/api/promotion/article.js | 2 +- sheep/api/promotion/bargain.js | 6 +++--- sheep/api/promotion/combination.js | 14 +++++++------- sheep/api/promotion/coupon.js | 18 +++++++++--------- sheep/api/promotion/diy/page.js | 2 +- sheep/api/promotion/diy/template.js | 4 ++-- sheep/api/promotion/rewardActivity.js | 2 +- sheep/api/system/area.js | 2 +- sheep/api/trade/afterSale.js | 12 ++++++------ sheep/api/trade/brokerage.js | 18 +++++++++--------- sheep/api/trade/cart.js | 10 +++++----- sheep/api/trade/config.js | 2 +- sheep/api/trade/delivery.js | 2 +- sheep/api/trade/order.js | 20 ++++++++++---------- sheep/config/index.js | 4 ++-- sheep/request/index.js | 26 ++++++-------------------- 33 files changed, 130 insertions(+), 145 deletions(-) diff --git a/.env b/.env index da303d9b..fdf83579 100644 --- a/.env +++ b/.env @@ -1,18 +1,19 @@ # 版本号 SHOPRO_VERSION = v1.8.3 -# 正式环境接口域名 -SHOPRO_BASE_URL = https://api.shopro.sheepjs.com +# 后端接口 - 正式环境(通过 process.env.NODE_ENV = development) +SHOPRO_BASE_URL = http://api-dashboard.yudao.iocoder.cn -# 开发环境接口域名 -SHOPRO_DEV_BASE_URL = https://api.shopro.sheepjs.com +# 后端接口 - 测试环境(通过 process.env.NODE_ENV 非 development) +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_API_PATH = /shop/api/ - # 客户端静态资源地址 空=默认使用服务端指定的CDN资源地址前缀 | local=本地 | http(s)://xxx.xxx=自定义静态资源地址前缀 SHOPRO_STATIC_URL = https://file.sheepjs.com diff --git a/sheep/api/infra/file.js b/sheep/api/infra/file.js index e33b8e19..a4bac46f 100644 --- a/sheep/api/infra/file.js +++ b/sheep/api/infra/file.js @@ -1,27 +1,25 @@ +import { baseUrl, apiPath } from '@/sheep/config'; + const FileApi = { // 上传文件 uploadFile: (file) => { + // TODO 芋艿:访问令牌的接入; const token = uni.getStorageSync('token'); uni.showLoading({ title: '上传中', }); return new Promise((resolve, reject) => { - // 此处先换成yudao - // TODO 芋艿:后续搞下 uni.uploadFile({ - // url: 'http://api-dashboard.yudao.iocoder.cn' + '/app-api/infra/file/upload', - url: 'http://127.0.0.1:48080' + '/app-api/infra/file/upload', + url: baseUrl + apiPath + '/infra/file/upload', filePath: file, name: 'file', header: { // Accept: 'text/json', - // Authorization: token, Accept : '*/*', 'tenant-id' :'1', // Authorization: 'Bearer test247', }, success: (uploadFileRes) => { - debugger let result = JSON.parse(uploadFileRes.data); if (result.error === 1) { uni.showToast({ diff --git a/sheep/api/member/address.js b/sheep/api/member/address.js index 72c67ad7..3f579d05 100644 --- a/sheep/api/member/address.js +++ b/sheep/api/member/address.js @@ -4,14 +4,14 @@ const AddressApi = { // 获得用户收件地址列表 getAddressList: () => { return request({ - url: '/app-api/member/address/list', + url: '/member/address/list', method: 'GET' }); }, // 创建用户收件地址 createAddress: (data) => { return request({ - url: '/app-api/member/address/create', + url: '/member/address/create', method: 'POST', data }); @@ -19,7 +19,7 @@ const AddressApi = { // 更新用户收件地址 updateAddress: (data) => { return request({ - url: '/app-api/member/address/update', + url: '/member/address/update', method: 'PUT', data }); @@ -27,7 +27,7 @@ const AddressApi = { // 获得用户收件地址 getAddress: (id) => { return request({ - url: '/app-api/member/address/get', + url: '/member/address/get', method: 'GET', params: { id } }); @@ -35,7 +35,7 @@ const AddressApi = { // 删除用户收件地址 deleteAddress: (id) => { return request({ - url: '/app-api/member/address/delete', + url: '/member/address/delete', method: 'DELETE', params: { id } }); diff --git a/sheep/api/member/auth.js b/sheep/api/member/auth.js index 6ed6dfcb..a1c06602 100644 --- a/sheep/api/member/auth.js +++ b/sheep/api/member/auth.js @@ -4,7 +4,7 @@ const AuthUtil = { // 使用手机 + 密码登录 login: (data) => { return request({ - url: '/app-api/member/auth/login', + url: '/member/auth/login', method: 'POST', data, custom: { @@ -17,7 +17,7 @@ const AuthUtil = { // 使用手机 + 验证码登录 smsLogin: (data) => { return request({ - url: '/app-api/member/auth/sms-login', + url: '/member/auth/sms-login', method: 'POST', data, custom: { @@ -30,7 +30,7 @@ const AuthUtil = { // 发送手机验证码 sendSmsCode: (mobile, scene) => { return request({ - url: '/app-api/member/auth/send-sms-code', + url: '/member/auth/send-sms-code', method: 'POST', data: { mobile, @@ -46,14 +46,14 @@ const AuthUtil = { // 登出系统 logout: () => { return request({ - url: '/app-api/member/auth/logout', + url: '/member/auth/logout', method: 'POST', }); }, // 刷新令牌 refreshToken: (refreshToken) => { return request({ - url: '/app-api/member/auth/refresh-token', + url: '/member/auth/refresh-token', method: 'POST', params: { refreshToken @@ -67,7 +67,7 @@ const AuthUtil = { // 社交授权的跳转 socialAuthRedirect: (type, redirectUri) => { return request({ - url: '/app-api/member/auth/social-auth-redirect', + url: '/member/auth/social-auth-redirect', method: 'GET', params: { type, @@ -82,7 +82,7 @@ const AuthUtil = { // 社交快捷登录 socialLogin: (type, code, state) => { return request({ - url: '/app-api/member/auth/social-login', + url: '/member/auth/social-login', method: 'POST', data: { type, @@ -98,7 +98,7 @@ const AuthUtil = { // 微信小程序的一键登录 weixinMiniAppLogin: (phoneCode, loginCode, state) => { return request({ - url: '/app-api/member/auth/weixin-mini-app-login', + url: '/member/auth/weixin-mini-app-login', method: 'POST', data: { phoneCode, @@ -115,7 +115,7 @@ const AuthUtil = { // 创建微信 JS SDK 初始化所需的签名 createWeixinMpJsapiSignature: (url) => { return request({ - url: '/app-api/member/auth/create-weixin-jsapi-signature', + url: '/member/auth/create-weixin-jsapi-signature', method: 'POST', params: { url diff --git a/sheep/api/member/point.js b/sheep/api/member/point.js index 73f3fb7f..188ffd40 100644 --- a/sheep/api/member/point.js +++ b/sheep/api/member/point.js @@ -10,7 +10,7 @@ const PointApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ - url: `/app-api/member/point/record/page?${queryString}`, + url: `/member/point/record/page?${queryString}`, method: 'GET', }); } diff --git a/sheep/api/member/signin.js b/sheep/api/member/signin.js index 9993e8b5..35169ef3 100644 --- a/sheep/api/member/signin.js +++ b/sheep/api/member/signin.js @@ -4,21 +4,21 @@ const SignInApi = { // 获得签到规则列表 getSignInConfigList: () => { return request({ - url: '/app-api/member/sign-in/config/list', + url: '/member/sign-in/config/list', method: 'GET', }); }, // 获得个人签到统计 getSignInRecordSummary: () => { return request({ - url: '/app-api/member/sign-in/record/get-summary', + url: '/member/sign-in/record/get-summary', method: 'GET', }); }, // 签到 createSignInRecord: () => { return request({ - url: '/app-api/member/sign-in/record/create', + url: '/member/sign-in/record/create', method: 'POST', }); }, @@ -28,7 +28,7 @@ const SignInApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ - url: `/app-api/member/sign-in/record/page?${queryString}`, + url: `/member/sign-in/record/page?${queryString}`, method: 'GET', }); }, diff --git a/sheep/api/member/social.js b/sheep/api/member/social.js index c15037ca..f7ab2599 100644 --- a/sheep/api/member/social.js +++ b/sheep/api/member/social.js @@ -4,7 +4,7 @@ const SocialApi = { // 获得社交用户 getSocialUser: (type) => { return request({ - url: '/app-api/member/social-user/get', + url: '/member/social-user/get', method: 'GET', params: { type @@ -17,7 +17,7 @@ const SocialApi = { // 社交绑定 socialBind: (type, code, state) => { return request({ - url: '/app-api/member/social-user/bind', + url: '/member/social-user/bind', method: 'POST', data: { type, @@ -36,7 +36,7 @@ const SocialApi = { // 社交绑定 socialUnbind: (type, openid) => { return request({ - url: '/app-api/member/social-user/unbind', + url: '/member/social-user/unbind', method: 'DELETE', data: { type, diff --git a/sheep/api/member/user.js b/sheep/api/member/user.js index a2316faf..543af5d6 100644 --- a/sheep/api/member/user.js +++ b/sheep/api/member/user.js @@ -4,7 +4,7 @@ const UserApi = { // 获得基本信息 getUserInfo: () => { return request({ - url: '/app-api/member/user/get', + url: '/member/user/get', method: 'GET', custom: { showLoading: false, @@ -15,7 +15,7 @@ const UserApi = { // 修改基本信息 updateUser: (data) => { return request({ - url: '/app-api/member/user/update', + url: '/member/user/update', method: 'PUT', data, custom: { @@ -27,7 +27,7 @@ const UserApi = { // 修改用户手机 updateUserMobile: (data) => { return request({ - url: '/app-api/member/user/update-mobile', + url: '/member/user/update-mobile', method: 'PUT', data, custom: { @@ -40,7 +40,7 @@ const UserApi = { // 基于微信小程序的授权码,修改用户手机 updateUserMobileByWeixin: (code) => { return request({ - url: '/app-api/member/user/update-mobile-by-weixin', + url: '/member/user/update-mobile-by-weixin', method: 'PUT', data: { code @@ -55,7 +55,7 @@ const UserApi = { // 修改密码 updateUserPassword: (data) => { return request({ - url: '/app-api/member/user/update-password', + url: '/member/user/update-password', method: 'PUT', data, custom: { @@ -68,7 +68,7 @@ const UserApi = { // 重置密码 resetUserPassword: (data) => { return request({ - url: '/app-api/member/user/reset-password', + url: '/member/user/reset-password', method: 'PUT', data, custom: { diff --git a/sheep/api/pay/channel.js b/sheep/api/pay/channel.js index 20a8c28f..4e7bfc57 100644 --- a/sheep/api/pay/channel.js +++ b/sheep/api/pay/channel.js @@ -4,7 +4,7 @@ const PayChannelApi = { // 获得指定应用的开启的支付渠道编码列表 getEnableChannelCodeList: (appId) => { return request({ - url: '/app-api/pay/channel/get-enable-code-list', + url: '/pay/channel/get-enable-code-list', method: 'GET', params: { appId } }); diff --git a/sheep/api/pay/order.js b/sheep/api/pay/order.js index f1935293..f9853596 100644 --- a/sheep/api/pay/order.js +++ b/sheep/api/pay/order.js @@ -4,7 +4,7 @@ const PayOrderApi = { // 获得支付订单 getOrder: (id) => { return request({ - url: '/app-api/pay/order/get', + url: '/pay/order/get', method: 'GET', params: { id } }); @@ -12,7 +12,7 @@ const PayOrderApi = { // 提交支付订单 submitOrder: (data) => { return request({ - url: '/app-api/pay/order/submit', + url: '/pay/order/submit', method: 'POST', data }); diff --git a/sheep/api/pay/wallet.js b/sheep/api/pay/wallet.js index 3a86b470..023902a8 100644 --- a/sheep/api/pay/wallet.js +++ b/sheep/api/pay/wallet.js @@ -4,7 +4,7 @@ const PayWalletApi = { // 获取钱包 getPayWallet() { return request({ - url: '/app-api/pay/wallet/get', + url: '/pay/wallet/get', method: 'GET', custom: { showLoading: false, @@ -18,7 +18,7 @@ const PayWalletApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ - url: `/app-api/pay/wallet-transaction/page?${queryString}`, + url: `/pay/wallet-transaction/page?${queryString}`, method: 'GET', }); }, @@ -26,8 +26,8 @@ const PayWalletApi = { getWalletTransactionSummary: (params) => { const queryString = `createTime=${params.createTime[0]}&createTime=${params.createTime[1]}`; return request({ - url: `/app-api/pay/wallet-transaction/get-summary?${queryString}`, - // url: `/app-api/pay/wallet-transaction/get-summary`, + url: `/pay/wallet-transaction/get-summary?${queryString}`, + // url: `/pay/wallet-transaction/get-summary`, method: 'GET', // params: params }); @@ -35,7 +35,7 @@ const PayWalletApi = { // 获得钱包充值套餐列表 getWalletRechargePackageList: () => { return request({ - url: '/app-api/pay/wallet-recharge-package/list', + url: '/pay/wallet-recharge-package/list', method: 'GET', custom: { showError: false, @@ -46,7 +46,7 @@ const PayWalletApi = { // 创建钱包充值记录(发起充值) createWalletRecharge: (data) => { return request({ - url: '/app-api/pay/wallet-recharge/create', + url: '/pay/wallet-recharge/create', method: 'POST', data, }); @@ -54,7 +54,7 @@ const PayWalletApi = { // 获得钱包充值记录分页 getWalletRechargePage: (params) => { return request({ - url: '/app-api/pay/wallet-recharge/page', + url: '/pay/wallet-recharge/page', method: 'GET', params, custom: { diff --git a/sheep/api/product/category.js b/sheep/api/product/category.js index 4578e8aa..3b6f8f0a 100644 --- a/sheep/api/product/category.js +++ b/sheep/api/product/category.js @@ -4,14 +4,14 @@ const CategoryApi = { // 查询分类列表 getCategoryList: () => { return request({ - url: '/app-api/product/category/list', + url: '/product/category/list', method: 'GET', }); }, // 查询分类列表,指定编号 getCategoryListByIds: (ids) => { return request({ - url: '/app-api/product/category/list-by-ids', + url: '/product/category/list-by-ids', method: 'GET', params: { ids }, }); diff --git a/sheep/api/product/comment.js b/sheep/api/product/comment.js index 01ce25c2..e7008009 100644 --- a/sheep/api/product/comment.js +++ b/sheep/api/product/comment.js @@ -4,7 +4,7 @@ const CommentApi = { // 获得商品评价分页 getCommentPage: (spuId, pageNo, pageSize, type) => { return request({ - url: '/app-api/product/comment/page', + url: '/product/comment/page', method: 'GET', params: { spuId, diff --git a/sheep/api/product/favorite.js b/sheep/api/product/favorite.js index 7e1d41f5..583ff129 100644 --- a/sheep/api/product/favorite.js +++ b/sheep/api/product/favorite.js @@ -4,7 +4,7 @@ const FavoriteApi = { // 获得商品收藏分页 getFavoritePage: (data) => { return request({ - url: '/app-api/product/favorite/page', + url: '/product/favorite/page', method: 'GET', params: data }); @@ -12,7 +12,7 @@ const FavoriteApi = { // 检查是否收藏过商品 isFavoriteExists: (spuId) => { return request({ - url: '/app-api/product/favorite/exits', + url: '/product/favorite/exits', method: 'GET', params: { spuId @@ -22,7 +22,7 @@ const FavoriteApi = { // 添加商品收藏 createFavorite: (spuId) => { return request({ - url: '/app-api/product/favorite/create', + url: '/product/favorite/create', method: 'POST', data: { spuId @@ -32,7 +32,7 @@ const FavoriteApi = { // 取消商品收藏 deleteFavorite: (spuId) => { return request({ - url: '/app-api/product/favorite/delete', + url: '/product/favorite/delete', method: 'DELETE', data: { spuId diff --git a/sheep/api/product/history.js b/sheep/api/product/history.js index 1e60a2ac..a6fddb74 100644 --- a/sheep/api/product/history.js +++ b/sheep/api/product/history.js @@ -4,7 +4,7 @@ const SpuHistoryApi = { // 删除商品浏览记录 deleteBrowseHistory: (spuIds) => { return request({ - url: '/app-api/product/browse-history/delete', + url: '/product/browse-history/delete', method: 'DELETE', data: { spuIds }, }); @@ -12,14 +12,14 @@ const SpuHistoryApi = { // 清空商品浏览记录 cleanBrowseHistory: () => { return request({ - url: '/app-api/product/browse-history/clean', + url: '/product/browse-history/clean', method: 'DELETE', }); }, // 获得商品浏览记录分页 getBrowseHistoryPage: (data) => { return request({ - url: '/app-api/product/browse-history/page', + url: '/product/browse-history/page', method: 'GET', data }); diff --git a/sheep/api/product/spu.js b/sheep/api/product/spu.js index 87bf1fa5..057d5b6a 100644 --- a/sheep/api/product/spu.js +++ b/sheep/api/product/spu.js @@ -4,7 +4,7 @@ const SpuApi = { // 获得商品 SPU 列表 getSpuList: (recommendType) => { return request({ - url: '/app-api/product/spu/list', + url: '/product/spu/list', method: 'GET', params: {recommendType}, }); @@ -12,7 +12,7 @@ const SpuApi = { // 获得商品 SPU 列表 getSpuListByIds: (ids) => { return request({ - url: '/app-api/product/spu/list-by-ids', + url: '/product/spu/list-by-ids', method: 'GET', params: {ids}, }); @@ -20,7 +20,7 @@ const SpuApi = { // 获得商品 SPU 分页 getSpuPage: (data) => { return request({ - url: '/app-api/product/spu/page', + url: '/product/spu/page', method: 'GET', data }); @@ -28,7 +28,7 @@ const SpuApi = { // 查询商品 getSpuDetail: (id) => { return request({ - url: '/app-api/product/spu/get-detail', + url: '/product/spu/get-detail', method: 'GET', params: { id }, }); diff --git a/sheep/api/promotion/activity.js b/sheep/api/promotion/activity.js index 183b4ffb..eb47ce1d 100644 --- a/sheep/api/promotion/activity.js +++ b/sheep/api/promotion/activity.js @@ -4,7 +4,7 @@ const ActivityApi = { // 获得单个商品,近期参与的每个活动 getActivityListBySpuId: (spuId) => { return request({ - url: '/app-api/promotion/activity/list-by-spu-id', + url: '/promotion/activity/list-by-spu-id', method: 'GET', params: { spuId, diff --git a/sheep/api/promotion/article.js b/sheep/api/promotion/article.js index 2e061d46..ded5fb1f 100644 --- a/sheep/api/promotion/article.js +++ b/sheep/api/promotion/article.js @@ -4,7 +4,7 @@ export default { // 获得文章详情 getArticle: (id, title) => { return request({ - url: '/app-api/promotion/article/get', + url: '/promotion/article/get', method: 'GET', params: { id, title } }); diff --git a/sheep/api/promotion/bargain.js b/sheep/api/promotion/bargain.js index 5e01a6f6..807472af 100644 --- a/sheep/api/promotion/bargain.js +++ b/sheep/api/promotion/bargain.js @@ -4,21 +4,21 @@ const BargainApi = { // 获得砍价记录的概要信息 getBargainRecordSummary: () => { return request({ - url: '/app-api/promotion/bargain-record/get-summary', + url: '/promotion/bargain-record/get-summary', method: 'GET', }); }, // 获得砍价活动分页 getBargainActivityPage: () => { return request({ - url: '/app-api/promotion/bargain-activity/page', + url: '/promotion/bargain-activity/page', method: 'GET', }); }, // 获得砍价活动详情 getBargainActivityDetail(params) { return request({ - url: '/app-api/promotion/bargain-activity/get-detail', + url: '/promotion/bargain-activity/get-detail', method: 'GET', params, }); diff --git a/sheep/api/promotion/combination.js b/sheep/api/promotion/combination.js index 164a6674..44f61e9d 100644 --- a/sheep/api/promotion/combination.js +++ b/sheep/api/promotion/combination.js @@ -5,7 +5,7 @@ const CombinationApi = { // 获得拼团活动列表 getCombinationActivityList: (count) => { return request({ - url: '/app-api/promotion/combination-activity/list', + url: '/promotion/combination-activity/list', method: 'GET', params: { count }, }); @@ -14,7 +14,7 @@ const CombinationApi = { // 获得拼团活动分页 getCombinationActivityPage: (params) => { return request({ - url: '/app-api/promotion/combination-activity/page', + url: '/promotion/combination-activity/page', method: 'GET', params, }); @@ -23,7 +23,7 @@ const CombinationApi = { // 获得拼团活动明细 getCombinationActivity: (id) => { return request({ - url: '/app-api/promotion/combination-activity/get-detail', + url: '/promotion/combination-activity/get-detail', method: 'GET', params: { id, @@ -34,7 +34,7 @@ const CombinationApi = { // 获得最近 n 条拼团记录(团长发起的) getHeadCombinationRecordList: (activityId, status, count) => { return request({ - url: '/app-api/promotion/combination-record/get-head-list', + url: '/promotion/combination-record/get-head-list', method: 'GET', params: { activityId, @@ -47,7 +47,7 @@ const CombinationApi = { // 获得我的拼团记录分页 getCombinationRecordPage: (params) => { return request({ - url: "/app-api/promotion/combination-record/page", + url: "/promotion/combination-record/page", method: 'GET', params }); @@ -56,7 +56,7 @@ const CombinationApi = { // 获得拼团记录明细 getCombinationRecordDetail: (id) => { return request({ - url: '/app-api/promotion/combination-record/get-detail', + url: '/promotion/combination-record/get-detail', method: 'GET', params: { id, @@ -67,7 +67,7 @@ const CombinationApi = { // 获得拼团记录的概要信息 getCombinationRecordSummary: () => { return request({ - url: '/app-api/promotion/combination-record/get-summary', + url: '/promotion/combination-record/get-summary', method: 'GET', }); }, diff --git a/sheep/api/promotion/coupon.js b/sheep/api/promotion/coupon.js index 1e7dc415..de28308c 100644 --- a/sheep/api/promotion/coupon.js +++ b/sheep/api/promotion/coupon.js @@ -4,7 +4,7 @@ const CouponApi = { // 获得优惠劵模板列表 getCouponTemplateListByIds: (ids) => { return request({ - url: '/app-api/promotion/coupon-template/list-by-ids', + url: '/promotion/coupon-template/list-by-ids', method: 'GET', params: { ids }, }); @@ -12,7 +12,7 @@ const CouponApi = { // 获得优惠劵模版列表 getCouponTemplateList: (spuId, productScope, count) => { return request({ - url: '/app-api/promotion/coupon-template/list', + url: '/promotion/coupon-template/list', method: 'GET', params: { spuId, productScope, count }, }); @@ -20,7 +20,7 @@ const CouponApi = { // 获得优惠劵模版分页 getCouponTemplatePage: (params) => { return request({ - url: '/app-api/promotion/coupon-template/page', + url: '/promotion/coupon-template/page', method: 'GET', params, }); @@ -28,7 +28,7 @@ const CouponApi = { // 获得优惠劵模版 getCouponTemplate: (id) => { return request({ - url: '/app-api/promotion/coupon-template/get', + url: '/promotion/coupon-template/get', method: 'GET', params: { id }, }); @@ -36,7 +36,7 @@ const CouponApi = { // 我的优惠劵列表 getCouponPage: (params) => { return request({ - url: '/app-api/promotion/coupon/page', + url: '/promotion/coupon/page', method: 'GET', params, }); @@ -44,7 +44,7 @@ const CouponApi = { // 领取优惠券 takeCoupon: (templateId) => { return request({ - url: '/app-api/promotion/coupon/take', + url: '/promotion/coupon/take', method: 'POST', data: { templateId }, }); @@ -52,7 +52,7 @@ const CouponApi = { // 获得优惠劵 getCoupon: (id) => { return request({ - url: '/app-api/promotion/coupon/get', + url: '/promotion/coupon/get', method: 'GET', params: { id }, }); @@ -60,7 +60,7 @@ const CouponApi = { // 获得未使用的优惠劵数量 getUnusedCouponCount: () => { return request({ - url: '/app-api/promotion/coupon/get-unused-count', + url: '/promotion/coupon/get-unused-count', method: 'GET', custom: { showLoading: false, @@ -71,7 +71,7 @@ const CouponApi = { // 获得匹配指定商品的优惠劵列表 getMatchCouponList: (price, spuIds, skuIds, categoryIds) => { return request({ - url: '/app-api/promotion/coupon/match-list', + url: '/promotion/coupon/match-list', method: 'GET', params: { price, diff --git a/sheep/api/promotion/diy/page.js b/sheep/api/promotion/diy/page.js index f5279295..67eb6bba 100644 --- a/sheep/api/promotion/diy/page.js +++ b/sheep/api/promotion/diy/page.js @@ -3,7 +3,7 @@ import request from '@/sheep/request'; const DiyPageApi = { getDiyPage: (id) => { return request({ - url: '/app-api/promotion/diy-page/get', + url: '/promotion/diy-page/get', method: 'GET', params: { id diff --git a/sheep/api/promotion/diy/template.js b/sheep/api/promotion/diy/template.js index abf0d5e8..18e5341b 100644 --- a/sheep/api/promotion/diy/template.js +++ b/sheep/api/promotion/diy/template.js @@ -3,13 +3,13 @@ import request from '@/sheep/request'; const DiyTemplateApi = { getUsedDiyTemplate: () => { return request({ - url: '/app-api/promotion/diy-template/used', + url: '/promotion/diy-template/used', method: 'GET', }); }, getDiyTemplate: (id) => { return request({ - url: '/app-api/promotion/diy-template/get', + url: '/promotion/diy-template/get', method: 'GET', params: { id diff --git a/sheep/api/promotion/rewardActivity.js b/sheep/api/promotion/rewardActivity.js index 719461a5..5f74db71 100644 --- a/sheep/api/promotion/rewardActivity.js +++ b/sheep/api/promotion/rewardActivity.js @@ -4,7 +4,7 @@ const RewardActivityApi = { // 获得满减送活动 getRewardActivity: (id) => { return request({ - url: '/app-api/promotion/reward-activity/get', + url: '/promotion/reward-activity/get', method: 'GET', params: { id }, }); diff --git a/sheep/api/system/area.js b/sheep/api/system/area.js index 1d4fb0af..7c41efff 100644 --- a/sheep/api/system/area.js +++ b/sheep/api/system/area.js @@ -4,7 +4,7 @@ const AreaApi = { // 获得地区树 getAreaTree: () => { return request({ - url: '/app-api/system/area/tree', + url: '/system/area/tree', method: 'GET' }); }, diff --git a/sheep/api/trade/afterSale.js b/sheep/api/trade/afterSale.js index 85e3dab1..44c4dd36 100644 --- a/sheep/api/trade/afterSale.js +++ b/sheep/api/trade/afterSale.js @@ -4,7 +4,7 @@ const AfterSaleApi = { // 获得售后分页 getAfterSalePage: (params) => { return request({ - url: `/app-api/trade/after-sale/page`, + url: `/trade/after-sale/page`, method: 'GET', params, custom: { @@ -15,7 +15,7 @@ const AfterSaleApi = { // 创建售后 createAfterSale: (data) => { return request({ - url: `/app-api/trade/after-sale/create`, + url: `/trade/after-sale/create`, method: 'POST', data, }); @@ -23,7 +23,7 @@ const AfterSaleApi = { // 获得售后 getAfterSale: (id) => { return request({ - url: `/app-api/trade/after-sale/get`, + url: `/trade/after-sale/get`, method: 'GET', params: { id, @@ -33,7 +33,7 @@ const AfterSaleApi = { // 取消售后 cancelAfterSale: (id) => { return request({ - url: `/app-api/trade/after-sale/cancel`, + url: `/trade/after-sale/cancel`, method: 'DELETE', params: { id, @@ -43,7 +43,7 @@ const AfterSaleApi = { // 获得售后日志列表 getAfterSaleLogList: (afterSaleId) => { return request({ - url: `/app-api/trade/after-sale-log/list`, + url: `/trade/after-sale-log/list`, method: 'GET', params: { afterSaleId, @@ -53,7 +53,7 @@ const AfterSaleApi = { // 退回货物 deliveryAfterSale: (data) => { return request({ - url: `/app-api/trade/after-sale/delivery`, + url: `/trade/after-sale/delivery`, method: 'PUT', data, }); diff --git a/sheep/api/trade/brokerage.js b/sheep/api/trade/brokerage.js index 9e0c8cff..00012b77 100644 --- a/sheep/api/trade/brokerage.js +++ b/sheep/api/trade/brokerage.js @@ -4,14 +4,14 @@ const BrokerageApi = { // 获得个人分销信息 getBrokerageUser: () => { return request({ - url: '/app-api/trade/brokerage-user/get', + url: '/trade/brokerage-user/get', method: 'GET' }); }, // 获得个人分销统计 getBrokerageUserSummary: () => { return request({ - url: '/app-api/trade/brokerage-user/get-summary', + url: '/trade/brokerage-user/get-summary', method: 'GET', }); }, @@ -24,14 +24,14 @@ const BrokerageApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ - url: `/app-api/trade/brokerage-record/page?${queryString}`, + url: `/trade/brokerage-record/page?${queryString}`, method: 'GET', }); }, // 创建分销提现 createBrokerageWithdraw: (data) => { return request({ - url: '/app-api/trade/brokerage-withdraw/create', + url: '/trade/brokerage-withdraw/create', method: 'POST', data, }); @@ -39,7 +39,7 @@ const BrokerageApi = { // 获得商品的分销金额 getProductBrokeragePrice: (spuId) => { return request({ - url: '/app-api/trade/brokerage-record/get-product-brokerage-price', + url: '/trade/brokerage-record/get-product-brokerage-price', method: 'GET', params: { spuId @@ -50,7 +50,7 @@ const BrokerageApi = { getRankByPrice: (params) => { const queryString = `times=${params.times[0]}×=${params.times[1]}`; return request({ - url: `/app-api/trade/brokerage-user/get-rank-by-price?${queryString}`, + url: `/trade/brokerage-user/get-rank-by-price?${queryString}`, method: 'GET', }); }, @@ -60,7 +60,7 @@ const BrokerageApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); return request({ - url: `/app-api/trade/brokerage-user/rank-page-by-price?${queryString}`, + url: `/trade/brokerage-user/rank-page-by-price?${queryString}`, method: 'GET', }); }, @@ -70,14 +70,14 @@ const BrokerageApi = { .map((key) => encodeURIComponent(key) + '=' + params[key]) .join('&'); 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', }); }, // 获得下级分销统计分页 getBrokerageUserChildSummaryPage: (params) => { return request({ - url: '/app-api/trade/brokerage-user/child-summary-page', + url: '/trade/brokerage-user/child-summary-page', method: 'GET', params, }) diff --git a/sheep/api/trade/cart.js b/sheep/api/trade/cart.js index 55f55b48..f538d55c 100644 --- a/sheep/api/trade/cart.js +++ b/sheep/api/trade/cart.js @@ -3,7 +3,7 @@ import request from '@/sheep/request'; const CartApi = { addCart: (data) => { return request({ - url: '/app-api/trade/cart/add', + url: '/trade/cart/add', method: 'POST', data: data, custom: { @@ -14,21 +14,21 @@ const CartApi = { }, updateCartCount: (data) => { return request({ - url: '/app-api/trade/cart/update-count', + url: '/trade/cart/update-count', method: 'PUT', data: data }); }, updateCartSelected: (data) => { return request({ - url: '/app-api/trade/cart/update-selected', + url: '/trade/cart/update-selected', method: 'PUT', data: data }); }, deleteCart: (ids) => { return request({ - url: '/app-api/trade/cart/delete', + url: '/trade/cart/delete', method: 'DELETE', params: { ids @@ -37,7 +37,7 @@ const CartApi = { }, getCartList: () => { return request({ - url: '/app-api/trade/cart/list', + url: '/trade/cart/list', method: 'GET', }); }, diff --git a/sheep/api/trade/config.js b/sheep/api/trade/config.js index 4af729fb..16806ed8 100644 --- a/sheep/api/trade/config.js +++ b/sheep/api/trade/config.js @@ -4,7 +4,7 @@ const TradeConfigApi = { // 获得交易配置 getTradeConfig: () => { return request({ - url: `/app-api/trade/config/get`, + url: `/trade/config/get`, method: 'GET', }); }, diff --git a/sheep/api/trade/delivery.js b/sheep/api/trade/delivery.js index 65d0f00a..27a08d95 100644 --- a/sheep/api/trade/delivery.js +++ b/sheep/api/trade/delivery.js @@ -4,7 +4,7 @@ const DeliveryApi = { // 获得快递公司列表 getDeliveryExpressList: () => { return request({ - url: `/app-api/trade/delivery/express/list`, + url: `/trade/delivery/express/list`, method: 'get', }); } diff --git a/sheep/api/trade/order.js b/sheep/api/trade/order.js index a149b773..dd3384cb 100644 --- a/sheep/api/trade/order.js +++ b/sheep/api/trade/order.js @@ -35,7 +35,7 @@ const OrderApi = { .map((key) => key + '=' + data2[key]) .join('&'); return request({ - url: `/app-api/trade/order/settlement?${queryString}`, + url: `/trade/order/settlement?${queryString}`, method: 'GET', custom: { showError: true, @@ -46,7 +46,7 @@ const OrderApi = { // 创建订单 createOrder: (data) => { return request({ - url: `/app-api/trade/order/create`, + url: `/trade/order/create`, method: 'POST', data, }); @@ -54,7 +54,7 @@ const OrderApi = { // 获得订单 getOrder: (id) => { return request({ - url: `/app-api/trade/order/get-detail`, + url: `/trade/order/get-detail`, method: 'GET', params: { id, @@ -64,7 +64,7 @@ const OrderApi = { // 订单列表 getOrderPage: (params) => { return request({ - url: '/app-api/trade/order/page', + url: '/trade/order/page', method: 'GET', params, custom: { @@ -75,7 +75,7 @@ const OrderApi = { // 确认收货 receiveOrder: (id) => { return request({ - url: `/app-api/trade/order/receive`, + url: `/trade/order/receive`, method: 'PUT', params: { id, @@ -85,7 +85,7 @@ const OrderApi = { // 取消订单 cancelOrder: (id) => { return request({ - url: `/app-api/trade/order/cancel`, + url: `/trade/order/cancel`, method: 'DELETE', params: { id, @@ -95,7 +95,7 @@ const OrderApi = { // 删除订单 deleteOrder: (id) => { return request({ - url: `/app-api/trade/order/delete`, + url: `/trade/order/delete`, method: 'DELETE', params: { id, @@ -105,7 +105,7 @@ const OrderApi = { // 获得交易订单的物流轨迹 getOrderExpressTrackList: (id) => { return request({ - url: `/app-api/trade/order/get-express-track-list`, + url: `/trade/order/get-express-track-list`, method: 'GET', params: { id, @@ -115,7 +115,7 @@ const OrderApi = { // 获得交易订单数量 getOrderCount: () => { return request({ - url: '/app-api/trade/order/get-count', + url: '/trade/order/get-count', method: 'GET', custom: { showLoading: false, @@ -126,7 +126,7 @@ const OrderApi = { // 创建单个评论 createOrderItemComment: (data) => { return request({ - url: `/app-api/trade/order/item/create-comment`, + url: `/trade/order/item/create-comment`, method: 'POST', data, }); diff --git a/sheep/config/index.js b/sheep/config/index.js index 2d6a8703..209a9dcd 100644 --- a/sheep/config/index.js +++ b/sheep/config/index.js @@ -7,9 +7,9 @@ if (process.env.NODE_ENV === 'development') { baseUrl = import.meta.env.SHOPRO_BASE_URL; } version = import.meta.env.SHOPRO_VERSION; -console.log(`[Shopro ${version}] http://api-dashboard.yudao.iocoder.cn/`); -export const apiPath = import.meta.env.SHOPRO_API_PATH; +console.log(`[芋道商城 ${version}] http://doc.iocoder.cn`); +export const apiPath = import.meta.env.SHOPRO_API_PATH; export const staticUrl = import.meta.env.SHOPRO_STATIC_URL; export default { diff --git a/sheep/request/index.js b/sheep/request/index.js index ea3e25cc..99c38a4f 100644 --- a/sheep/request/index.js +++ b/sheep/request/index.js @@ -4,10 +4,7 @@ */ import Request from 'luch-request'; -import { - baseUrl, - apiPath -} from '@/sheep/config'; +import { baseUrl, apiPath } from '@/sheep/config'; import $store from '@/sheep/store'; import $platform from '@/sheep/platform'; import { @@ -51,7 +48,7 @@ function closeLoading() { * @description 请求基础配置 可直接使用访问自定义请求 */ const http = new Request({ - baseURL: baseUrl, + baseURL: baseUrl + apiPath, timeout: 8000, method: 'GET', header: { @@ -99,12 +96,10 @@ http.interceptors.request.use( config.header['Authorization'] = token; } // TODO 芋艿:特殊处理 - if (config.url.indexOf('/app-api/') !== -1) { - config.header['Accept'] = '*/*' - config.header['tenant-id'] = '1'; - config.header['terminal'] = '20'; - // config.header['Authorization'] = 'Bearer test247'; - } + config.header['Accept'] = '*/*' + config.header['tenant-id'] = '1'; + config.header['terminal'] = '20'; + // config.header['Authorization'] = 'Bearer test247'; return config; }, (error) => { @@ -301,15 +296,6 @@ const getRefreshToken = () => { } 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); };