Browse Source

上传api

master
李小宇a 11 months ago
parent
commit
bfdabcd095
1 changed files with 173 additions and 22 deletions
  1. +173
    -22
      api/api.js

+ 173
- 22
api/api.js View File

@ -6,50 +6,201 @@ const config = {
// auth : false, showLoading : true, loadingTitle : '加载中...',
// limit : 1000
// },
getConfig : {url : '/api/getConfig', method : 'GET', limit : 500},
getConfig: {
url: '/api/getConfig',
method: 'GET',
limit: 500
},
//获取banner列表
indexGetBanner : {url : '/api/index/getBanner', method : 'GET'},
indexGetBanner: {
url: '/api/index/getBanner',
method: 'GET'
},
//获取认证演员
indexGetActorList : {url : '/api/index/getActorList', method : 'GET'},
indexGetActorList: {
url: '/api/index/getActorList',
method: 'GET'
},
//获取动态列表带分页
indexGetTrendsPage : {url : '/api/index/getTrendsPage', method : 'GET'},
indexGetTrendsPage: {
url: '/api/index/getTrendsPage',
method: 'GET'
},
//获取动态列表带分页
indexGetActorSetPage : {url : '/api/index/getActorSetPage', method : 'GET'},
indexGetActorSetPage: {
url: '/api/index/getActorSetPage',
method: 'GET'
},
//获取动态详情
indexGetTrendsDetail : {url : '/api/index/getTrendsDetail', method : 'GET'},
}
indexGetTrendsDetail: {
url: '/api/index/getTrendsDetail',
method: 'GET'
},
// 小程序-个人中心接口
export function api(key, data, callback, loadingTitle){
//添加银行卡
infoAddBankCard: {
url: '/api/info/addBankCard',
method: 'GET',
auth: true
},
//获取银行卡列表带分页
infoGetBankCardPage: {
url: '/api/info/getBankCardPage',
method: 'GET',
auth: true
},
// 获取个人认证信息
infoGetCertification: {
url: '/api/info/getCertification',
method: 'GET',
auth: true
},
//获取企业认证信息
infoGetCompanyCertification: {
url: '/api/info/getCompanyCertification',
method: 'GET',
auth: true
},
// 获取收益记录带分页
infoGetIncomePage: {
url: '/api/info/getIncomePage',
method: 'GET',
auth: true
},
// 获取个人信息接口
infoGetInfo: {
url: '/api/info/getInfo',
method: 'GET',
auth: true
},
// 获取我的发布详情
infoGetMyReleaseDetail: {
url: '/api/info/getMyReleaseDetail',
method: 'GET',
auth: true
},
// 获取我的发布列表
infoGetMyReleasePage: {
url: '/api/info/getMyReleasePage',
method: 'GET',
auth: true
},
// 获取推广记录详情
infoGetPromotionDetail: {
url: '/api/info/getPromotionDetail',
method: 'GET',
auth: true
},
// 获取推广记录列表
infoGetPromotionPage: {
url: '/api/info/getPromotionPage',
method: 'GET',
auth: true
},
// 获取提现记录带分页
infoGetWithdrawPage: {
url: '/api/info/getWithdrawPage',
method: 'GET',
auth: true
},
// 个人认证提交
infoSubmitCertification: {
url: '/api/info/submitCertification',
method: 'GET',
auth: true
},
// 企业认证提交
infoSubmitCompanyCertification: {
url: '/api/info/submitCompanyCertification',
method: 'GET',
auth: true
},
// 修改个人信息接口
infoUpdateInfo: {
url: '/api/info/updateInfo',
method: 'POST',
auth: true
},
// 用户提现
infoWithdraw: {
url: '/api/info/withdraw',
method: 'GET',
auth: true
},
//小程序-登录相关接口
//绑定手机接口
loginBindPhone: {
url: '/api/login/bindPhone',
method: 'GET',
auth: true
},
// 找回密码接口
loginForget: {
url: '/api/login/forget',
method: 'GET',
auth: true
},
// 登录接口
loginLogin: {
url: '/api/login/login',
method: 'GET',
auth: true
},
// 退出接口
loginLogout: {
url: '/api/login/logout',
method: 'GET',
auth: true
},
// 注册接口
loginRegister: {
url: '/api/login/register',
method: 'GET',
auth: true
},
// 发送验证码接口
loginSendcode: {
url: '/api/login/sendCode',
method: 'GET',
auth: true
},
}
export function api(key, data, callback, loadingTitle) {
let req = config[key]
ifo
if (!req) {
console.error('无效key' + key);
return
}
if(typeof callback == 'string'){
if (typeof callback == 'string') {
loadingTitle = callback
}
if(typeof data == 'function'){
if (typeof data == 'function') {
callback = data
data = {}
}
// 接口限流
if(req.limit){
if (req.limit) {
let storageKey = 'limit:' + req.url
let storage = uni.getStorageSync(storageKey)
if(storage && new Date().getTime() - parseInt(storage) < req.limit){
if (storage && new Date().getTime() - parseInt(storage) < req.limit) {
return
}
uni.setStorageSync(storageKey, new Date().getTime())
}
//必须登录
if (req.auth) {
if (!uni.getStorageSync('token')) {
@ -60,9 +211,9 @@ export function api(key, data, callback, loadingTitle){
return
}
}
http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
http.http(req.url, data, callback, req.method,
loadingTitle || req.showLoading, loadingTitle || req.loadingTitle)
}


Loading…
Cancel
Save