|
@@ -1,19 +1,21 @@
|
|
|
-import Gamecfg from "../../common/gameCfg";
|
|
|
-import { gameMethod } from "../../common/gameMethod";
|
|
|
-import { MailRwdAll, PlayerLoginPlayer, PlayerLoginPlayerPram, PlayerLoginUser, PlayerLoginUserPram } from "../../common/Xyc";
|
|
|
-import { SevBack } from "../../common/Xys";
|
|
|
-import Config from "../../Config";
|
|
|
-import { RedUtil } from "../../frameWork/fgui/RedUtil";
|
|
|
-import GameController from "../../GameController";
|
|
|
-import EventMng from "../../manager/EventMng";
|
|
|
-import ThinkingDataMgr from "../../utils/ThinkingDataMgr";
|
|
|
-import { GameEvent, LoadEvent } from "../const/EventConst";
|
|
|
-import { DayTipsKey, GameErrCode, PlatformType, ReportRoleType } from "../const/TypeConst";
|
|
|
-import GameDataCenter from "../GameDataCenter";
|
|
|
-import IDataModel from "./IDataModel";
|
|
|
+import Gamecfg from "../../../common/gameCfg";
|
|
|
+import { gameMethod } from "../../../common/gameMethod";
|
|
|
+import { MailRwdAll, PlayerLoginPlayer, PlayerLoginPlayerPram, PlayerLoginUser, PlayerLoginUserPram } from "../../../common/Xyc";
|
|
|
+import { SevBack } from "../../../common/Xys";
|
|
|
+import Config from "../../../Config";
|
|
|
+import GameController from "../../../GameController";
|
|
|
+import EventMng from "../../../manager/EventMng";
|
|
|
+import { ReqLogin } from "../../../shared/player/PtlLogin";
|
|
|
+import { ResLogin } from "../../../shared/user/PtlLogin";
|
|
|
+import ThinkingDataMgr from "../../../utils/ThinkingDataMgr";
|
|
|
+import { GameEvent, LoadEvent } from "../../const/EventConst";
|
|
|
+import { DayTipsKey, GameErrCode, PlatformType, ReportRoleType } from "../../const/TypeConst";
|
|
|
+import GameDataCenter from "../../GameDataCenter";
|
|
|
+import IDataModel from "../../../frameWork/model/IDataModel";
|
|
|
+import { LoginModelData } from "./LoginModelData";
|
|
|
|
|
|
|
|
|
-export default class LoginModel extends IDataModel {
|
|
|
+export default class LoginModel extends LoginModelData {
|
|
|
KEY_ACCOUNT = 'login';
|
|
|
KEY_POLICY = 'policy_agree';
|
|
|
KEY_LAST_LOGIN_TIME = 'KEY_LAST_LOGIN_TIME';
|
|
@@ -50,23 +52,36 @@ export default class LoginModel extends IDataModel {
|
|
|
return this.Query(this.KEY_ACCOUNT, '');
|
|
|
}
|
|
|
// 账号登录
|
|
|
- sendLoginGame(param: PlayerLoginPlayerPram) {
|
|
|
- this.sendLogin(PlayerLoginPlayer.url, param, (result: SevBack) => {
|
|
|
- if (result.type == 1) {
|
|
|
- EventMng.emit(GameEvent.LOGIN_ACCOUNT_SUCC);
|
|
|
- } else {
|
|
|
- if (gameMethod.isEmpty(result.win) || gameMethod.isEmpty(result.win.msgOut)) {
|
|
|
- GameDataCenter.plat.showErrDialog(GameErrCode.errGameLoginPlayer)
|
|
|
- EventMng.emit(GameEvent.LOGIN_ACCOUNT_FAIL);
|
|
|
+ async sendLoginGame(param: ReqLogin) {
|
|
|
+ let ret = await GameDataCenter.loginServer.ReqApi("player/Login", param);
|
|
|
+ if (ret.isSucc) {
|
|
|
+ CC_PREVIEW && console.log("玩家登录成功", ret);
|
|
|
+ for (let key in ret.res) {
|
|
|
+ if (typeof this[key] != "undefined") {
|
|
|
+ console.error("未定义字段!", key);
|
|
|
+ } else {
|
|
|
+ this[key] = ret.res[key]
|
|
|
}
|
|
|
}
|
|
|
- })
|
|
|
+ EventMng.emit(GameEvent.LOGIN_ACCOUNT_SUCC);
|
|
|
+ } else {
|
|
|
+ if (gameMethod.isEmpty(ret.err) || gameMethod.isEmpty(ret.err.message)) {
|
|
|
+ GameDataCenter.plat.showErrDialog(GameErrCode.errGameLoginPlayer)
|
|
|
+ EventMng.emit(GameEvent.LOGIN_ACCOUNT_FAIL);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 点击进入游戏按钮,并进入游戏
|
|
|
- sendEnterGame(sid: string) {
|
|
|
- // if (gameMethod.isEmpty(sid)) {
|
|
|
- // sid = GameDataCenter.sevBack.playerInfo.sid
|
|
|
+ async sendEnterGame(sid: string) {
|
|
|
+ // let ret = await GameDataCenter.loginServer.ReqApi("user/Login", {
|
|
|
+ // uid: GameDataCenter.sevBack.playerInfo.uid,
|
|
|
+ // sid: sid,
|
|
|
+ // token: GameDataCenter.sevBack.playerInfo.token
|
|
|
+ // });
|
|
|
+ // if (ret.isSucc) {
|
|
|
+
|
|
|
// }
|
|
|
+
|
|
|
let param: PlayerLoginUserPram = {
|
|
|
uid: GameDataCenter.sevBack.playerInfo.uid,
|
|
|
sid: sid,
|