Commit b493e6d140158bdac6f6d0184fa20f820f29d5d6
1 parent
570a4fa8
Exists in
master
提交新接口
Showing
4 changed files
with
62 additions
and
0 deletions
Show diff stats
src/HttpServer/logic/constdef.go
... | ... | @@ -6,6 +6,13 @@ var ( |
6 | 6 | ) |
7 | 7 | |
8 | 8 | const ( |
9 | + ENV_ENUM = 100 | |
10 | + LBASE64 = 1 | |
11 | + RESURL = "https://pck2d.miso-lab.com/" | |
12 | + VERSION_CONFIG = "version/v1.9.json" | |
13 | +) | |
14 | + | |
15 | +const ( | |
9 | 16 | FRIEND_MAX_NUM = 50 //好友人数上限 |
10 | 17 | FRIEND_APPLY_LIMIT = 50 //好友申请当日上限 |
11 | 18 | FRIEND_APPROVE_LIMIT = 50 //好友批准当日上限 | ... | ... |
src/HttpServer/logic/datadef.go
... | ... | @@ -148,6 +148,23 @@ type InviteWorkResp struct { |
148 | 148 | Result InviteWorkResult `json:"result"` |
149 | 149 | } |
150 | 150 | |
151 | +type InitIndexDesc struct { | |
152 | + Env_enum int `json:"env_enum"` | |
153 | + Lbase64 int `json:"lbase64"` | |
154 | + Res_url string `json:"res_url"` | |
155 | + Version_config string `json:"version_config"` | |
156 | +} | |
157 | + | |
158 | +type InitIndexResult struct { | |
159 | + Code int `json:"code"` | |
160 | + Data InitIndexDesc `json:"data"` | |
161 | +} | |
162 | + | |
163 | +type InitIndexResp struct { | |
164 | + Status string `json:"status"` | |
165 | + Result InitIndexResult `json:"result"` | |
166 | +} | |
167 | + | |
151 | 168 | |
152 | 169 | type SaveDataBackupReq struct{ |
153 | 170 | Uuid int `json:"uuid"` | ... | ... |
src/HttpServer/logic/httpserver.go
... | ... | @@ -80,6 +80,7 @@ func startServerHttpServe() { |
80 | 80 | http.HandleFunc("/catcafe/friend/handleFriendRequest", HandleFriendRequest) //处理好友请求 |
81 | 81 | http.HandleFunc("/catcafe/friend/delFriend", DelFriend) //删除好友 |
82 | 82 | http.HandleFunc("/catcafe/friend/QueryPlayerData", QueryPlayerData) //根据用户id获取用户信息 好友用 |
83 | + http.HandleFunc("/catcafe/env/index", InitIndex) // | |
83 | 84 | |
84 | 85 | //................................................................................................................... |
85 | 86 | http.HandleFunc("/catcafe/user/queryInvite", QueryInvite) //查询玩家对应邀请关系 |
... | ... | @@ -93,6 +94,18 @@ func startServerHttpServe() { |
93 | 94 | CheckErr(err) |
94 | 95 | } |
95 | 96 | |
97 | +func InitIndex(w http.ResponseWriter, r *http.Request) { | |
98 | + | |
99 | + result, _ := ioutil.ReadAll(r.Body) | |
100 | + r.Body.Close() | |
101 | + | |
102 | + s := string(result) | |
103 | + logger.Info("InitIndex , body:%v,uuid=%v", s) | |
104 | + | |
105 | + HandleInitIndex(w,s) | |
106 | +} | |
107 | + | |
108 | + | |
96 | 109 | func checkFileIsExist(filename string) bool { |
97 | 110 | var exist = true |
98 | 111 | if _, err := os.Stat(filename); os.IsNotExist(err) { | ... | ... |
src/HttpServer/logic/logic.go
... | ... | @@ -305,6 +305,31 @@ func HandleSaveDataBackup(w http.ResponseWriter, data string) { |
305 | 305 | fmt.Fprint(w, string(respstr)) |
306 | 306 | } |
307 | 307 | |
308 | + | |
309 | + | |
310 | +func HandleInitIndex(w http.ResponseWriter, data string) { | |
311 | + | |
312 | + SetHeader(w) | |
313 | + var resp InitIndexResp | |
314 | + resp.Status = "true" | |
315 | + | |
316 | + for { | |
317 | + | |
318 | + resp.Result.Data.Env_enum = ENV_ENUM | |
319 | + resp.Result.Data.Lbase64 = LBASE64 | |
320 | + resp.Result.Data.Res_url = RESURL | |
321 | + resp.Result.Data.Version_config = VERSION_CONFIG | |
322 | + | |
323 | + resp.Result.Code = ERROR_OK | |
324 | + break | |
325 | + } | |
326 | + | |
327 | + //回包 | |
328 | + respstr, _ := json.Marshal(&resp) | |
329 | + fmt.Fprint(w, string(respstr)) | |
330 | +} | |
331 | + | |
332 | + | |
308 | 333 | func HandleQueryInviteWork(w http.ResponseWriter, data string) { |
309 | 334 | |
310 | 335 | SetHeader(w) | ... | ... |