修改:协议和配置表

This commit is contained in:
chen wei bo
2025-09-08 15:11:11 +08:00
parent 5821bc17ae
commit 826e52d019
47 changed files with 12826 additions and 4127 deletions
@@ -25,6 +25,20 @@ export class AiCharacterConfig extends BaseConfig {
return ConfigManager.tables.TbAiCharacters;
}
/**
* 获取所有配置 id,如果存在
*/
public getAllId(): any | null {
let allData = this.getAllConfig();
if (!allData) return null;
const dataArr = allData.getDataList();
let allId = [];
for (let oneData of dataArr) {
allId.push(oneData.id);
}
return allId;
}
/**
* 获取配置,根据 id
*/
@@ -82,6 +82,20 @@ export class GirlConfig extends BaseConfig {
if (!oneData) return null;
return oneData.priceType;
}
/** 根据 id 获取购买价格 */
public getPriceById(id: number): number | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.price;
}
/** 根据 id 获取VIP能否解锁 */
public getVipUnlockById(id: number): number | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.vipUnlock;
}
/** 根据 id 获取头像路径 */
public getAvatarPathById(id: number): string | null {
@@ -53,30 +53,59 @@ export class GirlDetailConfig extends BaseConfig {
let oneData = this.getCommercialImagesById(id);
if (!oneData) return null;
return oneData.length;
}
/** 根据 id 和 index 获取图片类型 */
public getImageTypeById(id: number, index: number): number | null {
}
/** 根据 id 获取 commercialImages的id数组 */
public getCommercialImagesIds(id: number): number[] {
let oneData = this.getCommercialImagesById(id);
if (!oneData) return [];
// 获取所有 id
let allId = [];
for (let one of oneData) {
allId.push(one.id);
}
return allId;
}
/** 根据 id 获取 某一个commercialImage */
private getOneCommercialImageById(id: number, resId: number): any | null {
let oneData = this.getCommercialImagesById(id);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].imageType;
// 遍历数组找到匹配的资源
for (let one of oneData) {
if (one.id === resId) {
return one;
}
}
return null;
}
/** 根据 id 获取图片类型 */
public getImageTypeById(id: number, resId: number): number | null {
let oneData = this.getOneCommercialImageById(id, resId);
if (!oneData) return null;
return oneData.imageType;
}
/** 根据 id 和 index 获取图片价格 */
public getImagePriceById(id: number, index: number): number | null {
let oneData = this.getCommercialImagesById(id);
/** 根据 id 获取聊天触发次数 */
public getImageUnlockCountsById(id: number, resId: number): number | null {
let oneData = this.getOneCommercialImageById(id, resId);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].imagePrice;
return oneData.unlockCounts;
}
/** 根据 id 获取图片价格 */
public getImagePriceById(id: number, resId: number): number | null {
let oneData = this.getOneCommercialImageById(id, resId);
if (!oneData) return null;
return oneData.imagePrice;
}
/** 根据 id 和 index 获取图片路径 */
public getImagePathById(id: number, index: number): string | null {
let oneData = this.getCommercialImagesById(id);
/** 根据 id 获取图片路径 */
public getImagePathById(id: number, resId: number): string | null {
let oneData = this.getOneCommercialImageById(id, resId);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].path;
return oneData.path;
}
/** 根据 id 获取 commercialVideos */
@@ -93,27 +122,49 @@ export class GirlDetailConfig extends BaseConfig {
return oneData.length;
}
/** 根据 id 和 index 获取视频路径 */
public getVideoPathById(id: number, index: number): string | null {
/** 根据 id 获取 commercialVideo的id数组 */
public getCommercialVideosIds(id: number): number[] {
let oneData = this.getCommercialVideosById(id);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].path;
if (!oneData) return [];
// 获取所有 id
let allId = [];
for (let one of oneData) {
allId.push(one.id);
}
return allId;
}
/** 根据 id 和 index 获取关联情绪 */
public getVideoEmotionById(id: number, index: number): number | null {
/** 根据 id 获取 某一个commercialVideo */
private getOneCommercialVideoById(id: number, resId: number): any | null {
let oneData = this.getCommercialVideosById(id);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].emotion;
// 遍历数组找到匹配的资源
for (let one of oneData) {
if (one.id === resId) {
return one;
}
}
return null;
}
/** 根据 id 获取视频路径 */
public getVideoPathById(id: number, resId: number): string | null {
let oneData = this.getOneCommercialVideoById(id, resId);
if (!oneData) return null;
return oneData.path;
}
/** 根据 id 和 index 获取视频价格 */
public getVideoPriceById(id: number, index: number): number | null {
let oneData = this.getCommercialVideosById(id);
/** 根据 id 获取关联情绪 */
public getVideoEmotionById(id: number, resId: number): number | null {
let oneData = this.getOneCommercialVideoById(id, resId);
if (!oneData) return null;
if (index < 0 || index >= oneData.length) return null;
return oneData[index].videoPrice;
return oneData.emotion;
}
/** 根据 id 获取视频价格 */
public getVideoPriceById(id: number, resId: number): number | null {
let oneData = this.getOneCommercialVideoById(id, resId);
if (!oneData) return null;
return oneData.videoPrice;
}
}
@@ -74,6 +74,20 @@ export class GlobalConfig extends BaseConfig {
return oneData.FreeChatTimes;
}
/** 单次对话增长好感度 */
public getOnceChatAddScore(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.OnceChatAddScore;
}
/** 好感度等级兑换比例 */
public getScoreExchangeStarLevel(): number | null {
let oneData = this.getAllConfig();
if (!oneData) return null;
return oneData.ScoreExchangeStarLevel;
}
/** 游戏名 */
public getGameName(): string | null {
let oneData = this.getAllConfig();
@@ -25,6 +25,65 @@ export class PurchaseConfig extends BaseConfig {
return ConfigManager.tables.TbPurchaseConfig;
}
/**
* 获取所有配置 id,如果存在
*/
public getAllId(): any | null {
let allData = this.getAllConfig();
if (!allData) return null;
const dataArr = allData.getDataList();
let allId = [];
for (let oneData of dataArr) {
allId.push(oneData.id);
}
return allId;
}
/** 获取 充值商品的id数组,首位数字为 1 */
public getRechargeIds(): number[] {
let allId = this.getAllId();
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0]; // 取首位字符
if (firstDigit === "1") {
resultId.push(one);
}
}
return resultId;
}
/** 获取 会员商品的id数组,首位数字为 2 */
public getMemberIds(): number[] {
let allId = this.getAllId();
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0];
if (firstDigit === "2") {
resultId.push(one);
}
}
return resultId;
}
/** 获取 聊天商品的id数组,首位数字为 3 */
public getChatIds(): number[] {
let allId = this.getAllId();
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0];
if (firstDigit === "3") {
resultId.push(one);
}
}
return resultId;
}
/**
* 获取配置,根据 id
*/
@@ -47,4 +106,11 @@ export class PurchaseConfig extends BaseConfig {
if (!oneData) return null;
return oneData.count;
}
/** 根据商品 id 获取商品价格 */
public getPriceById(id: number): number | null {
let oneData = this.getConfigById(id);
if (!oneData) return null;
return oneData.price;
}
}