协议增加,收藏角色,收藏列表

This commit is contained in:
chen wei bo
2025-10-09 16:47:11 +08:00
parent 953e90ce2a
commit 9cebe44716
2 changed files with 44 additions and 3 deletions
+26 -2
View File
@@ -103,7 +103,6 @@ export class GirlData extends BaseData {
this.setGirlUnlock(categoryId, data.girls); this.setGirlUnlock(categoryId, data.girls);
this.setGirlFavorability(categoryId, data.girls); this.setGirlFavorability(categoryId, data.girls);
this.setGirlOther(categoryId, data.girls); this.setGirlOther(categoryId, data.girls);
const bucket = this.ensureBucket(categoryId); const bucket = this.ensureBucket(categoryId);
logger.log("保存类别 ", categoryId, " 的技师列表: ", bucket); logger.log("保存类别 ", categoryId, " 的技师列表: ", bucket);
} }
@@ -119,7 +118,6 @@ export class GirlData extends BaseData {
this.setGirlChat(categoryId, details); this.setGirlChat(categoryId, details);
this.setGirlFavorability(categoryId, details); this.setGirlFavorability(categoryId, details);
this.setGirlOther(categoryId, details); this.setGirlOther(categoryId, details);
const bucket = this.ensureBucket(categoryId); const bucket = this.ensureBucket(categoryId);
logger.log("保存类别 ", categoryId, " 的详细数据: ", bucket); logger.log("保存类别 ", categoryId, " 的详细数据: ", bucket);
} }
@@ -141,6 +139,25 @@ export class GirlData extends BaseData {
logger.log("保存可聊天的技师数据: ", cats); logger.log("保存可聊天的技师数据: ", cats);
} }
/** 保存收藏列表 */
public setBookmarkGirlList(data: proto.cs.ICSGetBookmarkRes): void {
if (!data) return;
let arrayData = data.girls;
// 遍历
for (const oneData of arrayData) {
let briefData = oneData.girl;
let categoryId = briefData.category;
this.mergeOneBrief(categoryId.toString(), briefData);
let theArray = [];
theArray.push(oneData);
this.setGirlUnlock(categoryId.toString(), theArray);
this.setGirlFavorability(categoryId.toString(), theArray);
this.setGirlOther(categoryId.toString(), theArray);
}
const cats = this.ensureCategories();
logger.log("保存收藏列表后,大分类的数据: ", cats);
}
/** --------------------------------------------------------- 每日推荐 --------------------------------------------------------- */ /** --------------------------------------------------------- 每日推荐 --------------------------------------------------------- */
/** 保存每日推荐:放入特殊分类 DAILY_BUCKET,并维护 id 索引 */ /** 保存每日推荐:放入特殊分类 DAILY_BUCKET,并维护 id 索引 */
@@ -1345,6 +1362,13 @@ export class GirlData extends BaseData {
return oneData.getBookmarkTime(); return oneData.getBookmarkTime();
} }
/** 保存 收藏时间,时间戳,秒 */
public setBookmarkTime(categoryId: string, girlId: number, value: number): void {
let oneData = this.getGirlFavorability(categoryId, girlId);
if (!oneData) return;
oneData.setBookmarkTime(value);
}
/** 是否已经收藏 */ /** 是否已经收藏 */
public isBookmarkGirl(categoryId: string, girlId: number): boolean { public isBookmarkGirl(categoryId: string, girlId: number): boolean {
let oneData = this.getGirlFavorability(categoryId, girlId); let oneData = this.getGirlFavorability(categoryId, girlId);
@@ -17,6 +17,7 @@ import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData"; import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData"; import { EnvData } from "../data/EnvData";
import { NavigationManager } from "../manager/NavigationManager"; import { NavigationManager } from "../manager/NavigationManager";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@@ -68,6 +69,8 @@ export class DetailImageItem extends Component {
if (this.url) { if (this.url) {
NavigationManager.Instance.openPopupPanel("ShowPanel", data); NavigationManager.Instance.openPopupPanel("ShowPanel", data);
this.base.setVideEnable(false); this.base.setVideEnable(false);
// 查看图片或者视频上报,用于排行榜
this.reqViewGirl(this.girlId);
} }
} else { } else {
NavigationManager.Instance.openPopupPanel("PopupGirlDetailPanel", { NavigationManager.Instance.openPopupPanel("PopupGirlDetailPanel", {
@@ -96,6 +99,20 @@ export class DetailImageItem extends Component {
// } // }
} }
/**
* 查看图片或者视频上报,用于排行榜
* @param girlId 角色Id
*/
private async reqViewGirl(girlId: number) {
const reqData = {
girlId
};
let res = await GirlService.I.reqViewGirl(reqData);
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
const resData = res.data;
}
}
scaleToFillItem() { scaleToFillItem() {
if (!this.img || !this.img.spriteFrame) return; if (!this.img || !this.img.spriteFrame) return;