聊天:赠送礼物后的聊天消息
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { Application, BackendSession, ChannelService } from "pinus";
|
||||
import { resResult, getRandEelm, getResStr, shouldRefresh, getRefTime, sortArrRandom } from "../../../pubUtils/util";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, EQUIP_SELECT, REDIS_KEY } from "../../../consts";
|
||||
import { STATUS, ROLE_SELECT, FRIEND_DROP_TYPE, FRIEND_RELATION_TYPE, POPULATE_TYPE, BLOCK_OPEATE, CONSUME_TYPE, ITID, HERO_SELECT, EQUIP_SELECT, REDIS_KEY, MSG_SOURCE, MSG_TYPE } from "../../../consts";
|
||||
import { RoleModel, RoleType } from "../../../db/Role";
|
||||
import { getBeforeHourSeconds } from "../../../pubUtils/timeUtil";
|
||||
import { FriendApplyModel } from "../../../db/FriendApply";
|
||||
@@ -21,6 +21,7 @@ import { getPlayerMainAttribute } from "../../../services/pvpService";
|
||||
import { FRIEND } from "../../../pubUtils/dicParam";
|
||||
import { PlayerDetail, PlayerDetailHero } from "../../../domain/battleField/guild";
|
||||
import { PvpDefenseModel } from "../../../db/PvpDefense";
|
||||
import { createPrivateMsg, pushMsgToRole } from "../../../services/chatService";
|
||||
|
||||
|
||||
export default function (app: Application) {
|
||||
@@ -600,6 +601,7 @@ export class FriendHandler {
|
||||
// 赠送礼物
|
||||
public async sendPresent(msg: { roleId: string, items: RewardInter[] }, session: BackendSession) {
|
||||
let roleId: string = session.get('roleId');
|
||||
let roleName: string = session.get('roleName');
|
||||
let sid: string = session.get('sid');
|
||||
|
||||
let { roleId: hisRoleId, items } = msg;
|
||||
@@ -631,6 +633,10 @@ export class FriendHandler {
|
||||
|
||||
// TODO 日志可以转到log服
|
||||
await FriendPresentLogModel.createRecord(roleId, hisRoleId, items);
|
||||
for(let {id, count} of items ) {
|
||||
const msgData = await createPrivateMsg(roleId, roleName, MSG_TYPE.RICH_TEXT, MSG_SOURCE.ROLE_SEND_TEXT, JSON.stringify({ id, count }), hisRoleId, null);
|
||||
await pushMsgToRole(msgData);
|
||||
}
|
||||
|
||||
return resResult(STATUS.SUCCESS, {
|
||||
roleId: hisRoleId,
|
||||
|
||||
Reference in New Issue
Block a user