UNPKG

sgtcloud-html5-sdk

Version:

A html5 out-of-box sdk for damn cool mbaas

2,631 lines (2,255 loc) 234 kB
jsonRPC =new Object({ version: '2.0', endPoint: null, namespace: null, setup: function(params) { this.endPoint = params["endPoint"]; this.namespace = params["namespace"]; this.cache = params["cache"] !== undefined ? params["cache"] : true; return this; }, request: function(method, options) { if (options === undefined) { options = {"id": 1}; } if (options["id"] === undefined) { options["id"] = 1; } if (options["cache"] === undefined) { options["cache"] = this.cache; } this._doRequest(JSON.stringify(this._requestDataObj(method, options["params"], options["id"])), options); return true; }, // Creates an RPC suitable request object _requestDataObj: function(method, params, id) { var dataObj = { "jsonrpc": this.version, "method": this.namespace ? this.namespace +'.'+ method : method, "id": id } if(params !== undefined) { dataObj["params"] = params; } return dataObj; }, _requestUrl: function(url, cache) { url = url || this.endPoint; if (!cache) { if (url.indexOf("?") < 0) { url += '?tm=' + new Date().getTime(); } else { url += "&tm=" + new Date().getTime(); } } return url; }, _doRequest: function(data, options) { var _that = this; var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { if (xmlhttp.status==200) { _that._requestSuccess.call(_that, xmlhttp.responseText, options["success"], options["error"]); } else { _that._requestError.call(_that, xmlhttp.responseText, options["error"]); } } }; xmlhttp.open("POST",this._requestUrl((this.endPoint || options["url"]), options["cache"]), false); var headers=[ {"name":"Accept","type":"application/json, text/javascript, */*;"}, {"name":"Content-Type","type":"application/json-rpc"} ]; for (var i=0;i<headers.length;i++) { xmlhttp.setRequestHeader( headers[i]["name"], headers[i]["type"]); } xmlhttp.send(data); }, // Handles calling of error callback function _requestError: function(responseText, error) { if (error !== undefined && typeof(error) === 'function') { if(typeof(responseText) === 'string') { try { error(eval ( '(' + responseText + ')' )); } catch(e) { error(this._response()); } } else { error(this._response()); } } }, _requestSuccess: function(responseText, success, error) { var response = this._response(responseText); if(response.error && typeof(error) === 'function') { error(response); return; } // Otherwise, successful request, run the success request if it exists if(typeof(success) === 'function') { success(response); } }, _response: function(responseText) { if (responseText === undefined) { return { error: 'Internal server error', version: '2.0' }; } else { try { if(typeof(responseText) === 'string') { responseText = eval ( '(' + responseText + ')' ); } return responseText; } catch (e) { return { error: 'Internal server error: ' + e, version: '2.0' } } } } }); /** * Created by Administrator on 2015/9/17. */ /** * 接口列表: * 用户相关业务接口 * 角色处理逻辑业务接口 * 角色扩展业务接口 * 成就系统业务 * 公告业务接口 * 活动业务接口 * 签到业务接口 * 日常任务接口 * 通用任务模块业务接口 * 好友业务接口 * 好友关系扩展业务 * 黑名单业务接口 * 抽奖业务接口 * 排行榜业务接口 * 邮件相关业务接口 * 通知模块业务 * 充值业务逻辑 * 商城业务接口 * 计费点业务 * BOSS业务接口 * 文件分发存储业务 * 礼包/兑换码业务接口 * 个人通道业务接口 * 公共通道业务接口 * 第三方回调接口 * 结构化数据业务接口 * 反馈举报 业务接口 */ /** * sgt html5 api * 开发者 by zhcy * * */ SgtApi = $S = {}; /** * Entity 实体类 * */ SgtApi.entity = { /** * User 对象 * @class User * @constructor */ User: function () { /** * 昵称 * @property nickName * @type {string} * @default null */ this.nickName = null; /** * 密码 * @property password * @type {string} * @default null */ this.password = null; /** * 用户ID * @property userid * @type {string} * @default null */ this.userId = null; /** * 用户名 * @property userName * @type {string} * @default null */ this.userName = null; /** * 邮件 * @property email * @type {string} * @defaunilt null */ this.email = null; /** * 创建时间 * @property createTime * @type {long} * @default null */ this.createTime = null; /** * 手机ICCID * @property iccid * @type {string} * @default null */ this.iccid = null; /** * 手机IMEI号 * @property imei * @type {string} * @default null */ this.imei = null; /** * 最后登陆时间 * @property lastLoginTime * @type {long} * @default null */ this.lastLoginTime = null; /** * 手机mac地址 * @property mac * @type {string} * @default null */ this.mac = null; /** * 电话号码 * @property phoneNumber * @type {string} * @default null */ this.phoneNumber = null; /** * 注册类型 * @property registryType * @type {int} * @default null */ this.registryType = 0; /** * 最后更新时间 * @property updateTime * @type {long} * @default null */ this.updateTime = null; /** * 系统自动匹配注册(根据IMEI,ICCID,mac) * @type {number} */ SgtApi.entity.User.prototype.AUTO = 0; /** * 注册类型,普通注册,使用用户名和密码注册 * @type {number} */ SgtApi.entity.User.prototype.MANUAL = 0; /** * 使用手机号码注册 * @type {number} */ SgtApi.entity.User.prototype.PHONENUMBER = 0; }, /** * 玩家角色接口 * * @class Player * @constructor */ Player: function () { /** * 自定义ID * @property customId * @type {String} * @default null */ this.customId = null; /** * 装备 * @property equip * @type {String} * @default null */ this.equip = null; /** * 主键id * @property id * @type {String} * @default 0 */ this.id = 0; /** * 最后登录时间 * @property lastLoginTime * @type {Long} * @default null */ this.lastLoginTime = null; /** * 等级 * @property level * @type {int} * @default 1 */ this.level = 1; /** * 名字 * @property name * @type {String} * @default null */ this.name = null; /** * 服务器 * @property serverId * @type {String} * @default null */ this.serverId = null; /** * 类型 * @property type * @type {String} * @default null */ this.type = null; /** * 用户ID * @property userId * @type {String} * @default null */ this.userId = null; /** * VIP 等级 * @property vip * @type {int} * @default 0 */ this.vip = 0; /** * 好友最大上限数 * @property friendsMaxNumber * @type {number} * @default 0 */ this.friendsMaxNumber = 0; /** * 性别 [1 男 0 女] * @property gender * @type {number} * @default 0 */ this.gender = 0; /** * 金钱 * @property money * @type {number} * @default 0 */ this.money = 0; }, /** * 存档实例 * * @class save * @constructor */ Save: function () { /** * 存档内容 * @property content * @type {String} * @default null */ this.content = null; /** * 是否可下载存档标识 * @property downFlag * @type {int} * @default null */ this.downFlag = null; /** * 主键 * @property id * @type {int} * @default null */ this.id = null; /** * 最后上传时间 * @property lastUploadTime * @type {long} * @default null */ this.lastUploadTime = null; /** * 角色ID * @property playerId * @type {string} * @default null */ this.playerId = null; /** * 允许下载 * @type {number} */ SgtApi.entity.Save.prototype.ALLOW_DOWN = 0; /** * 不允许下载 * @type {number} */ SgtApi.entity.Save.prototype.DENY_DOWN = 0; }, /** * mail 对象 * @class mail * @constructor */ Mail: function () { /** * 附件 * @property attachment * @type {string} * @default null */ this.attachment = null; /** * 附件状态 0为未领取,1为领取,默认为0 * @type {number} */ this.attachStatus = 0; /** * 内容 * @property content * @type {string} * @default null */ this.content = null; /** * 发送者ID * @property fromId * @type {string} * @default null */ this.fromId = null; /** * 发送者名称 * @property fromName * @type {string} * @default null */ this.fromName = null; /** * 主键 * @property id * @type {string} * @default null */ this.id = null; /** * 发送时间 * @property sendTime * @type {string} * @default null */ this.sendTime = (new Date()).getTime(); /** * 状态 * @property status * @type {string} * @default null */ this.status = SgtApi.config.Mail_TYPE_NOREAD; /** * 标题 * @property title * @type {string} * @default null */ this.title = null; /** * 接收者ID * @property toId * @type {string} * @default null */ this.toId = null; /** * 接收者名称 * @property toName * @type {string} * @default null */ this.toName = null; /** * 类型 * @property type * @type {string} * @default null */ this.type = 0; /** * 删除状态 已经删除 -1 * @type {number} */ SgtApi.entity.Mail.prototype.DELETED = 0; /** * 已读状态 值为1 * @type {number} */ SgtApi.entity.Mail.prototype.READ = 0; /** * 附件未领取 * @type {number} */ SgtApi.entity.Mail.prototype.STATUS_ATTACH_NO_PICK = 0; /** * 附件已经领取 * @type {number} */ SgtApi.entity.Mail.prototype.STATUS_ATTACH_PICKED = 0; /** * 邮件类型:好友邀请邮件 职位3 * @type {number} */ SgtApi.entity.Mail.prototype.TYPE_INVITATE_FRIENDSHIP = 0; /** * 邮件类型:普通邮件 值为 0 * @type {number} */ SgtApi.entity.Mail.prototype.TYPE_NORMAL = 0; /** * 邮件类型:系统通知邮件 值为1 * @type {number} */ SgtApi.entity.Mail.prototype.TYPE_SYSTEM = 0; /** * 邮件类型:系统奖励邮件 值为2 * @type {number} */ SgtApi.entity.Mail.prototype.TYPE_SYSTEM_REWARD = 0; /** * 未读状态 值为0 * @type {number} */ SgtApi.entity.Mail.prototype.UNREAD = 0; }, /** * Ticket 对象 * @class Ticket * @constructor */ Ticket: function () { /** * 反馈给后台的内容 * @property content * @type {string} * @default null */ this.content = null; /** * 提交时间 * @property createTime * @type {long} * @default null */ this.createTime = (new Date()).getTime(); /** * 处理完返回给提交者的信息 * @property feedbackInfo * @type {string} * @default null */ this.feedbackInfo = null; /** * 主键 * @property id * @type {int} * @default null */ this.id = 0; /** * 提交者ID * @property senderPlayerId * @type {string} * @default null */ this.senderPlayerId = null; /** * 状态 * @property status * @type {int} * @default null */ this.status = 1; /** * 目标角色ID * @property targetPlayerId * @type {string} * @default null */ this.targetPlayerId = null; /** * 标题 * @property title * @type {string} * @default null */ this.title = null; /** * 类型 * @property type * @type {int} * @default null */ this.type = 1; /** * 待处理 * @type {number} */ SgtApi.entity.Ticket.prototype.STATUS_OF_PENDING = 0; /** * 已处理 * @type {number} */ SgtApi.entity.Ticket.prototype.STATUS_OF_PROCESSED = 0; /** * 一般类型 * @type {number} */ SgtApi.entity.Ticket.prototype.TYPE_OF_NORMAL = 0; }, /** * 成就 * @constructor */ Achievement: function () { /** * 当前进度 * @type {number} */ this.currentProgress = 0; /** * 自定义条件,客户端使用 * @type {null} */ this.customCondition = null; /** * 成就描述 * @type {null} */ this.description = null; /** * 完成成就的进度数 * @type {number} */ this.goal = 0; /** * 主键id * @type {number} */ this.id = 0; /** * 开启成就的等级 * @type {number} */ this.level = 0; /** * 名称 * @type {null} */ this.name = null; /** * 是否允许当前进度超越最大进度,默认不允许 * @type {boolean} */ this.overMaxProgress = false; /** * 前置成就ID * @type {null} */ this.preAchievementId = null; /** * 奖励 * @type {null} */ this.reward = null; /** * 是否允许成就完成后仍然显示在列表,默认显示,0为不显示,1为显示 * @type {number} */ this.showDone = 0; /** * 状态(禁用0,启用1) * @type {number} */ this.status = 0; /** * 成就类型 * @type {null} */ this.type = null; /** * 是否在前置成就没完成之前同时更新后置任务,默认不允许 * @type {boolean} */ this.updateUnfinished = false; /** * 成就的可见性 [0 不可见,1 可见] * @type {number} */ this.visibility = 0; /** * 已达成 * @type {number} */ SgtApi.entity.Achievement.prototype.PROGRESS_DONE = 0; /** * 已经领取奖励 * @type {number} */ SgtApi.entity.Achievement.prototype.PROGRESS_GOT_REWARD = 0; /** * 未达成 * @type {number} */ SgtApi.entity.Achievement.prototype.PROGRESS_NOT_ACHIEVED = 0; /** * 不可用 * @type {number} */ SgtApi.entity.Achievement.prototype.STATUS_DISABLE = 0; /** * 可用,开启状态 * @type {number} */ SgtApi.entity.Achievement.prototype.STATUS_ENABLE = 0; /** * 成就不可见 * @type {number} */ SgtApi.entity.Achievement.prototype.VISIBILITY_INVISIBLE = 0; /** * 成就可见 * @type {number} */ SgtApi.entity.Achievement.prototyep.VISIBILITY_VISIBLE = 0; }, /** * 公告 * @constructor */ Announcement: function () { /** * 公告内容 * @type {null} */ this.content = null; /** * 结束时间 * @type {number} */ this.endTime = 0; /** * 开始时间 * @type {number} */ this.startTime = 0; /** * 状态 1 启用 0 禁用 默认索引,不能为空 * @type {number} */ this.state = 0; /** * 公告标题 * @type {null} */ this.title = null; /** * 公告类型 默认索引,不能为空 * @type {number} */ this.type = 0; /** * 主键,UUID类型,由应用自动生成 * @type {null} */ this.uuid = null; /** * 公告版本 默认索引,不能为空 * @type {number} */ this.version = 0; /** * 公告类型 活动公告(1) * @type {number} */ SgtApi.entity.Announcement.prototype.ACTIVITY = 0; /** * 公告类型 商城公告(2) * @type {number} */ SgtApi.entity.Announcement.prototype.BULLETIN = 0; /** * 公告类型 维护公告(3) * @type {number} */ SgtApi.entity.Announcement.prototype.MAINTAIN = 0; }, /** * 黑名单 * @constructor */ Blacklist: function () { /** * 自定义黑名单ID * @type {null} */ this.blacklistId = null; /** * 渠道ID * @type {null} */ this.channelId = null; /** * 描述 * @type {null} */ this.description = null; /** * 主键 * @type {number} */ this.id = 0; /** * 名称 * @type {null} */ this.name = null; /** * 类型 * @type {number} */ this.type = 0; /** * 正常 * @type {number} */ SgtApi.entity.Blacklist.prototype.TYPE_OF_NORMAL = 0; /** * 路由黑名单 * @type {number} */ SgtApi.entity.Blacklist.prototype.TYPE_OF_ROUTE = 0; }, /** * BOSS * @constructor */ Boss: function () { /** * 血量 * @type {number} */ this.hp = 0; /** * 主键 * @type {number} */ this.id = 0; /** * 强度 * @type {null} */ this.intensity = null; /** * 名称 * @type {null} */ this.name = null; /** * 奖励 * @type {null} */ this.rewards = null; /** * 类型 * @type {number} */ this.type = 0; /** * 私有boss,只能自己打 * @type {number} */ SgtApi.entity.Boss.prototype.PRIVATE = 0; /** * 公共 、世界boss * @type {number} */ SgtApi.entity.Boss.prototype.PUBLIC = 0; }, /** * 活动 * @constructor */ Campaign: function () { /** * 关联的boss * @type {null} */ this.bossIds = null; /** * 活动简介 * @type {null} */ this.brief = null; /** * 结束时间 * @type {number} */ this.endTime = 0; /** * 图标 * @type {null} */ this.icon = null; /** * 主键 * @type {number} */ this.id = 0; /** * 关联的排行榜 * @type {null} */ this.leaderboardIds = null; /** * 活动进度 * @type {number} */ this.progress = 0; /** * 奖励内容数组 * @type {null} */ this.rewardContent = null; /** * 关联的奖励主键,多个使用逗号分开 * @type {null} */ this.rewards = null; /** * 开始时间 * @type {number} */ this.startTime = 0; /** * 标题 * @type {null} */ this.title = null; /** * 活动类型 * @type {null} */ this.type = null; }, /** * 活动详情 * @constructor */ CampaignDetail: function () { /** * 关联的活动 * @type {null} */ this.campaign = null; /** * 关联的活动ID * @type {number} */ this.campaignId = 0; /** * 活动描述 * @type {null} */ this.description = null; /** * 主键 * @type {number} */ this.id = 0; /** * 活动台本 * @type {null} */ this.script = null; }, /** * 公共通道 * @constructor */ Channel: function () { /** * 通道ID * @type {null} */ this.channelId = null; /** * 主键 * @type {number} */ this.id = 0; /** * 通道名称 * @type {null} */ this.name = null; }, /** * 充值记录 * @constructor */ ChargeLog: function () { /** * 充值金额 * @type {number} */ this.chargeCost = 0; /** * 充值计费点ID * @type {null} */ this.chargePointId = null; /** * 充值说明 * @type {null} */ this.chargeText = null; /** * 充值时间 * @type {number} */ this.chargeTime = 0; /** * 是否首冲 * @type {number} */ this.firstCharge = 0; /** * id * @type {number} */ this.id = 0; /** * 备注信息 * @type {null} */ this.notes = null; /** * 充值订单ID * @type {null} */ this.orderId = null; /** * 角色ID * @type {null} */ this.playerId = null; /** * 购买请求token,google play验证充值时需要使用到 * @type {null} */ this.purchaseToken = null; /** * 充值结果 * @type {number} */ this.result = 0; /** * 充值渠道 * @type {null} */ this.storeName = null; /** * 累计充值金额 * @type {number} */ this.totalChargeCost = 0; }, /** * 计费点 * @constructor */ ChargePoint: function () { /** * 充值获得的物品数量 * @type {number} */ this.amount = 0; /** * 计费代码 * @type {null} */ this.billingCode = null; /** * 自定义ID * @type {null} */ this.customId = null; /** * 描述 * @type {null} */ this.description = null; /** * 充值额外获得的奖励物品数量 * @type {number} */ this.extraAmount = 0; /** * 首次充值获得的奖励物品数量 * @type {number} */ this.firstChargeRewardAmount = 0; /** * id * @type {number} */ this.id = 0; /** * 充值金额(RMB:单位是分) * @type {number} */ this.money = 0; /** * 名称 * @type {null} */ this.name = null; /** * 其他自定义参数 * @type {null} */ this.other = null; /** * 当前用户已经购买此计费点的次数,仅用于VO,不需要持久化到mysql * @type {number} */ this.purchanseTimes = 0; /** * 是否推荐 * @type {number} */ this.recommendation = 0; /** * 是否可见或启用 * @type {number} */ this.status = 0; /** * 充值次数限制,没有次数限制时可约定为-1 * @type {number} */ this.timesLimit = 0; /** * 类型,充值获取的物品类型,如元宝、道具、月卡等 * @type {null} */ this.type = null; /** * VIP积分增长值 * @type {number} */ this.vipScore = 0; }, /** * 签到板 * @constructor */ CheckinBoard: function () { /** * 自定义签到板ID * @type {null} */ this.checkinBoardId = null; /** * 有效结束时间 * @type {number} */ this.endTime = 0; /** * 主键 * @type {number} */ this.id = 0; /** * 最大签到次数 * @type {number} */ this.maxCheckinTimes = 0; /** * 名称 * @type {null} */ this.name = null; /** * 签到状态重置时间,默认为0点整 * @type {number} */ this.resetTime = 0; /** * 奖励 * @type {null} */ this.reward = null; /** * 有效开始时间 * @type {number} */ this.startTime = 0; /** * tag * @type {null} */ this.tag = null; /** * 类型 * @type {number} */ this.type = 0; /** * 日历签到 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_CALENDAR = 0; /** * 每日签到 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_DAILY = 0; /** * 月签到,每月一次 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_MONTH = 0; /** * 一般签到 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_NORMAL = 0; /** * 周签到,每周一次 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.CHECKIN_TYPE_WEEKS = 0; /** * 同 CHECKIN_TYPE_DAILY 每日签到 * @type {number} */ SgtApi.entity.CheckinBoard.protptype.DAILY = 0; /** * 同 CHECKIN_TYPE_NORMAL 一般签到 * @type {number} */ SgtApi.entity.CheckinBoard.prototype.NOMARL = 0; }, /** * 签到返回VO * @constructor */ CheckinResult: function () { /** * 最大累计次数 * @type {number} */ this.accumlateCount = 0; /** * 签到板ID * @type {null} */ this.checkinBoardId = null; /** * 连续签到次数 * @type {number} */ this.countinuousCount = 0; /** * 上一次签到时间 * @type {number} */ this.lastCheckinTime = 0; /** * 奖励 * @type {null} */ this.rewards = null; }, /** * 日常任务 * @constructor */ DailyTask: function () { /** * 任务可用状态,1为可用,0为不可用,默认为1 * @type {number} */ this.available = 1; /** * 关联活动ID(预留) * @type {number} */ this.campaignId = 0; /** * 当前任务进度 * @type {number} */ this.currentProgress = 0; /** * 任务描述 * @type {null} */ this.description = null; /** * 任务结束时间 * @type {number} */ this.endTime = 0; /** * 任务总进度 * @type {number} */ this.goal = 0; /** * id * @type {null} */ this.id = null; /** * 限制等级,最低可做该任务的等级 * @type {number} */ this.minLevel = 0; /** * 任务名称 * @type {null} */ this.name = null; /** * 后置任务ID * @type {null} */ this.nextTaskId = null; /** * 是否允许当前进度超越最大进度,默认不允许 * @type {boolean} */ this.overMaxProgress = false; /** * 前置任务ID * @type {null} */ this.preTaskId = null; /** * 任务奖励 * @type {null} */ this.reward = null; /** * 是否允许任务完成后仍然显示在列表,默认显示,false为不显示,true为显示 * @type {boolean} */ this.showDone = true; /** * 任务开始时间 * @type {number} */ this.startTime = 0; /** * 当前任务状态 * @type {number} */ this.status = 0; /** * 任务类型 * @type {null} */ this.type = null; /** * 是否在前置任务没完成之前同时更新后置任务,默认不允许 * @type {boolean} */ this.updateUnfinished = false; /** * 任务进度状态,已经完成,还未领取奖励的状态 * @type {number} */ SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_COMPLETED = 0; /** * 任务进度状态,已经完成,并且已经领取奖励的状态 * @type {number} */ SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_GOT_REWARD = 0; /** * 任务进度状态,未完成,在任务进行中的状态 * @type {number} */ SgtApi.entity.DailyTask.prototype.STATUS_PROGRESS_UNFINISHED = 0; /** * 任务状态,可用的 * @type {number} */ SgtApi.entity.DailyTask.prototype.STATUS_TASK_AVAILABLE = 0; /** * 任务状态,不可用的 * @type {number} */ SgtApi.entity.DailyTask.prototype.STATUS_TASK_UNAVAILABLE = 0; }, /** * 第三方回调封装bean * @constructor */ ExternalCallbackBean: function () { /** * appId * @type {null} */ this.appId = null; /** * 订单内容 * @type {null} */ this.content = null; /** * 创建时间 * @type {number} */ this.createTime = 0; /** * did * @type {null} */ this.did = null; /** * 第三方请求的header * @type {null} */ this.header = null; /** * 第三方请求的http状态 * @type {number} */ this.httpCode = 0; /** * id * @type {number} */ this.id = 0; /** * 角色ID * @type {null} */ this.playerId = null; /** * 服务器ID * @type {null} */ this.serverId = null; /** * 物品类型 * @type {null} */ this.type = null; /** * 订单更新时间 * @type {number} */ this.updateTime = 0; /** * 用户ID * @type {null} */ this.userId = null; }, /** * 文件的基本属性 * @constructor */ FileItem: function () { /** * 文件名 * @type {null} */ this.fileName = null; /** * 图片属性 帧数 * @type {number} */ this.frames = 0; /** * 图片属性 高度 * @type {number} */ this.height = 0; /** * 最后上传时间戳 * @type {number} */ this.lastUploadTime = 0; /** * 相对于根路径的path * @type {null} */ this.path = null; /** * 图片属性 图片类型(JPG/PNG/JPEG/GIF) * @type {null} */ this.picType = null; /** * 文件大小 * @type {number} */ this.size = 0; /** * 文件类型,文件or文件夹 * @type {null} */ this.type = null; /** * 图片属性 宽度 * @type {number} */ this.width = 0; }, /** * 好友 * @constructor */ Friendship: function () { /** * 主键 * @type {null} */ this.id = null; /** * 好友接受方ID * @type {null} */ this.receiveId = null; /** * 好友申请方ID * @type {null} */ this.sendId = null; /** * 好友关系状态 * @type {number} */ this.status = 0; /** * 好友关系状态 好友(1) * @type {number} */ SgtApi.entity.Friendship.prototype.FRIEND = 0; /** * 拒绝添加好友的状态(2) * @type {number} */ SgtApi.entity.Friendship.prototype.REFUSE = 0; /** * STATE_DELETE * @type {number} */ SgtApi.entity.Friendship.prototype.STATE_DELETE = 0; /** * 好友关系状态 未确认(0) * @type {number} */ SgtApi.entity.Friendship.prototype.UN_CONFIRM = 0; }, /** * 好友关系扩展 * @constructor */ FriendshipExtra: function () { /** * 扩展数据 * @type {null} */ this.extra = null; /** * 好友关系 * @type {null} */ this.friendship = null; /** * 角色信息 * @type {null} */ this.sgpPlayer = null; }, /** * 抽奖 * @constructor */ GachaBox: function () { /** * 连抽价格 * @type {number} */ this.continuousPrice = 0; /** * 描述 * @type {null} */ this.description = null; /** * 有效期,从yyyyMMddHHMM到yyyyMMddHHMM 精确到分钟 * @type {number} */ this.endValidTime = 0; /** * 主键 自增 * @type {number} */ this.id = 0; /** * 图片 * @type {null} */ this.img = null; /** * 初始品质,默认0 * @type {number} */ this.initQuality = 0; /** * 瞬时属性,保存该GachaBox下所有奖励 * @type {number} */ this.lotteries = null; /** * 最大限制品质,默认0不限制 * @type {number} */ this.maxQuality = 0; /** * 名称(同一服务器不能重复) * @type {null} */ this.name = null; /** * 价格 * @type {number} */ this.price = 0; /** * 有效期,从yyyyMMddHHMM到yyyyMMddHHMM 精确到分钟 * @type {number} */ this.startValidTime = 0; /** * 时间/人限制,为每个角色SgpPlayerId创建一个时间戳,在指定的时间区间内只能抽一次奖, 否则抛出异常,并且包含timeLimitErrorMsg * @type {number} */ this.timeLimit = 0; /** * 当用户满足时间/人限制时,抛出的异常中指定的信息 * @type {null} */ this.timeLimitErrorMsg = null; /** * 次数/人限制,为每个角色创建一个计数器,累计用户的总gacha次数,当小于该次数时不受影响, 否则抛出异常,并且包含totalLimitErrorMsg * @type {number} */ this.totalLimit = 0; /** * 当用户满足次数/人限制时,抛出的异常中指定的信息 * @type {null} */ this.totalLimitErrorMsg = null; /** * 类型 * @type {null} */ this.type = null; }, /** * * @constructor */ GachaBoxResult: function () { /** * * @type {null} */ this.prizes = null; /** * * @type {number} */ this.quality = 0; }, /** * 礼包、兑换码 * @constructor */ Gift: function () { /** * 兑换码集合key,可以是redis中的key * @type {null} */ this.codeId = null; /** * 生成的兑换码的前缀 * @type {null} */ this.codePrefix = null; /** * 礼包描述 * @type {null} */ this.description = null; /** * 兑换结束时间 * @type {number} */ this.endTime = 0; /** * 限制兑换级别 * @type {number} */ this.level = 0; /** * 邮件模板自定义ID * @type {null} */ this.mailTemplateCustomId = null; /** * 礼包名称 * @type {null} */ this.name = null; /** * 人均兑奖次数限制 * @type {number} */ this.redeemLimit = 0; /** * 奖品 * @type {null} */ this.reward = null; /** * 兑换开始时间 * @type {number} */ this.startTime = 0; /** * 主键 gift ID * @type {null} */ this.uuid = null; /** * VIP等级限制 * @type {number} */ this.vip = 0; }, /** * 礼包/兑换码 兑换记录 * @constructor */ GiftRecord: function () { /** * 兑换码 * @type {null} */ this.code = null; /** * 礼包ID * @type {null} */ this.giftId = null; /** * 角色ID * @type {null} */ this.playerId = null; /** * 兑奖时间 * @type {number} */ this.ticketTime = 0; /** * 主键UUID * @type {null} */ this.uuid = null; }, /** * 商城物品 * @constructor */ Item: function () { /** * 物品数量 * @type {number} */ this.amount = 0; /** * 自定义物品ID * @type {null} */ this.customId = null; /** * 物品描述 * @type {null} */ this.description = null; /** * 主键 * @type {number} */ this.id = 0; /** * 物品ID * @type {null} */ this.itemId = null; /** * 购买物品冷却时间(单位:秒),默认为0,表示可以连续购买 * @type {number} */ this.itemPurchaseCd = 0; /** * 最大购买次数 * @type {number} */ this.maxPurchanseTimes = 0; /** * 名称 * @type {null} */ this.name = null; /** * 其他,可以放一个json字符串 * @type {null} */ this.other = null; /** * 角色购买冷却时间(单位:秒) * @type {number} */ this.playerPurchaseCd = 0; /** * 价格 * @type {number} */ this.price = 0; /** * 价格单位 * @type {null} */ this.priceUnit = null; /** * 品质 * @type {number} */ this.quality = 0; /** * 状态 [禁用 0 启用 1] * @type {number} */ this.status = 0; /** * 商城ID,即商城的storeId字段值 * @type {null} */ this.storeId = null; /** * 物品类型 */ this.type = nul; /** * 权重 * @type {number} */ this.weight = 0; /** * 状态:禁用 * @type {number} */ SgtApi.entity.Item.prototype.DISABLED = 0; /** * 状态:启用 * @type {number} */ SgtApi.entity.Item.prototype.ENABLED = 0; /** * 物品类型:充值 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_CHARGE = null; /** * 物品类型:内容关卡 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_LEVEL = null; /** * 物品类型:默认货币 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_MONEY = null; /** * 物品类型:道具 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_PROPS = null; /** * 物品类型:复活 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_RESURRECTION = null; /** * 物品类型:VIP资格 * @type {null} */ SgtApi.entity.Item.prototype.TYPE_OF_VIP = null; /** * 价格单位:人民币 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_CN_YUAN = null; /** * 价格单位:钻石 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_DIAMOND = null; /** * 价格单位:金币 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_GOLDENCOIN = null; /** * 价格单位:日元 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_JP_YUAN = null; /** * 价格单位:默认货币 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_MONEY = null; /** * 价格单位:美元 * @type {null} */ SgtApi.entity.Item.prototype.UNIT_OF_US_DOLLAR = null; }, /** * 排行榜 * @constructor */ LeaderBoard: function () { /** * 活动ID * @type {null} */ this.activityId = null; /** * 主键 * @type {number} */ this.id = 0; /** * 自定义排行榜ID * @type {null} */ this.leaderId = null; /** * 名称 * @type {null} */ this.name = null; }, /** * 排行榜详情 * @constructor */ LeaderBoardScore: function () { /** * 排位 * @type {number} */ this.index = 0; /** * 角色信息 * @type {null} */ this.player = null; /** * 分数 * @type {number} */ this.score = 0; }, /** * 奖品 * @constructor */ Lottery: function () { /** * 修正值 * @type {number} */ this.balance = 0; /** * 主键 * @type {number} */ this.id = 0; /** * 奖品名称 * @type {null} */ this.name = null; /** * 奖品内容 * @type {null} */ this.prize = null; /** * 品质 * @type {number} */ this.quality = 0; /** * 关联的GachaBox id * @type {number} */ this.relatedGachaBox = 0; /** * 权值 * @type {number} */ this.weight = 0; }, /** * * @constructor */ MailsCollection: function () { /** * 已读邮件集合 * @type {null} */ this.readedMails = null; /** * 未读邮件集合 * @type {null} */ this.unreadMails = null; }, /** * 邮件模板 * @constructor */ MailTemplate: function () { /** * 附件 * @type {null} */ this.attachment = null; /** * 内容 * @type {null} */ this.content = null; /** * 自定义ID,用于关联 * @type {null} */ this.customId = null; /** * 模板说明 * @type {null} */ this.description = null; /** * id * @type {number} */ this.id = 0; /** * 标题 * @type {null} */ this.title = null; }, /** * 公共消息 * @constructor */ Message: function () { /** * 所属通道ID * @type {null} */ this.channelId = null; /** * 消息内容 * @type {null} */ this.content = null; /** * 消息创建时间 * @type {number} */ this.createTime = 0; /** * 主键 * @type {number} */ this.id = 0; /** * 消息标题 * @type {null} */ this.title = null; /** * 消息类型 * @type {null} */ this.type = null; }, /** * 用户商城购买记录 * @constructor */ Order: function () { /** * 订单总金额 * @type {number} */ this.aggregateAmount = 0; /** * 数量,默认为1 * @type {number} */ this.amounts = 1; /** * 应用ID * @type {null} */ this.appId = null; /** * 订单回调信息 * @type {null} */ this.callbackMessage = null; /** * customItemId * @type {null} */ this.customItemId = null; /** * 回调ID * @type {null} */ this.did = null; /** * 主键 * @type {number} */ this.id = 0; /** * 物品ID * @type {number} */ this.itemId = 0; /** * 角色ID * @type {null} */ this.playerId = null; /** * 购买时间 * @type {number} */ this.purchaseTime = 0; /** * 服务器ID * @type {null} */ this.serverId = null; /** * 结果 * @type {number} */ this.status = 0; /** * 商店ID * @type {null} */ this.storeId = null; /** * 交易中,如调用第三方计费接口还没有返回成功提示之前的状态 * @type {number} */ SgtApi.entity.Order.prototype.STATUS_OF_DEALING = 0; /** * 购买结果:异常 * @type {number} */ SgtApi.entity.Order.prototype.STATUS_OF_EXCEPTION = 0; /** * 购买结果:失败 * @type {number} */ SgtApi.entity.Order.prototype.STATUS_OF_FAILURE = 0; /** * 购买结果:成功 * @type {number} */ SgtApi.entity.Order.prototype.STATUS_OF_SUCESS = 0; }, /** * 角色扩展信息公共父类,所有开发者扩展的角色信息要么继承这个类,要么在自己的扩展类中添加playerId字段 * @constructor */ PlayerExtra: function () { /** * 角色ID,即sgpPlayerId * @type {null} */ this.playerId = null;