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

Function post

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

Source from the content-addressed store, hash-verified

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) {
29 res.error('当前天翼账号不属于该管理员')
30 } else {
31 db('account').find({ adminId: req.info.userInfo.id, id: req.body.id }).assign(req.body).write()
32 db('account').find({ adminId: req.info.userInfo.id, id: req.body.id }).assign({ cookie: null }).write()
33 try {
34 await cloud.login(req.body.refresh_token)
35 db('account').find({ adminId: req.info.userInfo.id, id: req.body.id }).assign({ type: true }).write()
36 res.return('修改成功')
37 } catch (error) {
38 db('account').find({ adminId: req.info.userInfo.id, id: req.body.id }).assign({ type: false }).write()
39 res.error(error)
40 }
41 }
42 },
43 async delete(req, res) {
44 db('account').remove({ adminId: req.info.userInfo.id, id: req.body.id }).write()
45 res.return('删除成功')

Callers

nothing calls this directly

Calls 1

loginMethod · 0.80

Tested by

no test coverage detected