mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
update
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
import { app } from "../App";
|
||||
import { GUI } from "../ui/UIConfig";
|
||||
|
||||
const http = app.api;
|
||||
|
||||
const RData = (data:any) => {
|
||||
const RData = (data:any,isTips:boolean = true) => {
|
||||
if(data.data.state == 200){
|
||||
return data.data.data;
|
||||
}else{
|
||||
//弹出提示
|
||||
app.layer.Open(GUI.Tips,{text:data.data.msg});
|
||||
return null;
|
||||
if(isTips){
|
||||
app.layer.Open(GUI.Tips,{text:data.data.msg});
|
||||
}
|
||||
return data.data.data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,22 @@ export interface UserLoginVO{
|
||||
token:string, //token
|
||||
user:UserVO, //玩家信息
|
||||
}
|
||||
export interface PlayerInfoOV{
|
||||
playerId:number, //玩家Id
|
||||
userId: number, //用户Id
|
||||
playerName:string, //玩家名
|
||||
playerCreateTime:number, //玩家创建时间
|
||||
novice: false, //是否过引导
|
||||
}
|
||||
|
||||
export const API = {
|
||||
|
||||
UserRegister : async () => RData(await http.post(`/user/register`)) as UserVO, //玩家注册
|
||||
UserLogin : async (account:string,password:string) => RData(await http.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO, //玩家登录
|
||||
GetPlayerInfo : async () => (await http.get(`/game/player/info`)).data as NewsContext, //获取玩家信息
|
||||
UserRegister : async () => RData(await app.api.post(`/user/register`)) as UserVO, //玩家注册
|
||||
UserLogin : async (account:string,password:string) => RData(await app.api.post(`/user/login`,{userId:account,userPass:password})) as UserLoginVO, //玩家登录
|
||||
GetPlayerInfo : async () => RData(await app.api.get(`/game/player/info`),false) as NewsContext, //获取玩家信息
|
||||
|
||||
/********** 新手引导接口 *****************/
|
||||
SavePlayerInfo : async (playerName:string,novice:boolean = true) => (await app.api.post(`/game/player/info/save`,{playerName,novice})).data as NewsContext, //保存玩家信息
|
||||
|
||||
}
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
export enum GAction {
|
||||
|
||||
TOKEN_EXPIRED = 1001, //Token过期
|
||||
NOT_CREATE_PLAYER_INFO = 2001, //没有玩家信息 - 前往引导页面
|
||||
|
||||
}
|
@@ -23,6 +23,7 @@ export class StorageData {
|
||||
}
|
||||
|
||||
export const GData = {
|
||||
//层级
|
||||
layer: {
|
||||
World: 1,
|
||||
}
|
||||
|
Reference in New Issue
Block a user