Compare commits
3 Commits
c18c0fcb76
...
ddabcbe8ac
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ddabcbe8ac | ||
![]() |
5ba323fa49 | ||
7d85f554f4 |
@ -3,13 +3,32 @@ import { patchFun, patchInit } from "../patch";
|
|||||||
class Path {
|
class Path {
|
||||||
|
|
||||||
async huodong2(a: any) {
|
async huodong2(a: any) {
|
||||||
|
const con ={
|
||||||
|
2002:[
|
||||||
|
{ payId: '', num: 1, prize: [{a: 'item', t: '50', n: 20}, {a: 'attr', t: 'rmbmoney', n: 200}], free: true },
|
||||||
|
{ payId: 'duihuan_1_1', prize: [{a: 'item', t: '50', n: 50}, {a: 'attr', t: 'rmbmoney', n: 600}], free: false },
|
||||||
|
{ payId: 'duihuan_1_2', prize: [{a: 'item', t: '50', n: 100}, {a: 'attr', t: 'rmbmoney', n: 1360}], free: false },
|
||||||
|
{ payId: 'duihuan_1_3', prize: [{a: 'item', t: '50', n: 200}, {a: 'attr', t: 'rmbmoney', n: 2560}], free: false },
|
||||||
|
{ payId: 'duihuan_1_4', prize: [{a: 'item', t: '50', n: 600}, {a: 'attr', t: 'rmbmoney', n: 6560}], free: false },
|
||||||
|
{ payId: 'duihuan_1_5', prize: [{a: 'item', t: '50', n: 1200}, {a: 'attr', t: 'rmbmoney', n: 12960}], free: false },
|
||||||
|
],
|
||||||
|
2003: [
|
||||||
|
{ payId: '', num: 1, prize: [{a: 'item', t: '50', n: 20}, {a: 'attr', t: 'rmbmoney', n: 200}], free: true },
|
||||||
|
{ payId: 'duihuan_1_1', prize: [{a: 'item', t: '50', n: 50}, {a: 'attr', t: 'rmbmoney', n: 600}], free: false },
|
||||||
|
{ payId: 'duihuan_1_2', prize: [{a: 'item', t: '50', n: 100}, {a: 'attr', t: 'rmbmoney', n: 1360}], free: false },
|
||||||
|
{ payId: 'duihuan_1_3', prize: [{a: 'item', t: '50', n: 200}, {a: 'attr', t: 'rmbmoney', n: 2560}], free: false },
|
||||||
|
{ payId: 'duihuan_1_4', prize: [{a: 'item', t: '50', n: 600}, {a: 'attr', t: 'rmbmoney', n: 6560}], free: false },
|
||||||
|
{ payId: 'duihuan_1_5', prize: [{a: 'item', t: '50', n: 1200}, {a: 'attr', t: 'rmbmoney', n: 12960}], free: false },
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
const hdids = [2002,2003]
|
const hdids = [2002,2003]
|
||||||
const hdinfos = await G.mongodb.find('hdinfo', { hdid: { $in: hdids } })
|
const hdinfos = await G.mongodb.find('hdinfo', { hdid: { $in: hdids } })
|
||||||
for (let i = 0; i < hdinfos.length; i++) {
|
for (let i = 0; i < hdinfos.length; i++) {
|
||||||
let hdinfo = hdinfos[i]
|
let hdinfo = hdinfos[i]
|
||||||
hdinfo.data.gift = {}
|
hdinfo.data.event.gift = con[hdinfo.hdid]
|
||||||
|
|
||||||
await G.mongodb.collection('hdinfo').updateOne({ "hdid": hdinfo.hdid}, { "$set": {"data.figt": {}} });
|
await G.mongodb.collection('hdinfo').updateOne({ "hdid": hdinfo.hdid}, { "$set": {"data.event.gift": hdinfo.data.event.gift}});
|
||||||
console.log(hdinfo.hdid,"finish")
|
console.log(hdinfo.hdid,"finish")
|
||||||
}
|
}
|
||||||
return "sucess!!!"
|
return "sucess!!!"
|
||||||
|
@ -4,6 +4,7 @@ import { MsgChat } from '../shared/protocols/msg_s2c/MsgChat';
|
|||||||
import { player } from '../shared/protocols/user/type';
|
import { player } from '../shared/protocols/user/type';
|
||||||
import { chatLog, chatMsgLog } from '../shared/protocols/type'
|
import { chatLog, chatMsgLog } from '../shared/protocols/type'
|
||||||
import { PublicShared } from '../shared/public/public';
|
import { PublicShared } from '../shared/public/public';
|
||||||
|
import { clusterRunOnce } from '../clusterUtils';
|
||||||
|
|
||||||
const msgListLen = {
|
const msgListLen = {
|
||||||
'cross': 30,
|
'cross': 30,
|
||||||
@ -28,13 +29,9 @@ export function getCrossChatGroupByOpenDay(){
|
|||||||
export class ChatFun {
|
export class ChatFun {
|
||||||
/**新增消息 */
|
/**新增消息 */
|
||||||
static async newMsg(sendData: MsgChat) {
|
static async newMsg(sendData: MsgChat) {
|
||||||
G.mongodb.collection('chat').updateOne(
|
let addToDB = 0;
|
||||||
{ type: `${sendData.type}${sendData.type == 'guild' ? (sendData.sender as player)?.ghId : ''}` },
|
|
||||||
{ $push: { list: { $each: [sendData], $slice: -msgListLen[sendData.type] } } },
|
|
||||||
{ upsert: true }
|
|
||||||
);
|
|
||||||
|
|
||||||
if (sendData.type == 'guild') {
|
if (sendData.type == 'guild') {
|
||||||
|
addToDB = 1;
|
||||||
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData,{ghId:(sendData.sender as player)?.ghId});
|
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData,{ghId:(sendData.sender as player)?.ghId});
|
||||||
}else if(sendData.type == 'cross'){
|
}else if(sendData.type == 'cross'){
|
||||||
//所有的子进程都会收到,不需要集群内分别广播
|
//所有的子进程都会收到,不需要集群内分别广播
|
||||||
@ -42,9 +39,27 @@ export class ChatFun {
|
|||||||
//如果时候同一个分组的
|
//如果时候同一个分组的
|
||||||
delete sendData?.otherData?.group;
|
delete sendData?.otherData?.group;
|
||||||
G.server.broadcastMsg('msg_s2c/Chat', sendData);
|
G.server.broadcastMsg('msg_s2c/Chat', sendData);
|
||||||
|
addToDB = 2;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData);
|
G.server.broadcastClusterMsg('msg_s2c/Chat', sendData);
|
||||||
|
addToDB = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(addToDB == 1){
|
||||||
|
G.mongodb.collection('chat').updateOne(
|
||||||
|
{ type: `${sendData.type}${sendData.type == 'guild' ? (sendData.sender as player)?.ghId : ''}` },
|
||||||
|
{ $push: { list: { $each: [sendData], $slice: -msgListLen[sendData.type] } } },
|
||||||
|
{ upsert: true }
|
||||||
|
);
|
||||||
|
}else if(addToDB == 2){
|
||||||
|
clusterRunOnce(()=>{
|
||||||
|
G.mongodb.collection('chat').updateOne(
|
||||||
|
{ type: `${sendData.type}${sendData.type == 'guild' ? (sendData.sender as player)?.ghId : ''}` },
|
||||||
|
{ $push: { list: { $each: [sendData], $slice: -msgListLen[sendData.type] } } },
|
||||||
|
{ upsert: true }
|
||||||
|
);
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user