用户信息接口增加头像和昵称的上传
This commit is contained in:
parent
a4d44e2da7
commit
a9d799b05e
@ -23,6 +23,15 @@
|
||||
| -------- | -------------------------------------- |
|
||||
| accountid | 帐号id |
|
||||
|
||||
> POST参数
|
||||
|
||||
|
||||
| 字段 | 说明 |
|
||||
| -------- | -------------------------------------- |
|
||||
| nickname |昵称 |
|
||||
| avatar |头像 |
|
||||
|
||||
|
||||
3. Response: JSON
|
||||
|
||||
```js
|
||||
|
@ -5,7 +5,6 @@ import { ZError } from '../common/ZError'
|
||||
import { Card } from '../models/subdoc/Card'
|
||||
import { BaseConst } from '../constants/BaseConst'
|
||||
import { Hero } from '../models/subdoc/Hero'
|
||||
import { CardGroup } from '../models/CardGroup'
|
||||
import { BagItem, ItemType } from '../models/BagItem'
|
||||
import { addHeroDefaultCardGroup } from '../dao/CardGroupDao'
|
||||
|
||||
@ -13,7 +12,7 @@ export default class AccountController extends BaseController {
|
||||
@role('anon')
|
||||
@router('post /api/:accountid/uinfo')
|
||||
async info(req: any) {
|
||||
let { accountid } = req.params
|
||||
let { accountid, nickname, avatar } = req.params
|
||||
let account = (await User.findOrCreate({ _id: accountid })).doc
|
||||
let result: any = { accountid: account.id }
|
||||
if (account.locked) {
|
||||
@ -23,6 +22,12 @@ export default class AccountController extends BaseController {
|
||||
if (account.season_score == -1) {
|
||||
account.season_score = formulaCfg.get(70003).number
|
||||
}
|
||||
if (nickname) {
|
||||
account.nickname = nickname
|
||||
}
|
||||
if (avatar) {
|
||||
account.avatar = avatar
|
||||
}
|
||||
let cardMap = account.cardMap
|
||||
for (let [, cfg] of global.$cfg.get(BaseConst.EFFECTCARD)) {
|
||||
if (cfg.org_gift == 1 && cfg.type_id == 1 && !cardMap.has(cfg.id + '')) {
|
||||
|
@ -46,6 +46,10 @@ interface AccountClass extends Base<string>, TimeStamps {
|
||||
class UserClass extends FindOrCreate {
|
||||
@prop()
|
||||
public _id: string
|
||||
@prop()
|
||||
public nickname: string
|
||||
@prop()
|
||||
public avatar: string
|
||||
|
||||
@prop({ default: false })
|
||||
public locked: boolean
|
||||
|
Loading…
x
Reference in New Issue
Block a user