提交 e587be01 编写于 作者: 0 052004122温宸杰

11

上级 55a14365
const clientInfo = { // 模拟clientInfo
uniPlatform: 'web',
source: 'client', // 调用来源,不传时默认为 client
// 客户端ip,不传时默认为 127.0.0.1
userAgent: 'xx MicroMessenger/xxx', // 客户端ua,不传时默认为 HBuilderX
uniIdToken: 'xxx'
}
information('645cd81228064a7587bd2abb') // 调用login方法传入参数'name-demo'和'password-demo'
\ No newline at end of file
// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
module.exports = {
_before: function () { // 通用预处理器
},
/**
* method1方法描述
* @param {string} param1 参数1描述
* @returns {object} 返回值描述
*/
/*
method1(param1) {
// 参数校验,如无参数则不需要
if (!param1) {
return {
errCode: 'PARAM_IS_NULL',
errMsg: '参数不能为空'
}
}
// 业务逻辑
// 返回结果
return {
param1 //请根据实际需要返回值
}
}
*/
information(userId){
const db = uniCloud.database();
const user_table = db.collection('mustgo-user')
const team_table = db.collection('mustgo-team')
let res = await user_table.where({
_id:userId
}).get()
var team = ""
if (res.affectedDocs == 1) {
var team_id = res.data[0]["team_id"]
if(team_id != null){
let res2 = await team_table.where({
_id: res.data[0]["team_id"]
}).get()
if(res2.affectedDocs == 1){
team = res2.data[0]["name"]
}
}
return {
code: 200,
message: "成功返回用户信息",
data: {
"icon": res.data[0]["icon"],
"username": res.data[0]["name"],
"school": res.data[0]["school"],
"team": team
}
}
}
return {
"code": 400,
"message": "返回用户信息失败",
"data": {}
}
},
}
{
"name": "fe-my",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册