上报用户信息接口增加上报当前店铺id

This commit is contained in:
zhl 2021-06-08 10:10:25 +08:00
parent bb123ec23e
commit 280a8251b7
4 changed files with 25 additions and 4 deletions

View File

@ -6,7 +6,8 @@
1. [增加用户信息](#212), [抽奖转盘信息](#213), [抽奖](#214), [邀请奖励信息](#215), [挑战详情](#216) 接口
2. 所有接口增加post字段 version(当前版本固定取1.0.1)和sessionid(取自jcfw)
3. 获取店铺信息 增加返回店铺的数字编号
4. 上报测验题目答案接口的 奖励信息 增加返回rewardType, 0: 表明该奖励为优惠券, 1: 抽奖券
4. 上报测验题目答案相关接口的 奖励信息 增加返回rewardType, 0: 表明该奖励为优惠券, 1: 抽奖券
5. 用户信息上报接口 增加上报当前店铺
@ -444,6 +445,7 @@
| country | 国家 |
| province | 省份 |
| city | 城市 |
| shop | 店铺id |
3. Response: JSON
@ -528,7 +530,7 @@
```js
[ // 奖励列表
{
coupon: '优惠券的id',
coupon: '优惠券的id', // 如果该值为 empty, 说明是留空的,
name: '优惠券名',
count: 1, //数量
couponUrl: '优惠券详情图的url',

View File

@ -81,7 +81,7 @@ class GameUserController extends BaseController {
@router('post /api/:accountId/share_rewards')
async shareRewards(req: any) {
const { accountId, sid, sessionid } = req.params
if (!sid) {
if (!sid || !sessionid) {
throw new ZError(10, '缺少必要参数: sid')
}
const shop = await Shop.fetchByID(sid)

View File

@ -665,7 +665,7 @@ Object.defineProperties(Array.prototype, {
let idx = this.indexOf(t)
if (!~idx) {
idx = this.length
this[idx] = t
this.push(t)
}
return idx
},

View File

@ -32,6 +32,18 @@ class GameUserClass extends BaseModule {
public locked: boolean
@prop()
public lockedTime?: Date
/**
*
* @type {string[]}
*/
@prop({ type: () => [String] })
public shops: string[]
/**
*
* @type {string}
*/
@prop()
public shop: string
public static async getByAccountID(this: ReturnModelType<typeof GameUserClass>, accountId: string) {
let records = await this.find({ accountId }).limit(1)
@ -46,6 +58,13 @@ class GameUserClass extends BaseModule {
}
return map
}
public updateFromReq(data: any) {
super.updateFromReq(data)
if (data.shop) {
this.shops.pushOnce(data.shop)
}
}
}
export const GameUser = getModelForClass(GameUserClass, { existingConnection: GameUserClass.db })