diff --git a/src/HttpServer/logic/constdef.go b/src/HttpServer/logic/constdef.go index f60ea85..d9ae257 100644 --- a/src/HttpServer/logic/constdef.go +++ b/src/HttpServer/logic/constdef.go @@ -6,6 +6,13 @@ var ( ) const ( + ENV_ENUM = 100 + LBASE64 = 1 + RESURL = "https://pck2d.miso-lab.com/" + VERSION_CONFIG = "version/v1.9.json" +) + +const ( FRIEND_MAX_NUM = 50 //好友人数上限 FRIEND_APPLY_LIMIT = 50 //好友申请当日上限 FRIEND_APPROVE_LIMIT = 50 //好友批准当日上限 diff --git a/src/HttpServer/logic/datadef.go b/src/HttpServer/logic/datadef.go index b0e0f98..1c741f1 100644 --- a/src/HttpServer/logic/datadef.go +++ b/src/HttpServer/logic/datadef.go @@ -148,6 +148,23 @@ type InviteWorkResp struct { Result InviteWorkResult `json:"result"` } +type InitIndexDesc struct { + Env_enum int `json:"env_enum"` + Lbase64 int `json:"lbase64"` + Res_url string `json:"res_url"` + Version_config string `json:"version_config"` +} + +type InitIndexResult struct { + Code int `json:"code"` + Data InitIndexDesc `json:"data"` +} + +type InitIndexResp struct { + Status string `json:"status"` + Result InitIndexResult `json:"result"` +} + type SaveDataBackupReq struct{ Uuid int `json:"uuid"` diff --git a/src/HttpServer/logic/httpserver.go b/src/HttpServer/logic/httpserver.go index 057435a..a371fb7 100644 --- a/src/HttpServer/logic/httpserver.go +++ b/src/HttpServer/logic/httpserver.go @@ -80,6 +80,7 @@ func startServerHttpServe() { http.HandleFunc("/catcafe/friend/handleFriendRequest", HandleFriendRequest) //处理好友请求 http.HandleFunc("/catcafe/friend/delFriend", DelFriend) //删除好友 http.HandleFunc("/catcafe/friend/QueryPlayerData", QueryPlayerData) //根据用户id获取用户信息 好友用 + http.HandleFunc("/catcafe/env/index", InitIndex) // //................................................................................................................... http.HandleFunc("/catcafe/user/queryInvite", QueryInvite) //查询玩家对应邀请关系 @@ -93,6 +94,18 @@ func startServerHttpServe() { CheckErr(err) } +func InitIndex(w http.ResponseWriter, r *http.Request) { + + result, _ := ioutil.ReadAll(r.Body) + r.Body.Close() + + s := string(result) + logger.Info("InitIndex , body:%v,uuid=%v", s) + + HandleInitIndex(w,s) +} + + func checkFileIsExist(filename string) bool { var exist = true if _, err := os.Stat(filename); os.IsNotExist(err) { diff --git a/src/HttpServer/logic/logic.go b/src/HttpServer/logic/logic.go index b6736f2..07e3a37 100644 --- a/src/HttpServer/logic/logic.go +++ b/src/HttpServer/logic/logic.go @@ -305,6 +305,31 @@ func HandleSaveDataBackup(w http.ResponseWriter, data string) { fmt.Fprint(w, string(respstr)) } + + +func HandleInitIndex(w http.ResponseWriter, data string) { + + SetHeader(w) + var resp InitIndexResp + resp.Status = "true" + + for { + + resp.Result.Data.Env_enum = ENV_ENUM + resp.Result.Data.Lbase64 = LBASE64 + resp.Result.Data.Res_url = RESURL + resp.Result.Data.Version_config = VERSION_CONFIG + + resp.Result.Code = ERROR_OK + break + } + + //回包 + respstr, _ := json.Marshal(&resp) + fmt.Fprint(w, string(respstr)) +} + + func HandleQueryInviteWork(w http.ResponseWriter, data string) { SetHeader(w) -- libgit2 0.21.0