协议调试

This commit is contained in:
chen wei bo
2025-09-09 18:16:37 +08:00
parent f9f2077665
commit e89d515bde
10 changed files with 468 additions and 32 deletions
+24 -9
View File
@@ -53,45 +53,60 @@ export class ShopData extends BaseData {
/** 获取所有商品 id */
public get goodIds(): number[] { return this._goodIds; }
/** 是否是充值商品,首位数字为 1 */
public isRechargeId(id: number): boolean {
const firstDigit = id.toString()[0]; // 取首位字符
return firstDigit === "1";
}
/** 获取 充值商品的id数组,首位数字为 1 */
private getRechargeIds(): number[] {
public getRechargeIds(): number[] {
let allId = this._goodIds;
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0]; // 取首位字符
if (firstDigit === "1") {
if (this.isRechargeId(one)) {
resultId.push(one);
}
}
return resultId;
}
/** 是否是会员商品,首位数字为 2 */
public isMemberId(id: number): boolean {
const firstDigit = id.toString()[0]; // 取首位字符
return firstDigit === "2";
}
/** 获取 会员商品的id数组,首位数字为 2 */
private getMemberIds(): number[] {
public getMemberIds(): number[] {
let allId = this._goodIds;
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0]; // 取首位字符
if (firstDigit === "2") {
if (this.isMemberId(one)) {
resultId.push(one);
}
}
return resultId;
}
/** 是否是聊天商品,首位数字为 3 */
public isChatId(id: number): boolean {
const firstDigit = id.toString()[0]; // 取首位字符
return firstDigit === "3";
}
/** 获取 聊天商品的id数组,首位数字为 3 */
private getChatIds(): number[] {
public getChatIds(): number[] {
let allId = this._goodIds;
if (!allId) return [];
// 获取所有 id
let resultId = [];
for (let one of allId) {
const firstDigit = one.toString()[0]; // 取首位字符
if (firstDigit === "3") {
if (this.isChatId(one)) {
resultId.push(one);
}
}