Merge branch 'main' of 47.107.44.202:xionglijia/18xchat
This commit is contained in:
@@ -27,8 +27,9 @@ export enum InnerMsgCode {
|
|||||||
Chat_EmotionUpdated,
|
Chat_EmotionUpdated,
|
||||||
SimplePlayVide,
|
SimplePlayVide,
|
||||||
LanguageChange,
|
LanguageChange,
|
||||||
BalanceChange, // 余额发生变化
|
BalanceChange, // 余额发生变化
|
||||||
VipExpireChange, // vip失效时间戳发生变化
|
VipExpireChange, // vip失效时间戳发生变化
|
||||||
|
ChatTotalCountChange, // 总聊天次数发生变化
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum InnerEventCode {
|
export enum InnerEventCode {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
import { BaseData } from "./BaseData";
|
import { BaseData } from "./BaseData";
|
||||||
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||||
|
import Utils from "../../Main/Common/Utils";
|
||||||
|
import { InnerMsgCode } from "../../Main/Config/InnerMsgCode";
|
||||||
|
|
||||||
export class GirlChatData extends BaseData {
|
export class GirlChatData extends BaseData {
|
||||||
// id
|
// id
|
||||||
@@ -67,6 +69,12 @@ export class GirlChatData extends BaseData {
|
|||||||
/** 保存总聊天次数 */
|
/** 保存总聊天次数 */
|
||||||
public setChatTotalCount(value: number): void {
|
public setChatTotalCount(value: number): void {
|
||||||
this.chatTotalCount = value;
|
this.chatTotalCount = value;
|
||||||
|
// 发出事件
|
||||||
|
let msgData = {
|
||||||
|
girlId: this.id,
|
||||||
|
chatTotalCount: this.chatTotalCount,
|
||||||
|
};
|
||||||
|
Utils.sendInnerMsg(InnerMsgCode.ChatTotalCountChange, msgData);
|
||||||
console.log("当前技师 ", this.id, " ,总聊天次数:", this.chatTotalCount);
|
console.log("当前技师 ", this.id, " ,总聊天次数:", this.chatTotalCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -386,6 +386,22 @@ export class GirlData extends BaseData {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取 在聊天中,触发技师图片的id */
|
||||||
|
public getTriggerGrilPhotoId(categoryId: string, girlId: number): number {
|
||||||
|
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||||
|
if (!oneData) return 0;
|
||||||
|
// 所有图片 id,展示类型属于在聊天中触发
|
||||||
|
let allId = oneData.getAllTriggerGrilPhotoId();
|
||||||
|
// 总聊天次数
|
||||||
|
let chatTotalCount = this.getChatTotalCount(categoryId, girlId);
|
||||||
|
// 遍历
|
||||||
|
for (let id of allId) {
|
||||||
|
let count = this.getGrilPhotoUnlockCounts(categoryId, girlId, id);
|
||||||
|
if (chatTotalCount >= count) return id;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取第一个技师图片的资源路径 */
|
/** 获取第一个技师图片的资源路径 */
|
||||||
public getFirstGrilPhotoPath(categoryId: string, girlId: number): string {
|
public getFirstGrilPhotoPath(categoryId: string, girlId: number): string {
|
||||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||||
|
|||||||
@@ -107,7 +107,21 @@ export class GirlDetailData extends BaseData {
|
|||||||
}
|
}
|
||||||
return allId;
|
return allId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取所有技师图片数据的id,展示类型属于在聊天中触发 */
|
||||||
|
public getAllTriggerGrilPhotoId(): number[] {
|
||||||
|
if (!this.photoData) return [];
|
||||||
|
|
||||||
|
// 筛选出类型为 2 的图片
|
||||||
|
let triggerPhotos = this.photoData.filter(photo => photo.imageType === 2);
|
||||||
|
|
||||||
|
// 按 unlockCounts 从大到小排序
|
||||||
|
triggerPhotos.sort((a, b) => b.unlockCounts - a.unlockCounts);
|
||||||
|
|
||||||
|
// 返回排序后的 id 数组
|
||||||
|
return triggerPhotos.map(photo => photo.id);
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取技师图片数据,通过 id */
|
/** 获取技师图片数据,通过 id */
|
||||||
private getGrilPhotoData(id: number): proto.cs.IPurchaseCommercialImage | null {
|
private getGrilPhotoData(id: number): proto.cs.IPurchaseCommercialImage | null {
|
||||||
if (!this.photoData) return null;
|
if (!this.photoData) return null;
|
||||||
|
|||||||
+1
-1
Submodule proto_cs updated: f055100cf0...02474af62a
Reference in New Issue
Block a user