import http from './http.js' const config = { // 示例 // wxLogin : {url : '/api/wxLogin', method : 'POST', // auth : false, showLoading : true, loadingTitle : '加载中...', // limit : 1000 // }, getConfig: { url: '/api/getConfig', method: 'GET', limit: 1000 }, //获取banner列表 indexGetBanner: { url: '/api/index/getBanner', method: 'GET', showLoading : true, }, //获取演员集详情接口 indexGetActorDetail: { url: '/api/index/getActorDetail', method: 'GET', showLoading : true, }, //获取认证演员 indexGetActorList: { url: '/api/index/getActorList', method: 'GET', showLoading : true, }, //获取动态列表带分页 indexGetTrendsPage: { url: '/api/index/getTrendsPage', method: 'GET', showLoading : true, }, //获取演员列表带分页 indexGetActorSetPage: { url: '/api/index/getActorSetPage', method: 'GET', showLoading : true, }, //获取动态详情 indexGetTrendsDetail: { url: '/api/index/getTrendsDetail', method: 'GET', showLoading : true, }, //获取投诉原因 indexGetComplaintReason: { url: '/api/index/getComplaintReason', method: 'GET' }, //获取作品列表 indexGetGetWorkPage: { url: '/api/index/getWorkPage', method: 'GET', showLoading : true, }, //获取作品详情 indexGetGetWorkDetail: { url: '/api/index/getWorkDetail', method: 'GET', showLoading : true, }, //获取置顶列表 indexTopPayList: { url: '/api/index/getTopPayList', method: 'GET', showLoading : true, }, // 小程序-个人中心接口 //点击创建支付订单支付获取联系方式 getContact: { url: '/api/info/getContact', method: 'GET', auth: true, limit : 1500, showLoading : true, }, //添加银行卡 infoAddBankCard: { url: '/api/info/addBankCard', method: 'GET', auth: true, limit : 1500, showLoading : true, }, //发布动态 infoReleaseTrends: { url: '/api/info/releaseTrends', method: 'POST', auth: true, limit : 1000, showLoading : true, }, //发布演员接口 publishActor: { url: '/api/info/releaseActorSet', method: 'POST', auth: true, limit : 1000, showLoading : true, }, //获取银行卡列表带分页 infoGetBankCardPage: { url: '/api/info/getBankCardPage', method: 'GET', auth: true, showLoading : true, }, // 获取个人认证信息 infoGetCertification: { url: '/api/info/getCertification', method: 'GET', auth: true, showLoading : true, }, //获取企业认证信息 infoGetCompanyCertification: { url: '/api/info/getCompanyCertification', method: 'GET', auth: true, showLoading : true, }, // 获取收益记录带分页 infoGetIncomePage: { url: '/api/info/getIncomePage', method: 'GET', auth: true, showLoading : true, }, // 获取个人信息接口 infoGetInfo: { url: '/api/info/getInfo', method: 'GET', auth: true }, // 获取我的发布详情 infoGetMyReleaseDetail: { url: '/api/info/getMyReleaseDetail', method: 'GET', auth: true, showLoading : true, }, // 获取我的发布列表 infoGetMyReleasePage: { url: '/api/info/getMyReleasePage', method: 'GET', auth: true, showLoading : true, }, // 获取推广记录详情 infoGetPromotionDetail: { url: '/api/info/getPromotionDetail', method: 'GET', auth: true, showLoading : true, }, // 确认推广 confirmPromotion: { url: '/api/info/confirmPromotion', method: 'POST', auth: true, showLoading : true, }, // 获取推广记录列表 infoGetPromotionPage: { url: '/api/info/getPromotionPage', method: 'GET', auth: true, showLoading : true, }, // 获取提现记录带分页 infoGetWithdrawPage: { url: '/api/info/getWithdrawPage', method: 'GET', auth: true, showLoading : true, }, // 个人认证提交 infoSubmitCertification: { url: '/api/info/submitCertification', method: 'POST', auth: true, showLoading : true, }, // 企业认证提交 infoSubmitCompanyCertification: { url: '/api/info/submitCompanyCertification', method: 'POST', auth: true, showLoading : true, }, // 修改个人信息接口 infoUpdateInfo: { url: '/api/info/updateInfo', method: 'POST', auth: true, showLoading : true, }, // 用户提现 infoWithdraw: { url: '/api/info/withdraw', method: 'POST', auth: true, showLoading : true, }, // 获取用户平台数据 infoGetInfoMoney: { url: '/api/info/getInfoMoney', method: 'GET', auth: true, showLoading : true, }, // 踩type-作品0-演员1-动态2 infoDislike: { url: '/api/info/dislike', method: 'GET', auth: true, showLoading : true, }, // 点赞type-作品0-演员1-动态2 infoLike: { url: '/api/info/like', method: 'GET', auth: true, showLoading : true, }, // 举报type-作品0-演员1-动态2 infoReport: { url: '/api/info/report', method: 'GET', auth: true, showLoading : true, }, // 发布作品 releaseWorks: { url: '/api/info/releaseWorks', method: 'POST', auth: true, showLoading : true, }, // 提交反馈接口 submitFeedback: { url: '/api/info/submitFeedback', method: 'POST', auth: true, limit : 3000, showLoading : true, }, //小程序-登录相关接口 // 获取隐私政策 getPrivacyPolicy: { url: '/api/login/getPrivacyPolicy', method: 'GET', }, // 获取发布帖子发布需知 getPublishPostNotice: { url: '/api/login/getPublishPostNotice', method: 'GET', }, // 获取用户协议 getUserAgreement: { url: '/api/login/getUserAgreement', method: 'GET', }, //绑定手机接口 loginBindPhone: { url: '/api/login/bindPhone', method: 'GET', auth: true, showLoading : true, }, // 找回密码接口 loginForget: { url: '/api/login/forget', method: 'GET', auth: true, showLoading : true, }, // 登录接口 loginLogin: { url: '/api/login/login', method: 'GET', showLoading : true, }, // 退出接口 loginLogout: { url: '/api/login/logout', method: 'GET', auth: true, showLoading : true, }, // 注册接口 loginRegister: { url: '/api/login/register', method: 'GET', }, // 发送验证码接口 loginSendcode: { url: '/api/login/sendCode', method: 'GET', showLoading : true, }, } export function api(key, data, callback, loadingTitle) { let req = config[key] if (!req) { console.error('无效key' + key); return } if (typeof callback == 'string') { loadingTitle = callback } if (typeof data == 'function') { callback = data data = {} } // 接口限流 if (req.limit) { let storageKey = 'limit:' + req.url let storage = uni.getStorageSync(storageKey) if (storage && new Date().getTime() - parseInt(storage) < req.limit) { console.log(storageKey); return } uni.setStorageSync(storageKey, new Date().getTime()) } //必须登录 if (req.auth) { if (!uni.getStorageSync('token')) { uni.navigateTo({ url: '/pages/auth/login' }) console.error('需要登录') return } } http.http(req.url, data, callback, req.method, loadingTitle || req.showLoading, loadingTitle || req.loadingTitle) } export default api