'use strict'; exports.main = async (event, context) => { //event为客户端上传的参数 console.log('event : ', event) const db = uniCloud.database(); const collection = db.collection('mustgo-user'); let res = await collection.where({ phone_num: event.phone }).get() console.log(res.data[0]) if (res.data[0]["password"] == event.password) return { code: 200, message: "登录成功", data: { userId: res.data[0]["_id"], name: res.data[0]["name"], icon: res.data[0]["icon"], gender: res.data[0]["gender"], phone_num: res.data[0]["phone_num"], team_id: res.data[0]["team_id"], school: res.data[0]["school"], type: res.data[0]["type"], total_running_distance: res.data[0]["total_running_distance"], total_walking_distance: res.data[0]["total_walking_distance"] } } //返回数据给客户端 return { code: 400, message: "用户名或密码错误", data: { } } };