模拟数据:每日推荐
This commit is contained in:
@@ -12,6 +12,7 @@ import { ThemeData } from "./ThemeData";
|
||||
import { WalletData } from "./WalletData";
|
||||
import { ShopData } from "./ShopData";
|
||||
import { OrderData } from "./OrderData";
|
||||
import { GirlData } from "./GirlData";
|
||||
|
||||
/**
|
||||
* 集中定义数据ID,避免写错字符串
|
||||
@@ -26,6 +27,7 @@ export enum DataId {
|
||||
Wallet = "wallet", // 钱包数据
|
||||
Shop = "shop", // 商城数据
|
||||
Order = "order", // 订单数据
|
||||
Girl = "girl", // 技师数据
|
||||
}
|
||||
|
||||
/** 构造器类型 */
|
||||
@@ -67,6 +69,7 @@ export class DataManager {
|
||||
this.register(DataId.Wallet, WalletData);
|
||||
this.register(DataId.Shop, ShopData);
|
||||
this.register(DataId.Order, OrderData);
|
||||
this.register(DataId.Girl, GirlData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -309,6 +309,7 @@ export class GirlData extends BaseData {
|
||||
public setDailyRecommend(res: proto.cs.ICSDailyRecommendRes): void {
|
||||
this.mergeBriefs(DAILY_BUCKET, res.girls);
|
||||
this._dailyRecommendIds = res.girls.map(g => g.id ?? 0);
|
||||
console.log("保存每日推荐: ", this._dailyRecommendIds);
|
||||
}
|
||||
|
||||
/** 获取每日推荐的简要信息 */
|
||||
@@ -319,10 +320,24 @@ export class GirlData extends BaseData {
|
||||
return b.briefs.get(b.girlIds[index]) ?? null;
|
||||
}
|
||||
|
||||
/** 获取 id */
|
||||
public getRecommendGrilId(index: number): number {
|
||||
let oneData = this.getRecommendGrilBrief(DAILY_BUCKET, index);
|
||||
if (!oneData) return 0;
|
||||
return oneData.id;
|
||||
}
|
||||
|
||||
/** 获取名字 */
|
||||
public getRecommendGrilName(index: number): string {
|
||||
let oneData = this.getRecommendGrilBrief(DAILY_BUCKET, index);
|
||||
if (!oneData) return "";
|
||||
return oneData.name;
|
||||
}
|
||||
|
||||
/** 获取头像 */
|
||||
public getRecommendGrilAvatar(index: number): string {
|
||||
let oneData = this.getRecommendGrilBrief(DAILY_BUCKET, index);
|
||||
if (!oneData) return "";
|
||||
return oneData.avatar;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user