增加一个店铺介绍文字的配置
This commit is contained in:
parent
fb335fc620
commit
ebdfef3b67
@ -31,6 +31,7 @@
|
||||
|
||||
1. 增加[开始分享优惠券](#223), [领取分享的优惠券](#224) 接口
|
||||
2. [用户券列表](#211), [抽奖](#214), [邀请奖励信息](#215), [领取邮件附件](#217)等接口返回的优惠券信息, 增加expire字段
|
||||
3. [获取店铺信息](#208) 的gamecfg增加返回 default_desc_txt, 用于首页介绍文字
|
||||
|
||||
|
||||
|
||||
@ -387,7 +388,8 @@
|
||||
"game_single_btn": "主页上单人赛按钮文字",
|
||||
"game_multi_btn": "主页上多人赛按钮名字",
|
||||
"default_share_pic":"默认分享图",
|
||||
"default_share_txt": "默认分享语"
|
||||
"default_share_txt": "默认分享语",
|
||||
"default_desc_txt": "配置的介绍文字"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -14,7 +14,33 @@ class CouponController extends BaseController {
|
||||
@role('anon')
|
||||
@router('get /pub/coupon/:shop/:id')
|
||||
async info(req: any) {
|
||||
return {}
|
||||
const { id, shop } = req.params
|
||||
if (!id || !shop) {
|
||||
throw new ZError(10, '缺少必要参数')
|
||||
}
|
||||
const record = await UserCoupon.findOne({ sid: id, shop })
|
||||
if (!record) {
|
||||
throw new ZError(11, 'no matched records')
|
||||
}
|
||||
if (record.expire) {
|
||||
// 如果有过期时间设置, 且已经过期, 则将未使用和已分享但未被领取的记录更新为已过期
|
||||
if (Date.now() >= record.expire && (record.status === 0 || record.status === 2)) {
|
||||
record.status = 9
|
||||
await record.save()
|
||||
}
|
||||
}
|
||||
const shopData = await Shop.fetchByID(record.shop)
|
||||
const coupon = await Coupon.findById(record.item)
|
||||
return {
|
||||
id: record.sid,
|
||||
shop: record.shop,
|
||||
shopName: shopData.showName,
|
||||
coupon: record.item,
|
||||
couponName: coupon.name,
|
||||
couponUrl: getCouponUrl(shopData.id, record.item),
|
||||
status: record.status,
|
||||
expire: record.expire,
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 核销
|
||||
@ -22,6 +48,26 @@ class CouponController extends BaseController {
|
||||
@role('anon')
|
||||
@router('post /pub/coupon/:shop/:id')
|
||||
async use(req: any) {
|
||||
const { id, shop } = req.params
|
||||
if (!id || !shop) {
|
||||
throw new ZError(10, '缺少必要参数')
|
||||
}
|
||||
const record = await UserCoupon.findOne({ sid: id, shop })
|
||||
if (!record) {
|
||||
throw new ZError(11, 'no matched records')
|
||||
}
|
||||
if (record.expire) {
|
||||
// 如果有过期时间设置, 且已经过期, 则将未使用和已分享但未被领取的记录更新为已过期
|
||||
if (Date.now() >= record.expire && (record.status === 0 || record.status === 2)) {
|
||||
record.status = 9
|
||||
await record.save()
|
||||
}
|
||||
}
|
||||
if (record.status !== 0) {
|
||||
throw new ZError(12, 'record status not matched')
|
||||
}
|
||||
record.status = 1
|
||||
await record.save()
|
||||
return {}
|
||||
}
|
||||
/**
|
||||
|
@ -29,6 +29,7 @@ export class ShopGameExtClass extends BaseModule {
|
||||
* game_multi_btn: 主页上多人赛按钮名字
|
||||
* default_share_pic: 默认的分享图
|
||||
* default_share_txt: 默认的分享语
|
||||
* default_desc_txt: 默认的介绍文字
|
||||
*/
|
||||
@prop({ type: mongoose.Schema.Types.Mixed })
|
||||
public cfg: {}
|
||||
|
@ -157,7 +157,7 @@ class UserCouponClass extends BaseModule {
|
||||
let sid = record.shop
|
||||
if (record.expire) {
|
||||
// 如果有过期时间设置, 且已经过期, 则将未使用和已分享但未被领取的记录更新为已过期
|
||||
if (Date.now() >= record.expire && (record.status === 0 || record.status === 2) ) {
|
||||
if (Date.now() >= record.expire && (record.status === 0 || record.status === 2)) {
|
||||
record.status = 9
|
||||
await record.save()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user