123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- import ItemsM from "../mgr/ItemsM";
- import { RewardGoods } from "../mgr/PushMsgM";
- import WsM from "./WsM";
- export class OwnerInfo {
- owner: boolean; // 当前用户是否是owener
- ownerId: string; // owner的id
- ownerName: string; // owner的名字
- rewardStatus: number; // 是否有奖励 0有1没有
- rewardPog: number; // 奖励的pog数量
- }
- export class FamilyInfo {
- familyId: string; // 家族id
- familyName: string; // 家族名族
- notice: string; // 家族公告
- share: string;
- dailyPog: string; // 家族今日pog
- seasonPassGame: number; // 家族赛季通行证
- xp: string; // 家族当前xp
- boxCount: number; // 宝箱数量
- totalSize: number; // 家族最大人数
- memberSize: number; // 家族当前人数
- ownerDto: OwnerInfo;
- }
- export class FamilyMember {
- familyId: string;
- userId: string;
- userName: string;
- totalXp: string;
- dailyXp: string;
- }
- export class FamilyJoinPlayer {
- id: string;
- createTime: string;
- updateTime: string;
- isDeleted: number;
- familyId: string;
- userId: string;
- reason: string;
- status: number;
- }
- export default class FamilyM {
- private static _ins: FamilyM;
- public static get ins(): FamilyM {
- return (FamilyM._ins ??= new FamilyM());
- }
- async getFamilyInfo(familyId: string): Promise<FamilyInfo> {
- let result = await WsM.ins.syncRequest(26009, { familyId: familyId });
- return result as FamilyInfo;
- }
- async familyMemberList(familyId: string): Promise<FamilyMember[]> {
- let result = await WsM.ins.syncRequest(26010, { familyId });
- return result.memberList as FamilyMember[];
- }
- async searchFamily(keyWords: string): Promise<FamilyInfo[]> {
- let result = await WsM.ins.syncRequest(26002, { keyWords });
- return result as FamilyInfo[];
- }
- async createFamily(familyName: string): Promise<FamilyInfo> {
- let result = await WsM.ins.syncRequest(26001, {
- familyName: familyName,
- notice: "",
- });
- return result as FamilyInfo;
- }
- async editFamilyNotice(familyId: string, notice: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26003, {
- familyId,
- notice,
- });
- return result;
- }
- async requestJoinFamily(familyId: string, reason: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26004, {
- familyId,
- reason,
- });
- return result;
- }
- async familyRequestList(familyId: string): Promise<FamilyJoinPlayer[]> {
- let result = await WsM.ins.syncRequest(26013, { familyId });
- if (!result || !result.joinList) {
- return [];
- }
- return result.joinList as FamilyJoinPlayer[];
- }
- async agreeJoinFamily(familyId: string, userId: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26005, {
- familyId,
- userId,
- });
- return result;
- }
- async rejectJoinFamily(familyId: string, userId: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26006, {
- familyId,
- userId,
- });
- return result;
- }
- async upgradeFamily(familyId: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26007, { familyId });
- return result;
- }
- async kickFamilyMember(familyId: string, userId: string): Promise<any> {
- let result = await WsM.ins.syncRequest(26008, { familyId, userId });
- return result;
- }
- async claimFamilyRewardMemberBox(
- familyId: string,
- num: number
- ): Promise<RewardGoods> {
- let result: RewardGoods = await WsM.ins.syncRequest(26011, {
- familyId,
- num,
- });
- if (result) {
- ItemsM.ins.itemChange(result.changeList, result.goodList);
- }
- return result;
- }
- async claimFamilyRewardOwnerPog(familyId: string): Promise<RewardGoods> {
- let result = await WsM.ins.syncRequest(26012, { familyId });
- if (result) {
- ItemsM.ins.itemChange(result.changeList, result.goodList);
- }
- return result;
- }
- async leaveFamily(): Promise<any> {
- let result = await WsM.ins.syncRequest(26014, {});
- return result;
- }
- }
|