24 lines
779 B
TypeScript
24 lines
779 B
TypeScript
import cloud from '@lafjs/cloud'
|
||
const db = cloud.database();
|
||
import Utils from "@/Utils";
|
||
export default async function (ctx: FunctionContext) {
|
||
let db1 = "69fabd35b4d89b170da4bf5e";
|
||
const uid = ctx.body.uid;
|
||
const gameName = ctx.body.gameName;
|
||
if (gameName == "iaa") {
|
||
db1 = "";
|
||
}
|
||
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: '删除完毕' }
|
||
}
|