活动和挑战增加一些图片字段

This commit is contained in:
zhl 2021-05-24 17:40:19 +08:00
parent b82ebead9d
commit 05eb62f749
4 changed files with 34 additions and 4 deletions

View File

@ -326,14 +326,24 @@
"exams": [{ // 店铺测验信息
"id": "609e13eeccc78154ac683583", //id
"name": "第一期测试", // 测验
"desc": "简介"
"desc": "简介",
"icon": "", // 相关icon
"banner": "", // 介绍大图
}],
"activity": { // 活动信息
"id": "608bdf61cecfcc2f45247663", // 活动id
"name": "第一个活动", // 活动名
"desc": "", // 活动简介
"icon": "", // 活动相关icon
"banner": "", // 活动介绍大图
"curren": 1621008800000 // 当前正在进行的活动开始时间, 没有该字段或undefined的话, 说明没有当前进行中的活动
"next": 1621008900000 // 下一个活动开始时间, 没有该字段或undefined的话, 说明没有即将开始的活动
},
"gameCfg": {
"game_main_pic": "主页正中间图片",
"bg_item_icon": "背景图案",
"game_single_btn": "主页上单人赛按钮文字",
"game_multi_btn": "主页上多人赛按钮名字"
}
}
```

View File

@ -4,6 +4,7 @@ import { role, router } from '../../decorators/router'
import { ZError } from '../../common/ZError'
import { ShopExam } from '../../models/shop/ShopExam'
import { ShopActivity } from '../../models/shop/ShopActivity'
import { ShopGameExt } from '../../models/shop/ShopGameExt'
class ShopController extends BaseController {
@ -93,6 +94,14 @@ class ShopController extends BaseController {
if (!shop) {
throw new ZError(11, '未找到对应的店铺')
}
rspData.gameCfg = {}
if (!shop.gameInfo) {
let gameInfo = shop.gameInfo
let cfgRecord = await ShopGameExt.find({shop: shop.id, game: gameInfo.gameid, version: gameInfo.versionid})
if (cfgRecord && cfgRecord.length > 0) {
Object.assign(rspData.gameCfg, cfgRecord[0].cfg)
}
}
rspData.id = shop.sid
rspData.name = shop.showName
rspData.area = shop.areaStr
@ -108,7 +117,7 @@ class ShopController extends BaseController {
if (exams && exams.length > 0) {
let datas: any = []
for (let exam of exams) {
datas.push({ id: exam.id, name: exam.name, desc: exam.desc })
datas.push({ id: exam.id, name: exam.name, desc: exam.desc, icon: exam.icon, banner: exam.banner })
}
rspData.exams = datas
}

View File

@ -48,6 +48,11 @@ export class ShopActivityClass extends BaseModule {
@prop()
public desc: string
@prop()
public icon: string
@prop()
public banner: string
/**
*
* @type {string[]}
@ -169,7 +174,7 @@ export class ShopActivityClass extends BaseModule {
return null
}
let result: any = {id: record.id, name: record.name, desc: record.desc}
let result: any = {id: record.id, name: record.name, desc: record.desc, icon: record.icon, banner: record.banner}
result.current = record.currentTime
result.next = record.getNextTime(result.current)
return result

View File

@ -60,6 +60,12 @@ export class ShopExamClass extends BaseModule {
@prop()
public desc: string
@prop()
public icon: string
@prop()
public banner: string
/**
*
* @type {string[]}