获取可聊天的技师数据

This commit is contained in:
chen wei bo
2025-09-22 17:54:45 +08:00
parent 26019a0080
commit d56c2518f5
10 changed files with 1507 additions and 53 deletions
+28 -1
View File
@@ -97,6 +97,21 @@ export class GirlChatData extends BaseData {
}
}
/** 是否可聊天 */
public isCanChat(): boolean {
// 剩余聊天次数
let remainCount = this.chatRemainCount;
if (remainCount < 0) {
// 会员
return true;
} else if (remainCount === 0) {
return false;
} else {
return true;
}
return false;
}
// 解析聊天记录数据,一个
private parseOneChatRecord(data: proto.cs.IChatMsg): proto.cs.IChatMsg | null {
if (!data) return null;
@@ -143,7 +158,6 @@ export class GirlChatData extends BaseData {
// 排序:根据 msgId 从大到小排序
this.chatRecordIds.sort((a, b) => b - a);
logger.log("当前技师 ", this.id, " ,聊天记录:", this.chatRecord);
}
@@ -152,6 +166,19 @@ export class GirlChatData extends BaseData {
return this.chatRecordIds;
}
/** 获取最新的聊天记录的id */
public getLatestChatRecordId(): number | null {
if (this.chatRecordIds.length === 0) return null;
return this.chatRecordIds[0];
}
/** 获取最新的聊天记录的时间戳(毫秒) */
public getLatestChatRecordTimestamp(): number | null {
if (this.chatRecordIds.length === 0) return null;
// 最新一条的 msgId 本身就是时间戳(毫秒)
return this.chatRecordIds[0];
}
/** 获取聊天记录,根据 id */
private getChatRecordById(id: number): proto.cs.IChatMsg | null {
return this.chatRecord.get(id.toString()) ?? null;
+185 -49
View File
@@ -112,6 +112,23 @@ export class GirlData extends BaseData {
logger.log("保存类别 ", categoryId, " 的详细数据: ", bucket);
}
/** 保存可聊天的技师数据 */
public setCanChatGirlData(data: proto.cs.ICSGetLastChatListRes): void {
if (!data) return;
let canChatList = data.LastChatList;
// 遍历
for (const oneData of canChatList) {
let briefData = oneData.girl;
let categoryId = briefData.category;
this.mergeOneBrief(categoryId.toString(), briefData);
this.refreshGirlUnlock(oneData);
this.refreshGirlFavorability(oneData);
this.refreshGirlChat(oneData);
}
const cats = this.ensureCategories();
logger.log("保存可聊天的技师数据: ", cats);
}
/** --------------------------------------------------------- 技师的简要数据 --------------------------------------------------------- */
/**
@@ -649,30 +666,41 @@ export class GirlData extends BaseData {
/** --------------------------------------------------------- 技师的解锁数据 --------------------------------------------------------- */
// 解析技师解锁数据,一个
private parseOneGirlUnlock(data: proto.cs.IGirlData): GirlUnlockData | null {
if (!data) return null;
// 创建一个技师解锁数据
private createOneGirlUnlock(id: number, isRelease: boolean, unlockTime: number, unlockedImageIds: number[], unlockedVideoIds: number[]): GirlUnlockData {
let oneData = new GirlUnlockData();
oneData.init?.(DataId.GirlUnlock);
oneData.setId(data.id);
oneData.setIsRelease(data.isRelease);
if (data.images) {
let ids = [];
for (let one of data.images) {
ids.push(one.resId);
}
oneData.setUnlockedImageIds(ids);
oneData.setId(id);
oneData.setIsRelease(isRelease);
oneData.setUnlockTime(unlockTime);
if (unlockedImageIds) {
oneData.setUnlockedImageIds(unlockedImageIds);
}
if (data.videos) {
let ids = [];
for (let one of data.videos) {
ids.push(one.resId);
}
oneData.setUnlockedVideoIds(ids);
if (unlockedVideoIds) {
oneData.setUnlockedVideoIds(unlockedVideoIds);
}
return oneData;
}
// 解析技师解锁数据,一个
private parseOneGirlUnlock(data: proto.cs.IGirlData): GirlUnlockData | null {
if (!data) return null;
let unlockedImageIds = [];
if (data.images) {
for (let one of data.images) {
unlockedImageIds.push(one.resId);
}
}
let unlockedVideoIds = [];
if (data.videos) {
for (let one of data.videos) {
unlockedVideoIds.push(one.resId);
}
}
let oneData = this.createOneGirlUnlock(data.id, data.isRelease, Number(data.unlockTime), unlockedImageIds, unlockedVideoIds);
return oneData;
}
/** 保存技师的解锁数据 */
private setGirlUnlock(categoryId: string, data: proto.cs.IGirlData[]): void {
if (!data) return;
@@ -684,6 +712,27 @@ export class GirlData extends BaseData {
}
}
/** 刷新技师的解锁数据 */
private refreshGirlUnlock(data: proto.cs.ILastChatData): void {
if (!data) return;
let briefData = data.girl;
let categoryId = briefData.category;
let girlId = briefData.id;
let unlockData = this.getGrilUnlock(categoryId.toString(), girlId);
if (unlockData) {
// 已存在数据,刷新
unlockData.setIsRelease(data.isRelease);
unlockData.setUnlockTime(Number(data.unlockTime));
} else {
// 不存在数据,创建
const bucket = this.ensureBucket(categoryId.toString());
let oneData = this.createOneGirlUnlock(data.id, data.isRelease, Number(data.unlockTime), [], []);
if (oneData) {
bucket.unlocks.set(data.id, oneData);
}
}
}
/** 取某分类 + girlId 的解锁数据 */
private getGrilUnlock(
categoryId: string,
@@ -719,6 +768,20 @@ export class GirlData extends BaseData {
oneData.setIsRelease(value);
}
/** 获取 角色解锁时间,时间戳,秒 */
public getUnlockTime(categoryId: string, girlId: number): number {
let oneData = this.getGrilUnlock(categoryId, girlId);
if (!oneData) return 0;
return oneData.getUnlockTime();
}
/** 保存 角色解锁时间,时间戳,秒 */
public setUnlockTime(categoryId: string, girlId: number, value: number): void {
let oneData = this.getGrilUnlock(categoryId, girlId);
if (!oneData) return;
oneData.setUnlockTime(value);
}
/** 判断图片是否解锁 */
public isImageUnlock(
categoryId: string,
@@ -787,14 +850,20 @@ export class GirlData extends BaseData {
/** --------------------------------------------------------- 技师的聊天数据 --------------------------------------------------------- */
// 创建一个技师聊天数据
private createOneGirlChat(id: number, chatTotalCount: number, chatRemainCount: number): GirlChatData {
let oneData = new GirlChatData();
oneData.init?.(DataId.GirlChat);
oneData.setId(id);
oneData.setChatTotalCount(chatTotalCount);
oneData.setChatRemainCount(chatRemainCount);
return oneData;
}
// 解析技师聊天数据,一个
private parseOneGirlChat(data: proto.cs.IGirlData): GirlChatData | null {
if (!data) return null;
let oneData = new GirlChatData();
oneData.init?.(DataId.GirlChat);
oneData.setId(data.id);
oneData.setChatTotalCount(data.chatTotalCount);
oneData.setChatRemainCount(data.chatRemainCount);
let oneData = this.createOneGirlChat(data.id, data.chatTotalCount, data.chatRemainCount);
return oneData;
}
@@ -809,6 +878,29 @@ export class GirlData extends BaseData {
}
}
/** 刷新技师的聊天数据 */
private refreshGirlChat(data: proto.cs.ILastChatData): void {
if (!data) return;
let briefData = data.girl;
let categoryId = briefData.category;
let girlId = briefData.id;
let chatData = this.getGrilChat(categoryId.toString(), girlId);
if (chatData) {
// 已存在数据,刷新
chatData.setChatTotalCount(data.chatTotalCount);
chatData.setChatRemainCount(data.chatRemainCount);
chatData.setChatRecord(data.msgs);
} else {
// 不存在数据,创建
const bucket = this.ensureBucket(categoryId.toString());
let oneData = this.createOneGirlChat(data.id, data.chatTotalCount, data.chatRemainCount);
if (oneData) {
oneData.setChatRecord(data.msgs);
bucket.chats.set(data.id, oneData);
}
}
}
/** 取某分类 + girlId 的聊天数据 */
private getGrilChat(categoryId: string, girlId: number): GirlChatData | null {
const b = this.ensureCategories().get(categoryId);
@@ -868,17 +960,9 @@ export class GirlData extends BaseData {
/** 是否可聊天 */
public isCanChat(categoryId: string, girlId: number): boolean {
// 剩余聊天次数
let remainCount = this.getChatRemainCount(categoryId, girlId);
if (remainCount < 0) {
// 会员
return true;
} else if (remainCount === 0) {
return false;
} else {
return true;
}
return false;
let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return false;
return oneData.isCanChat();
}
/** 保存聊天记录 */
@@ -895,6 +979,20 @@ export class GirlData extends BaseData {
return oneData.getChatRecordIds();
}
/** 获取最新的聊天记录的id */
public getLatestChatRecordId(categoryId: string, girlId: number): number | null {
let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return null;
return oneData.getLatestChatRecordId();
}
/** 获取最新的聊天记录的时间戳(毫秒) */
public getLatestChatRecordTimestamp(categoryId: string, girlId: number): number | null {
let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return null;
return oneData.getLatestChatRecordTimestamp();
}
/** 获取聊天记录,根据 id,是否是 ai 聊天数据 */
public getChatRecordIsAi(categoryId: string, girlId: number, id: number): boolean {
let oneData = this.getGrilChat(categoryId, girlId);
@@ -907,27 +1005,48 @@ export class GirlData extends BaseData {
let oneData = this.getGrilChat(categoryId, girlId);
if (!oneData) return "";
return oneData.getChatRecordMsg(id);
}
}
/** 获取所有可聊天的技师 id */
public getAllCanChatGirlIds(): number[] {
const result: number[] = [];
const cats = this.ensureCategories();
for (const [categoryId, bucket] of cats.entries()) {
for (const girlId of bucket.girlIds) {
if (this.getIsRelease(categoryId, girlId)) {
result.push(girlId);
}
}
}
// 返回结果
return result;
}
/** --------------------------------------------------------- 技师的好感度数据 --------------------------------------------------------- */
// 解析技师好感度数据,一个
private parseOneGirlFavorability(
data: proto.cs.IGirlData
): GirlFavorabilityData | null {
if (!data) return null;
// 创建一个技师好感度数据
private createOneGirlFavorability(id: number, star: number): GirlFavorabilityData {
let oneData = new GirlFavorabilityData();
oneData.init?.(DataId.GirlFavorability);
oneData.setId(data.id);
oneData.setStar(data.star);
oneData.setId(id);
oneData.setStar(star);
return oneData;
}
// 解析技师好感度数据,一个
private parseOneGirlFavorability(data: proto.cs.IGirlData): GirlFavorabilityData | null {
if (!data) return null;
let oneData = this.createOneGirlFavorability(data.id, data.star);
return oneData;
}
/** 保存技师的好感度数据 */
private setGirlFavorability(
categoryId: string,
data: proto.cs.IGirlData[]
): void {
private setGirlFavorability(categoryId: string,data: proto.cs.IGirlData[]): void {
if (!data) return;
const bucket = this.ensureBucket(categoryId);
for (const g of data) {
@@ -937,11 +1056,28 @@ export class GirlData extends BaseData {
}
}
/** 刷新技师的好感度数据 */
private refreshGirlFavorability(data: proto.cs.ILastChatData): void {
if (!data) return;
let briefData = data.girl;
let categoryId = briefData.category;
let girlId = briefData.id;
let favData = this.getGrilFavorability(categoryId.toString(), girlId);
if (favData) {
// 已存在数据,刷新
favData.setStar(data.star);
} else {
// 不存在数据,创建
const bucket = this.ensureBucket(categoryId.toString());
let oneData = this.createOneGirlFavorability(data.id, data.star);
if (oneData) {
bucket.favorability.set(data.id, oneData);
}
}
}
/** 取某分类 + girlId 的好感度数据 */
private getGrilFavorability(
categoryId: string,
girlId: number
): GirlFavorabilityData | null {
private getGrilFavorability(categoryId: string,girlId: number): GirlFavorabilityData | null {
const b = this.ensureCategories().get(categoryId);
if (!b) return null;
return b.favorability.get(girlId) ?? null;
+18 -1
View File
@@ -9,7 +9,9 @@ export class GirlUnlockData extends BaseData {
// id
private id: number;
// 付费技师是否已经解锁
private isRelease: boolean;
private isRelease: boolean;
// 角色解锁时间,时间戳,秒
private unlockTime: number;
// 解锁图片 id
private unlockedImageIds: number[];
// 解锁视频 id
@@ -19,6 +21,7 @@ export class GirlUnlockData extends BaseData {
super();
this.id = 0;
this.isRelease = false;
this.unlockTime = 0;
this.unlockedImageIds = [];
this.unlockedVideoIds = [];
}
@@ -26,6 +29,7 @@ export class GirlUnlockData extends BaseData {
public reset(): void {
this.id = 0;
this.isRelease = false;
this.unlockTime = 0;
this.unlockedImageIds = [];
this.unlockedVideoIds = [];
}
@@ -33,6 +37,7 @@ export class GirlUnlockData extends BaseData {
public clear(): void {
this.id = 0;
this.isRelease = false;
this.unlockTime = 0;
this.unlockedImageIds = [];
this.unlockedVideoIds = [];
}
@@ -41,6 +46,7 @@ export class GirlUnlockData extends BaseData {
super.destroy();
this.id = null;
this.isRelease = null;
this.unlockTime = null;
this.unlockedImageIds = null;
this.unlockedVideoIds = null;
}
@@ -65,6 +71,17 @@ export class GirlUnlockData extends BaseData {
this.isRelease = value;
}
/** 获取 角色解锁时间,时间戳,秒 */
public getUnlockTime(): number {
return this.unlockTime;
}
/** 保存 角色解锁时间,时间戳,秒 */
public setUnlockTime(value: number): void {
this.unlockTime = value;
// logger.log("设置角色 ", this.id, " 的解锁时间:", this.unlockTime);
}
/** 判断图片是否解锁,根据 id */
public isImageUnlock(id: number): boolean {
for (let i = 0; i < this.unlockedImageIds.length; i++) {
@@ -48,4 +48,9 @@ export class GirlService implements IGirlService {
public async reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise<ApiResponse<proto.cs.ICSUnlockResourceRes>> {
return this.impl.reqUnlockGirlRes(req);
}
// 获取可聊天的技师数据
public async reqCanChatGirlData(req: proto.cs.ICSGetLastChatListReq): Promise<ApiResponse<proto.cs.ICSGetLastChatListRes>> {
return this.impl.reqCanChatGirlData(req);
}
}
@@ -61,4 +61,15 @@ export class HttpGirlService implements IGirlService {
};
return this.api.call(epData, req);
}
// 获取可聊天的技师数据
async reqCanChatGirlData(req: proto.cs.ICSGetLastChatListReq): Promise<ApiResponse<proto.cs.ICSGetLastChatListRes>> {
let epData: Endpoint<proto.cs.ICSGetLastChatListReq, proto.cs.ICSGetLastChatListRes> = {
path: "api/logic/getLastChat",
method: "POST",
codec: "json",
needsAuth: true
};
return this.api.call(epData, req);
}
}
@@ -12,4 +12,6 @@ export interface IGirlService {
reqUnlockGirl(req: proto.cs.ICSUnlockGirlReq): Promise<ApiResponse<proto.cs.ICSUnlockGirlRes>>;
// 解锁资源
reqUnlockGirlRes(req: proto.cs.ICSUnlockResourceReq): Promise<ApiResponse<proto.cs.ICSUnlockResourceRes>>;
// 获取可聊天的技师数据
reqCanChatGirlData(req: proto.cs.ICSGetLastChatListReq): Promise<ApiResponse<proto.cs.ICSGetLastChatListRes>>;
}
@@ -300,5 +300,16 @@ export class MockGirlService implements IGirlService {
vipExpire,
};
return this.ok(res);
}
}
// 获取可聊天的技师数据
async reqCanChatGirlData(req: proto.cs.ICSGetLastChatListReq): Promise<ApiResponse<proto.cs.ICSGetLastChatListRes>> {
// TODO
// 返回数据
const res: proto.cs.ICSGetLastChatListRes = {
LastChatList: [],
};
return this.ok(res);
}
}
+345
View File
@@ -500,6 +500,9 @@ static getTypeUrl(typeUrlPrefix?: string): string;
/** GirlData star */
star?: (number|null);
/** GirlData unlockTime */
unlockTime?: (number|Long|null);
/** GirlData detail */
detail?: (cs.IGirlsDetail|null);
@@ -537,6 +540,9 @@ isRelease: boolean;
/** GirlData star. */
star: number;
/** GirlData unlockTime. */
unlockTime: (number|Long);
/** GirlData detail. */
detail?: (cs.IGirlsDetail|null);
@@ -3249,6 +3255,345 @@ toJSON(): { [k: string]: any };
static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a LastChatData. */
interface ILastChatData {
/** LastChatData id */
id?: (number|null);
/** LastChatData girl */
girl?: (cs.IGirls|null);
/** LastChatData isRelease */
isRelease?: (boolean|null);
/** LastChatData star */
star?: (number|null);
/** LastChatData chatRemainCount */
chatRemainCount?: (number|null);
/** LastChatData chatTotalCount */
chatTotalCount?: (number|null);
/** LastChatData unlockTime */
unlockTime?: (number|Long|null);
/** LastChatData msgs */
msgs?: (cs.IChatMsg[]|null);
}
/** Represents a LastChatData. */
class LastChatData implements ILastChatData {
/**
* Constructs a new LastChatData.
* @param [properties] Properties to set
*/
constructor(properties?: cs.ILastChatData);
/** LastChatData id. */
id: number;
/** LastChatData girl. */
girl?: (cs.IGirls|null);
/** LastChatData isRelease. */
isRelease: boolean;
/** LastChatData star. */
star: number;
/** LastChatData chatRemainCount. */
chatRemainCount: number;
/** LastChatData chatTotalCount. */
chatTotalCount: number;
/** LastChatData unlockTime. */
unlockTime: (number|Long);
/** LastChatData msgs. */
msgs: cs.IChatMsg[];
/**
* Creates a new LastChatData instance using the specified properties.
* @param [properties] Properties to set
* @returns LastChatData instance
*/
static create(properties?: cs.ILastChatData): cs.LastChatData;
/**
* Encodes the specified LastChatData message. Does not implicitly {@link cs.LastChatData.verify|verify} messages.
* @param message LastChatData message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encode(message: cs.ILastChatData, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified LastChatData message, length delimited. Does not implicitly {@link cs.LastChatData.verify|verify} messages.
* @param message LastChatData message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encodeDelimited(message: cs.ILastChatData, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a LastChatData message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns LastChatData
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): cs.LastChatData;
/**
* Decodes a LastChatData message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns LastChatData
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): cs.LastChatData;
/**
* Verifies a LastChatData message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a LastChatData message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns LastChatData
*/
static fromObject(object: { [k: string]: any }): cs.LastChatData;
/**
* Creates a plain object from a LastChatData message. Also converts values to other types if specified.
* @param message LastChatData
* @param [options] Conversion options
* @returns Plain object
*/
static toObject(message: cs.LastChatData, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this LastChatData to JSON.
* @returns JSON object
*/
toJSON(): { [k: string]: any };
/**
* Gets the default type url for LastChatData
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a CSGetLastChatListReq. */
interface ICSGetLastChatListReq {
/** CSGetLastChatListReq page */
page?: (number|null);
/** CSGetLastChatListReq limit */
limit?: (number|null);
}
/** Represents a CSGetLastChatListReq. */
class CSGetLastChatListReq implements ICSGetLastChatListReq {
/**
* Constructs a new CSGetLastChatListReq.
* @param [properties] Properties to set
*/
constructor(properties?: cs.ICSGetLastChatListReq);
/** CSGetLastChatListReq page. */
page: number;
/** CSGetLastChatListReq limit. */
limit: number;
/**
* Creates a new CSGetLastChatListReq instance using the specified properties.
* @param [properties] Properties to set
* @returns CSGetLastChatListReq instance
*/
static create(properties?: cs.ICSGetLastChatListReq): cs.CSGetLastChatListReq;
/**
* Encodes the specified CSGetLastChatListReq message. Does not implicitly {@link cs.CSGetLastChatListReq.verify|verify} messages.
* @param message CSGetLastChatListReq message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encode(message: cs.ICSGetLastChatListReq, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified CSGetLastChatListReq message, length delimited. Does not implicitly {@link cs.CSGetLastChatListReq.verify|verify} messages.
* @param message CSGetLastChatListReq message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encodeDelimited(message: cs.ICSGetLastChatListReq, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a CSGetLastChatListReq message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns CSGetLastChatListReq
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): cs.CSGetLastChatListReq;
/**
* Decodes a CSGetLastChatListReq message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns CSGetLastChatListReq
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): cs.CSGetLastChatListReq;
/**
* Verifies a CSGetLastChatListReq message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a CSGetLastChatListReq message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns CSGetLastChatListReq
*/
static fromObject(object: { [k: string]: any }): cs.CSGetLastChatListReq;
/**
* Creates a plain object from a CSGetLastChatListReq message. Also converts values to other types if specified.
* @param message CSGetLastChatListReq
* @param [options] Conversion options
* @returns Plain object
*/
static toObject(message: cs.CSGetLastChatListReq, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this CSGetLastChatListReq to JSON.
* @returns JSON object
*/
toJSON(): { [k: string]: any };
/**
* Gets the default type url for CSGetLastChatListReq
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Properties of a CSGetLastChatListRes. */
interface ICSGetLastChatListRes {
/** CSGetLastChatListRes LastChatList */
LastChatList?: (cs.ILastChatData[]|null);
}
/** Represents a CSGetLastChatListRes. */
class CSGetLastChatListRes implements ICSGetLastChatListRes {
/**
* Constructs a new CSGetLastChatListRes.
* @param [properties] Properties to set
*/
constructor(properties?: cs.ICSGetLastChatListRes);
/** CSGetLastChatListRes LastChatList. */
LastChatList: cs.ILastChatData[];
/**
* Creates a new CSGetLastChatListRes instance using the specified properties.
* @param [properties] Properties to set
* @returns CSGetLastChatListRes instance
*/
static create(properties?: cs.ICSGetLastChatListRes): cs.CSGetLastChatListRes;
/**
* Encodes the specified CSGetLastChatListRes message. Does not implicitly {@link cs.CSGetLastChatListRes.verify|verify} messages.
* @param message CSGetLastChatListRes message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encode(message: cs.ICSGetLastChatListRes, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Encodes the specified CSGetLastChatListRes message, length delimited. Does not implicitly {@link cs.CSGetLastChatListRes.verify|verify} messages.
* @param message CSGetLastChatListRes message or plain object to encode
* @param [writer] Writer to encode to
* @returns Writer
*/
static encodeDelimited(message: cs.ICSGetLastChatListRes, writer?: $protobuf.Writer): $protobuf.Writer;
/**
* Decodes a CSGetLastChatListRes message from the specified reader or buffer.
* @param reader Reader or buffer to decode from
* @param [length] Message length if known beforehand
* @returns CSGetLastChatListRes
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): cs.CSGetLastChatListRes;
/**
* Decodes a CSGetLastChatListRes message from the specified reader or buffer, length delimited.
* @param reader Reader or buffer to decode from
* @returns CSGetLastChatListRes
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): cs.CSGetLastChatListRes;
/**
* Verifies a CSGetLastChatListRes message.
* @param message Plain object to verify
* @returns `null` if valid, otherwise the reason why it is not
*/
static verify(message: { [k: string]: any }): (string|null);
/**
* Creates a CSGetLastChatListRes message from a plain object. Also converts values to their respective internal types.
* @param object Plain object
* @returns CSGetLastChatListRes
*/
static fromObject(object: { [k: string]: any }): cs.CSGetLastChatListRes;
/**
* Creates a plain object from a CSGetLastChatListRes message. Also converts values to other types if specified.
* @param message CSGetLastChatListRes
* @param [options] Conversion options
* @returns Plain object
*/
static toObject(message: cs.CSGetLastChatListRes, options?: $protobuf.IConversionOptions): { [k: string]: any };
/**
* Converts this CSGetLastChatListRes to JSON.
* @returns JSON object
*/
toJSON(): { [k: string]: any };
/**
* Gets the default type url for CSGetLastChatListRes
* @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns The default type url
*/
static getTypeUrl(typeUrlPrefix?: string): string;
}
/** Category enum. */
enum Category {
Category_mature = 0,
+900
View File
@@ -1047,6 +1047,7 @@ $root.cs = (function() {
* @property {cs.IGirls|null} [girl] GirlData girl
* @property {boolean|null} [isRelease] GirlData isRelease
* @property {number|null} [star] GirlData star
* @property {number|Long|null} [unlockTime] GirlData unlockTime
* @property {cs.IGirlsDetail|null} [detail] GirlData detail
* @property {Array.<cs.IResourceUnlock>|null} [images] GirlData images
* @property {Array.<cs.IResourceUnlock>|null} [videos] GirlData videos
@@ -1103,6 +1104,14 @@ $root.cs = (function() {
*/
GirlData.prototype.star = 0;
/**
* GirlData unlockTime.
* @member {number|Long} unlockTime
* @memberof cs.GirlData
* @instance
*/
GirlData.prototype.unlockTime = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* GirlData detail.
* @member {cs.IGirlsDetail|null|undefined} detail
@@ -1175,6 +1184,8 @@ $root.cs = (function() {
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isRelease);
if (message.star != null && Object.hasOwnProperty.call(message, "star"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.star);
if (message.unlockTime != null && Object.hasOwnProperty.call(message, "unlockTime"))
writer.uint32(/* id 5, wireType 0 =*/40).int64(message.unlockTime);
if (message.detail != null && Object.hasOwnProperty.call(message, "detail"))
$root.cs.GirlsDetail.encode(message.detail, writer.uint32(/* id 30, wireType 2 =*/242).fork()).ldelim();
if (message.images != null && message.images.length)
@@ -1239,6 +1250,10 @@ $root.cs = (function() {
message.star = reader.int32();
break;
}
case 5: {
message.unlockTime = reader.int64();
break;
}
case 30: {
message.detail = $root.cs.GirlsDetail.decode(reader, reader.uint32());
break;
@@ -1312,6 +1327,9 @@ $root.cs = (function() {
if (message.star != null && message.hasOwnProperty("star"))
if (!$util.isInteger(message.star))
return "star: integer expected";
if (message.unlockTime != null && message.hasOwnProperty("unlockTime"))
if (!$util.isInteger(message.unlockTime) && !(message.unlockTime && $util.isInteger(message.unlockTime.low) && $util.isInteger(message.unlockTime.high)))
return "unlockTime: integer|Long expected";
if (message.detail != null && message.hasOwnProperty("detail")) {
var error = $root.cs.GirlsDetail.verify(message.detail);
if (error)
@@ -1367,6 +1385,15 @@ $root.cs = (function() {
message.isRelease = Boolean(object.isRelease);
if (object.star != null)
message.star = object.star | 0;
if (object.unlockTime != null)
if ($util.Long)
(message.unlockTime = $util.Long.fromValue(object.unlockTime)).unsigned = false;
else if (typeof object.unlockTime === "string")
message.unlockTime = parseInt(object.unlockTime, 10);
else if (typeof object.unlockTime === "number")
message.unlockTime = object.unlockTime;
else if (typeof object.unlockTime === "object")
message.unlockTime = new $util.LongBits(object.unlockTime.low >>> 0, object.unlockTime.high >>> 0).toNumber();
if (object.detail != null) {
if (typeof object.detail !== "object")
throw TypeError(".cs.GirlData.detail: object expected");
@@ -1421,6 +1448,11 @@ $root.cs = (function() {
object.girl = null;
object.isRelease = false;
object.star = 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.unlockTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.unlockTime = options.longs === String ? "0" : 0;
object.detail = null;
object.chatTotalCount = 0;
object.chatRemainCount = 0;
@@ -1433,6 +1465,11 @@ $root.cs = (function() {
object.isRelease = message.isRelease;
if (message.star != null && message.hasOwnProperty("star"))
object.star = message.star;
if (message.unlockTime != null && message.hasOwnProperty("unlockTime"))
if (typeof message.unlockTime === "number")
object.unlockTime = options.longs === String ? String(message.unlockTime) : message.unlockTime;
else
object.unlockTime = options.longs === String ? $util.Long.prototype.toString.call(message.unlockTime) : options.longs === Number ? new $util.LongBits(message.unlockTime.low >>> 0, message.unlockTime.high >>> 0).toNumber() : message.unlockTime;
if (message.detail != null && message.hasOwnProperty("detail"))
object.detail = $root.cs.GirlsDetail.toObject(message.detail, options);
if (message.images && message.images.length) {
@@ -7545,6 +7582,869 @@ $root.cs = (function() {
return CSGetPurchaseRes;
})();
cs.LastChatData = (function() {
/**
* Properties of a LastChatData.
* @memberof cs
* @interface ILastChatData
* @property {number|null} [id] LastChatData id
* @property {cs.IGirls|null} [girl] LastChatData girl
* @property {boolean|null} [isRelease] LastChatData isRelease
* @property {number|null} [star] LastChatData star
* @property {number|null} [chatRemainCount] LastChatData chatRemainCount
* @property {number|null} [chatTotalCount] LastChatData chatTotalCount
* @property {number|Long|null} [unlockTime] LastChatData unlockTime
* @property {Array.<cs.IChatMsg>|null} [msgs] LastChatData msgs
*/
/**
* Constructs a new LastChatData.
* @memberof cs
* @classdesc Represents a LastChatData.
* @implements ILastChatData
* @constructor
* @param {cs.ILastChatData=} [properties] Properties to set
*/
function LastChatData(properties) {
this.msgs = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* LastChatData id.
* @member {number} id
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.id = 0;
/**
* LastChatData girl.
* @member {cs.IGirls|null|undefined} girl
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.girl = null;
/**
* LastChatData isRelease.
* @member {boolean} isRelease
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.isRelease = false;
/**
* LastChatData star.
* @member {number} star
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.star = 0;
/**
* LastChatData chatRemainCount.
* @member {number} chatRemainCount
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.chatRemainCount = 0;
/**
* LastChatData chatTotalCount.
* @member {number} chatTotalCount
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.chatTotalCount = 0;
/**
* LastChatData unlockTime.
* @member {number|Long} unlockTime
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.unlockTime = $util.Long ? $util.Long.fromBits(0,0,false) : 0;
/**
* LastChatData msgs.
* @member {Array.<cs.IChatMsg>} msgs
* @memberof cs.LastChatData
* @instance
*/
LastChatData.prototype.msgs = $util.emptyArray;
/**
* Creates a new LastChatData instance using the specified properties.
* @function create
* @memberof cs.LastChatData
* @static
* @param {cs.ILastChatData=} [properties] Properties to set
* @returns {cs.LastChatData} LastChatData instance
*/
LastChatData.create = function create(properties) {
return new LastChatData(properties);
};
/**
* Encodes the specified LastChatData message. Does not implicitly {@link cs.LastChatData.verify|verify} messages.
* @function encode
* @memberof cs.LastChatData
* @static
* @param {cs.ILastChatData} message LastChatData message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LastChatData.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.id != null && Object.hasOwnProperty.call(message, "id"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.id);
if (message.girl != null && Object.hasOwnProperty.call(message, "girl"))
$root.cs.Girls.encode(message.girl, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim();
if (message.isRelease != null && Object.hasOwnProperty.call(message, "isRelease"))
writer.uint32(/* id 3, wireType 0 =*/24).bool(message.isRelease);
if (message.star != null && Object.hasOwnProperty.call(message, "star"))
writer.uint32(/* id 4, wireType 0 =*/32).int32(message.star);
if (message.chatRemainCount != null && Object.hasOwnProperty.call(message, "chatRemainCount"))
writer.uint32(/* id 5, wireType 0 =*/40).int32(message.chatRemainCount);
if (message.chatTotalCount != null && Object.hasOwnProperty.call(message, "chatTotalCount"))
writer.uint32(/* id 6, wireType 0 =*/48).int32(message.chatTotalCount);
if (message.unlockTime != null && Object.hasOwnProperty.call(message, "unlockTime"))
writer.uint32(/* id 7, wireType 0 =*/56).int64(message.unlockTime);
if (message.msgs != null && message.msgs.length)
for (var i = 0; i < message.msgs.length; ++i)
$root.cs.ChatMsg.encode(message.msgs[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim();
return writer;
};
/**
* Encodes the specified LastChatData message, length delimited. Does not implicitly {@link cs.LastChatData.verify|verify} messages.
* @function encodeDelimited
* @memberof cs.LastChatData
* @static
* @param {cs.ILastChatData} message LastChatData message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
LastChatData.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a LastChatData message from the specified reader or buffer.
* @function decode
* @memberof cs.LastChatData
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {cs.LastChatData} LastChatData
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LastChatData.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cs.LastChatData();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.id = reader.int32();
break;
}
case 2: {
message.girl = $root.cs.Girls.decode(reader, reader.uint32());
break;
}
case 3: {
message.isRelease = reader.bool();
break;
}
case 4: {
message.star = reader.int32();
break;
}
case 5: {
message.chatRemainCount = reader.int32();
break;
}
case 6: {
message.chatTotalCount = reader.int32();
break;
}
case 7: {
message.unlockTime = reader.int64();
break;
}
case 8: {
if (!(message.msgs && message.msgs.length))
message.msgs = [];
message.msgs.push($root.cs.ChatMsg.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a LastChatData message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof cs.LastChatData
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {cs.LastChatData} LastChatData
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
LastChatData.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a LastChatData message.
* @function verify
* @memberof cs.LastChatData
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
LastChatData.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.id != null && message.hasOwnProperty("id"))
if (!$util.isInteger(message.id))
return "id: integer expected";
if (message.girl != null && message.hasOwnProperty("girl")) {
var error = $root.cs.Girls.verify(message.girl);
if (error)
return "girl." + error;
}
if (message.isRelease != null && message.hasOwnProperty("isRelease"))
if (typeof message.isRelease !== "boolean")
return "isRelease: boolean expected";
if (message.star != null && message.hasOwnProperty("star"))
if (!$util.isInteger(message.star))
return "star: integer expected";
if (message.chatRemainCount != null && message.hasOwnProperty("chatRemainCount"))
if (!$util.isInteger(message.chatRemainCount))
return "chatRemainCount: integer expected";
if (message.chatTotalCount != null && message.hasOwnProperty("chatTotalCount"))
if (!$util.isInteger(message.chatTotalCount))
return "chatTotalCount: integer expected";
if (message.unlockTime != null && message.hasOwnProperty("unlockTime"))
if (!$util.isInteger(message.unlockTime) && !(message.unlockTime && $util.isInteger(message.unlockTime.low) && $util.isInteger(message.unlockTime.high)))
return "unlockTime: integer|Long expected";
if (message.msgs != null && message.hasOwnProperty("msgs")) {
if (!Array.isArray(message.msgs))
return "msgs: array expected";
for (var i = 0; i < message.msgs.length; ++i) {
var error = $root.cs.ChatMsg.verify(message.msgs[i]);
if (error)
return "msgs." + error;
}
}
return null;
};
/**
* Creates a LastChatData message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof cs.LastChatData
* @static
* @param {Object.<string,*>} object Plain object
* @returns {cs.LastChatData} LastChatData
*/
LastChatData.fromObject = function fromObject(object) {
if (object instanceof $root.cs.LastChatData)
return object;
var message = new $root.cs.LastChatData();
if (object.id != null)
message.id = object.id | 0;
if (object.girl != null) {
if (typeof object.girl !== "object")
throw TypeError(".cs.LastChatData.girl: object expected");
message.girl = $root.cs.Girls.fromObject(object.girl);
}
if (object.isRelease != null)
message.isRelease = Boolean(object.isRelease);
if (object.star != null)
message.star = object.star | 0;
if (object.chatRemainCount != null)
message.chatRemainCount = object.chatRemainCount | 0;
if (object.chatTotalCount != null)
message.chatTotalCount = object.chatTotalCount | 0;
if (object.unlockTime != null)
if ($util.Long)
(message.unlockTime = $util.Long.fromValue(object.unlockTime)).unsigned = false;
else if (typeof object.unlockTime === "string")
message.unlockTime = parseInt(object.unlockTime, 10);
else if (typeof object.unlockTime === "number")
message.unlockTime = object.unlockTime;
else if (typeof object.unlockTime === "object")
message.unlockTime = new $util.LongBits(object.unlockTime.low >>> 0, object.unlockTime.high >>> 0).toNumber();
if (object.msgs) {
if (!Array.isArray(object.msgs))
throw TypeError(".cs.LastChatData.msgs: array expected");
message.msgs = [];
for (var i = 0; i < object.msgs.length; ++i) {
if (typeof object.msgs[i] !== "object")
throw TypeError(".cs.LastChatData.msgs: object expected");
message.msgs[i] = $root.cs.ChatMsg.fromObject(object.msgs[i]);
}
}
return message;
};
/**
* Creates a plain object from a LastChatData message. Also converts values to other types if specified.
* @function toObject
* @memberof cs.LastChatData
* @static
* @param {cs.LastChatData} message LastChatData
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
LastChatData.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.msgs = [];
if (options.defaults) {
object.id = 0;
object.girl = null;
object.isRelease = false;
object.star = 0;
object.chatRemainCount = 0;
object.chatTotalCount = 0;
if ($util.Long) {
var long = new $util.Long(0, 0, false);
object.unlockTime = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long;
} else
object.unlockTime = options.longs === String ? "0" : 0;
}
if (message.id != null && message.hasOwnProperty("id"))
object.id = message.id;
if (message.girl != null && message.hasOwnProperty("girl"))
object.girl = $root.cs.Girls.toObject(message.girl, options);
if (message.isRelease != null && message.hasOwnProperty("isRelease"))
object.isRelease = message.isRelease;
if (message.star != null && message.hasOwnProperty("star"))
object.star = message.star;
if (message.chatRemainCount != null && message.hasOwnProperty("chatRemainCount"))
object.chatRemainCount = message.chatRemainCount;
if (message.chatTotalCount != null && message.hasOwnProperty("chatTotalCount"))
object.chatTotalCount = message.chatTotalCount;
if (message.unlockTime != null && message.hasOwnProperty("unlockTime"))
if (typeof message.unlockTime === "number")
object.unlockTime = options.longs === String ? String(message.unlockTime) : message.unlockTime;
else
object.unlockTime = options.longs === String ? $util.Long.prototype.toString.call(message.unlockTime) : options.longs === Number ? new $util.LongBits(message.unlockTime.low >>> 0, message.unlockTime.high >>> 0).toNumber() : message.unlockTime;
if (message.msgs && message.msgs.length) {
object.msgs = [];
for (var j = 0; j < message.msgs.length; ++j)
object.msgs[j] = $root.cs.ChatMsg.toObject(message.msgs[j], options);
}
return object;
};
/**
* Converts this LastChatData to JSON.
* @function toJSON
* @memberof cs.LastChatData
* @instance
* @returns {Object.<string,*>} JSON object
*/
LastChatData.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for LastChatData
* @function getTypeUrl
* @memberof cs.LastChatData
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
LastChatData.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/cs.LastChatData";
};
return LastChatData;
})();
cs.CSGetLastChatListReq = (function() {
/**
* Properties of a CSGetLastChatListReq.
* @memberof cs
* @interface ICSGetLastChatListReq
* @property {number|null} [page] CSGetLastChatListReq page
* @property {number|null} [limit] CSGetLastChatListReq limit
*/
/**
* Constructs a new CSGetLastChatListReq.
* @memberof cs
* @classdesc Represents a CSGetLastChatListReq.
* @implements ICSGetLastChatListReq
* @constructor
* @param {cs.ICSGetLastChatListReq=} [properties] Properties to set
*/
function CSGetLastChatListReq(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CSGetLastChatListReq page.
* @member {number} page
* @memberof cs.CSGetLastChatListReq
* @instance
*/
CSGetLastChatListReq.prototype.page = 0;
/**
* CSGetLastChatListReq limit.
* @member {number} limit
* @memberof cs.CSGetLastChatListReq
* @instance
*/
CSGetLastChatListReq.prototype.limit = 0;
/**
* Creates a new CSGetLastChatListReq instance using the specified properties.
* @function create
* @memberof cs.CSGetLastChatListReq
* @static
* @param {cs.ICSGetLastChatListReq=} [properties] Properties to set
* @returns {cs.CSGetLastChatListReq} CSGetLastChatListReq instance
*/
CSGetLastChatListReq.create = function create(properties) {
return new CSGetLastChatListReq(properties);
};
/**
* Encodes the specified CSGetLastChatListReq message. Does not implicitly {@link cs.CSGetLastChatListReq.verify|verify} messages.
* @function encode
* @memberof cs.CSGetLastChatListReq
* @static
* @param {cs.ICSGetLastChatListReq} message CSGetLastChatListReq message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGetLastChatListReq.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.page != null && Object.hasOwnProperty.call(message, "page"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.page);
if (message.limit != null && Object.hasOwnProperty.call(message, "limit"))
writer.uint32(/* id 2, wireType 0 =*/16).int32(message.limit);
return writer;
};
/**
* Encodes the specified CSGetLastChatListReq message, length delimited. Does not implicitly {@link cs.CSGetLastChatListReq.verify|verify} messages.
* @function encodeDelimited
* @memberof cs.CSGetLastChatListReq
* @static
* @param {cs.ICSGetLastChatListReq} message CSGetLastChatListReq message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGetLastChatListReq.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSGetLastChatListReq message from the specified reader or buffer.
* @function decode
* @memberof cs.CSGetLastChatListReq
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {cs.CSGetLastChatListReq} CSGetLastChatListReq
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGetLastChatListReq.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cs.CSGetLastChatListReq();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
message.page = reader.int32();
break;
}
case 2: {
message.limit = reader.int32();
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSGetLastChatListReq message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof cs.CSGetLastChatListReq
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {cs.CSGetLastChatListReq} CSGetLastChatListReq
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGetLastChatListReq.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSGetLastChatListReq message.
* @function verify
* @memberof cs.CSGetLastChatListReq
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSGetLastChatListReq.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.page != null && message.hasOwnProperty("page"))
if (!$util.isInteger(message.page))
return "page: integer expected";
if (message.limit != null && message.hasOwnProperty("limit"))
if (!$util.isInteger(message.limit))
return "limit: integer expected";
return null;
};
/**
* Creates a CSGetLastChatListReq message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof cs.CSGetLastChatListReq
* @static
* @param {Object.<string,*>} object Plain object
* @returns {cs.CSGetLastChatListReq} CSGetLastChatListReq
*/
CSGetLastChatListReq.fromObject = function fromObject(object) {
if (object instanceof $root.cs.CSGetLastChatListReq)
return object;
var message = new $root.cs.CSGetLastChatListReq();
if (object.page != null)
message.page = object.page | 0;
if (object.limit != null)
message.limit = object.limit | 0;
return message;
};
/**
* Creates a plain object from a CSGetLastChatListReq message. Also converts values to other types if specified.
* @function toObject
* @memberof cs.CSGetLastChatListReq
* @static
* @param {cs.CSGetLastChatListReq} message CSGetLastChatListReq
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSGetLastChatListReq.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.page = 0;
object.limit = 0;
}
if (message.page != null && message.hasOwnProperty("page"))
object.page = message.page;
if (message.limit != null && message.hasOwnProperty("limit"))
object.limit = message.limit;
return object;
};
/**
* Converts this CSGetLastChatListReq to JSON.
* @function toJSON
* @memberof cs.CSGetLastChatListReq
* @instance
* @returns {Object.<string,*>} JSON object
*/
CSGetLastChatListReq.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CSGetLastChatListReq
* @function getTypeUrl
* @memberof cs.CSGetLastChatListReq
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CSGetLastChatListReq.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/cs.CSGetLastChatListReq";
};
return CSGetLastChatListReq;
})();
cs.CSGetLastChatListRes = (function() {
/**
* Properties of a CSGetLastChatListRes.
* @memberof cs
* @interface ICSGetLastChatListRes
* @property {Array.<cs.ILastChatData>|null} [LastChatList] CSGetLastChatListRes LastChatList
*/
/**
* Constructs a new CSGetLastChatListRes.
* @memberof cs
* @classdesc Represents a CSGetLastChatListRes.
* @implements ICSGetLastChatListRes
* @constructor
* @param {cs.ICSGetLastChatListRes=} [properties] Properties to set
*/
function CSGetLastChatListRes(properties) {
this.LastChatList = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* CSGetLastChatListRes LastChatList.
* @member {Array.<cs.ILastChatData>} LastChatList
* @memberof cs.CSGetLastChatListRes
* @instance
*/
CSGetLastChatListRes.prototype.LastChatList = $util.emptyArray;
/**
* Creates a new CSGetLastChatListRes instance using the specified properties.
* @function create
* @memberof cs.CSGetLastChatListRes
* @static
* @param {cs.ICSGetLastChatListRes=} [properties] Properties to set
* @returns {cs.CSGetLastChatListRes} CSGetLastChatListRes instance
*/
CSGetLastChatListRes.create = function create(properties) {
return new CSGetLastChatListRes(properties);
};
/**
* Encodes the specified CSGetLastChatListRes message. Does not implicitly {@link cs.CSGetLastChatListRes.verify|verify} messages.
* @function encode
* @memberof cs.CSGetLastChatListRes
* @static
* @param {cs.ICSGetLastChatListRes} message CSGetLastChatListRes message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGetLastChatListRes.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.LastChatList != null && message.LastChatList.length)
for (var i = 0; i < message.LastChatList.length; ++i)
$root.cs.LastChatData.encode(message.LastChatList[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified CSGetLastChatListRes message, length delimited. Does not implicitly {@link cs.CSGetLastChatListRes.verify|verify} messages.
* @function encodeDelimited
* @memberof cs.CSGetLastChatListRes
* @static
* @param {cs.ICSGetLastChatListRes} message CSGetLastChatListRes message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
CSGetLastChatListRes.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a CSGetLastChatListRes message from the specified reader or buffer.
* @function decode
* @memberof cs.CSGetLastChatListRes
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {cs.CSGetLastChatListRes} CSGetLastChatListRes
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGetLastChatListRes.decode = function decode(reader, length, error) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.cs.CSGetLastChatListRes();
while (reader.pos < end) {
var tag = reader.uint32();
if (tag === error)
break;
switch (tag >>> 3) {
case 1: {
if (!(message.LastChatList && message.LastChatList.length))
message.LastChatList = [];
message.LastChatList.push($root.cs.LastChatData.decode(reader, reader.uint32()));
break;
}
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a CSGetLastChatListRes message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof cs.CSGetLastChatListRes
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {cs.CSGetLastChatListRes} CSGetLastChatListRes
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
CSGetLastChatListRes.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a CSGetLastChatListRes message.
* @function verify
* @memberof cs.CSGetLastChatListRes
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
CSGetLastChatListRes.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.LastChatList != null && message.hasOwnProperty("LastChatList")) {
if (!Array.isArray(message.LastChatList))
return "LastChatList: array expected";
for (var i = 0; i < message.LastChatList.length; ++i) {
var error = $root.cs.LastChatData.verify(message.LastChatList[i]);
if (error)
return "LastChatList." + error;
}
}
return null;
};
/**
* Creates a CSGetLastChatListRes message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof cs.CSGetLastChatListRes
* @static
* @param {Object.<string,*>} object Plain object
* @returns {cs.CSGetLastChatListRes} CSGetLastChatListRes
*/
CSGetLastChatListRes.fromObject = function fromObject(object) {
if (object instanceof $root.cs.CSGetLastChatListRes)
return object;
var message = new $root.cs.CSGetLastChatListRes();
if (object.LastChatList) {
if (!Array.isArray(object.LastChatList))
throw TypeError(".cs.CSGetLastChatListRes.LastChatList: array expected");
message.LastChatList = [];
for (var i = 0; i < object.LastChatList.length; ++i) {
if (typeof object.LastChatList[i] !== "object")
throw TypeError(".cs.CSGetLastChatListRes.LastChatList: object expected");
message.LastChatList[i] = $root.cs.LastChatData.fromObject(object.LastChatList[i]);
}
}
return message;
};
/**
* Creates a plain object from a CSGetLastChatListRes message. Also converts values to other types if specified.
* @function toObject
* @memberof cs.CSGetLastChatListRes
* @static
* @param {cs.CSGetLastChatListRes} message CSGetLastChatListRes
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
CSGetLastChatListRes.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.LastChatList = [];
if (message.LastChatList && message.LastChatList.length) {
object.LastChatList = [];
for (var j = 0; j < message.LastChatList.length; ++j)
object.LastChatList[j] = $root.cs.LastChatData.toObject(message.LastChatList[j], options);
}
return object;
};
/**
* Converts this CSGetLastChatListRes to JSON.
* @function toJSON
* @memberof cs.CSGetLastChatListRes
* @instance
* @returns {Object.<string,*>} JSON object
*/
CSGetLastChatListRes.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* Gets the default type url for CSGetLastChatListRes
* @function getTypeUrl
* @memberof cs.CSGetLastChatListRes
* @static
* @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
* @returns {string} The default type url
*/
CSGetLastChatListRes.getTypeUrl = function getTypeUrl(typeUrlPrefix) {
if (typeUrlPrefix === undefined) {
typeUrlPrefix = "type.googleapis.com";
}
return typeUrlPrefix + "/cs.CSGetLastChatListRes";
};
return CSGetLastChatListRes;
})();
/**
* Category enum.
* @name cs.Category