24 lines
785 B
TypeScript
24 lines
785 B
TypeScript
import cloud from '@lafjs/cloud'
|
||
const db=cloud.database();
|
||
import Utils from "@/Utils";
|
||
export default async function (ctx: FunctionContext) {
|
||
let db1 = "691093093cf0c4532ba4fd9c";
|
||
const uid=ctx.body.uid;
|
||
const gameName = ctx.body.gameName;
|
||
if (gameName == "iaa") {
|
||
db1 = "691097ac3cf0c4532ba4fd9e";
|
||
}
|
||
let rankInfo = await db.collection("sRank").where({ _id: db1 }).getOne();
|
||
let total = JSON.parse(rankInfo.data.total);
|
||
for(var key in total){
|
||
for(let i=0;i<total[key].length;i++){
|
||
if(total[key][i].id==uid){
|
||
total[key].splice(i,1);
|
||
//console.log(key+" 删除一个 :"+uid);
|
||
}
|
||
}
|
||
}
|
||
let ret1 = await db.collection("sRank").where({ _id: db1 }).update({ total: JSON.stringify(total) });
|
||
return { data: '删除完毕' }
|
||
}
|