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

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
+27 -3
View File
@@ -103,7 +103,6 @@ export class GirlData extends BaseData {
this.setGirlUnlock(categoryId, data.girls);
this.setGirlFavorability(categoryId, data.girls);
this.setGirlOther(categoryId, data.girls);
const bucket = this.ensureBucket(categoryId);
logger.log("保存类别 ", categoryId, " 的技师列表: ", bucket);
}
@@ -119,7 +118,6 @@ export class GirlData extends BaseData {
this.setGirlChat(categoryId, details);
this.setGirlFavorability(categoryId, details);
this.setGirlOther(categoryId, details);
const bucket = this.ensureBucket(categoryId);
logger.log("保存类别 ", categoryId, " 的详细数据: ", bucket);
}
@@ -141,6 +139,25 @@ export class GirlData extends BaseData {
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 索引 */
@@ -1345,12 +1362,19 @@ export class GirlData extends BaseData {
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 {
let oneData = this.getGirlFavorability(categoryId, girlId);
if (!oneData) return false;
return oneData.isBookmarkGirl();
}
}
/** 获取所有已经收藏技师的 id */
public getAllBookmarkGirlIds(): number[] {
@@ -17,6 +17,7 @@ import { DataManager, DataId } from "../data/DataManager";
import { GirlData } from "../data/GirlData";
import { EnvData } from "../data/EnvData";
import { NavigationManager } from "../manager/NavigationManager";
import { GirlService } from "db://assets/Scripts/chat18x/network/services/GirlService";
const { ccclass, property } = _decorator;
@@ -68,6 +69,8 @@ export class DetailImageItem extends Component {
if (this.url) {
NavigationManager.Instance.openPopupPanel("ShowPanel", data);
this.base.setVideEnable(false);
// 查看图片或者视频上报,用于排行榜
this.reqViewGirl(this.girlId);
}
} else {
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() {
if (!this.img || !this.img.spriteFrame) return;