MCPcopy Create free account
hub / github.com/badyun/AShare / put

Function put

controller/account.js:9–25  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

7 res.return(s)
8 },
9 async put(req, res) {
10 const cloud = new Cloud()
11 try {
12 let info = await cloud.login(req.body.refresh_token)
13 let userInfo = await cloud.getInfo()
14 Object.assign(info, userInfo.personal_space_info)
15 info.adminId = req.info.userInfo.id
16 info.createTime = new Date()
17 info.tip = req.body.tip
18 info.type = true
19 db('account').find({ id: info.id }).assign(info).write()
20 res.return('添加成功')
21 } catch (error) {
22 // console.log(error)
23 res.error(error)
24 }
25 },
26 async post(req, res) {
27 let s = db('account').find({ adminId: req.info.userInfo.id, id: req.body.id }).value()
28 if (!s) {

Callers

nothing calls this directly

Calls 2

loginMethod · 0.80
getInfoMethod · 0.80

Tested by

no test coverage detected