消费竞赛
This commit is contained in:
parent
4631cba0b3
commit
5b4e0cce65
@ -4,19 +4,28 @@ import {PayFun} from "../../../public/pay";
|
||||
import {HuoDongFun} from "../../../public/huodongfun";
|
||||
import {PublicShared} from "../../../shared/public/public";
|
||||
|
||||
|
||||
/**
|
||||
* 消费竞赛
|
||||
* redis缓存3分钟
|
||||
* 返回活动日期内的
|
||||
* @param call
|
||||
*/
|
||||
export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
// let data = await G.mongodb.cEvent('zhoumolibao').findOne({uid: call.uid, type: 'zhoumolibao'})
|
||||
//
|
||||
let ioList = await G.ioredis.get(`rank:xiaofeijingsai`);
|
||||
if (ioList) {
|
||||
return call.succ({list: JSON.parse(ioList)})
|
||||
}
|
||||
|
||||
let _hd = (await HuoDongFun.gethdList(call, 11))[0]
|
||||
console.log(_hd)
|
||||
//
|
||||
// let payIds = _hd?.data?.gift?.filter(i => i.payId)?.map(i => i.payId)
|
||||
// let a = []
|
||||
if (!_hd) return call.errorCode(-1)
|
||||
|
||||
let limit = _hd.data?.rank?.slice(-1)?.[0]?.rank?.slice(-1)?.[0] || 50
|
||||
|
||||
let rmbuse = await G.mongodb.collection('rmbuse').aggregate([
|
||||
{$match: {isAdd: false}},
|
||||
{$match: {isAdd: false, cTime: {$gte: _hd.stime, $lte: _hd.etime}}},
|
||||
{$group: {_id: "$uid", total: {$sum: "$change"}}},
|
||||
{$sort: {total: 1}}
|
||||
{$sort: {total: 1}},
|
||||
{$limit: limit}
|
||||
]).toArray()
|
||||
|
||||
let list: any = rmbuse.map(i => ({...i, total: R.negate(i.total)}))
|
||||
@ -25,5 +34,7 @@ export default async function (call: ApiCall<ReqOpen, ResOpen>) {
|
||||
|
||||
list = list.map(i => ({...i, player: users.find(v => v.uid == i._id)}))
|
||||
|
||||
G.ioredis.setex(`rank:xiaofeijingsai`, 180, JSON.stringify(list));
|
||||
|
||||
call.succ({list})
|
||||
}
|
Loading…
Reference in New Issue
Block a user