增加广告跳转,增加现金红包配置

This commit is contained in:
2024-12-16 10:38:20 +08:00
parent 95b3a5c4ce
commit b2c7ce63b7
8 changed files with 1967 additions and 1267 deletions

View File

@@ -1,19 +1,25 @@
class API {
constructor(url,req) {
import $http from '@/utils/httpRequest'
class API {
constructor(constructorData) {
const map={
add:'POST',
del:'DELETE',
update:'PUT',
get:'GET'
add:'post',
del:'post',
update:'post',
get:'get',
getList:'get'
}
this.url=url
for(let key in map){
let url=constructorData[key].url||constructorData[key]
const method=constructorData[key].method||map[key]
this[key]=function(data){
data=Array.isArray(data)?data:{...data,shopId:uni.getStorageSync('shopId')}
if(key==='del'){
delete data.shopId
}
return req(url, data,map[key])
console.log(data)
return $http({
url: (key=='get'?(url+'/'+data.id||data):url) +(key=='del'?'?id='+(data.id||data):''),
method:method,
params:(method=='get'&&key!='del')?data:{},
data: (method=='post'&&key!='del')?data:{}
})
}
}
}