import cloud from '@lafjs/cloud' const db = cloud.database(); import Utils from "@/Utils"; export default async function (ctx: FunctionContext) { let uid=ctx.body.uid; const gameName = ctx.body.gameName; let res1; if (gameName == "iaa") { res1 = await db.collection("rank").where({ _id: "68e92b7835004ffb5ab9ee89" }).getOne(); }else{ res1 = await db.collection("rank").where({ _id: "689db6c5cc79706182bd6a9f" }).getOne(); } let rank=JSON.parse(res1.data.rank) let list=[]; if(rank.length<200){ list=rank; }else{ for (let i = 0; i < 200; i++) { // if(rank[i].useravatar==""){ // rank[i].useravatar=Math.floor(Math.random()*4)+""; // } list.push(rank[i]); } } let index=-1; for(let i=0;i