feat: 补齐客户端/管理端服务模块与数据库 schema,完善登录短信、法大大签署及公共函数

This commit is contained in:
2026-10-14 21:55:08 +08:00
parent 3481fda7a0
commit 55bcf96889
545 changed files with 28151 additions and 415 deletions
@@ -15,43 +15,40 @@ module.exports = {
main: async (event) => {
let { data = {}, util, originalParam } = event;
let { uniID, config, pubFun, vk, db, _ } = util;
let { uid } = data;
let { uid, accountType, code } = data;
let res = {};
// 业务逻辑开始-----------------------------------------------------------
let {
code,
accessToken,
type,
myInviteCode,
needPermission
} = data;
res = await uniID.loginByQQ({
code,
accessToken,
type,
myInviteCode,
needPermission
});
if (res.token) {
if (!res.msg) {
res.msg = res.type === "register" ? "注册成功" : "登录成功";
}
let encrypted = vk.crypto.aes.encrypt({
data: res
});
delete res.sessionKey; // 删除明文sessionKey
delete res.accessToken; // 删除明文accessToken
delete res.refreshToken; // 删除明文refreshToken
res.encryptedKey = encrypted; // 返回前端加密内容
// 日志服务
const loginLogService = vk.require("service/user/util/login_log");
await loginLogService.add({
type: "login",
login_type: "qq",
user_id: res.uid,
context: originalParam.context
}, util);
}
let custom = {
accountType: parseInt(accountType),
nickname: `QQ用户` + vk.pubfn.random(6)
};
// res = await uniID.loginByQQ({
// code,
// accessToken,
// type,
// myInviteCode,
// needPermission
// });
const redirect_uri = 'http://static-mp-0737e52b-fffa-4223-bcdf-d4ad3d9968a5.next.bspapp.com/#/pages/auth/login/qq'
const qqRes = await vk.request({
url: `https://graph.qq.com/oauth2.0/token?grant_type=authorization_code&client_id=101795826&client_secret=1a41633966fb97cefea512f6c8601638&code=${code}&redirect_uri=` + encodeURIComponent(redirect_uri),
method: 'GET',
})
if (qqRes.access_token) {
const qqUserRes = await vk.request({
url: `https://graph.qq.com/oauth2.0/me?access_token=${qqRes.access_token}`,
method: 'GET',
})
if (qqUserRes.openid) {
const userByQQOpenid = await vk.baseDao.findByWhereJson({
dbName: "uni-id-users",
whereJson: {
"qq.openid": qqUserRes.openid
}
})
}
}
// 业务逻辑结束-----------------------------------------------------------
return res;
}