Commit 8c80e014ac78564ff021606b9d45da98ea6e569c

Authored by 陆恒
1 parent f032452a
Exists in master

增加聊天相关接口

src/HttpServer/logic/datadef.go
@@ -2,15 +2,15 @@ package logic @@ -2,15 +2,15 @@ package logic
2 2
3 //微信url定义 3 //微信url定义
4 const ( 4 const (
5 - URL_WEIXINMSG_CHECK = "https://api.weixin.qq.com/wxa/msg_sec_check" 5 + URL_WEIXINMSG_CHECK = "https://api.weixin.qq.com/wxa/msg_sec_check"
6 URL_WEIXINGETACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token" 6 URL_WEIXINGETACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token"
7 ) 7 )
8 8
9 //登录类型枚举 9 //登录类型枚举
10 const ( 10 const (
11 - LOGIN_TYPE_TOURIST = 1 //游客登录  
12 - LOGIN_TYPE_ACCOUNT = 2 //账号密码登录  
13 - LOGIN_TYPE_WECHAT = 3 //微信登录 11 + LOGIN_TYPE_TOURIST = 1 //游客登录
  12 + LOGIN_TYPE_ACCOUNT = 2 //账号密码登录
  13 + LOGIN_TYPE_WECHAT = 3 //微信登录
14 14
15 ) 15 )
16 16
@@ -20,88 +20,83 @@ type RedisTeamInfo struct { @@ -20,88 +20,83 @@ type RedisTeamInfo struct {
20 } 20 }
21 21
22 type WechatLoginReq struct { 22 type WechatLoginReq struct {
23 - Channel_id int `json:"channel_id"`  
24 - Invite_type int `json:"invite_type"`  
25 - Invite_res_id int `json:"invite_res_id"`  
26 - User_invite_uid int `json:"user_invite_uid"`  
27 - Code string `json:"code"`  
28 - Signature string `json:"signature"`  
29 - Iv string `json:"iv"`  
30 - Raw_data string `json:"raw_data"`  
31 - Encrypted_data string `json:"encrypted_data"`  
32 - Token string `json:"token"`  
33 - Version string `json:"version"` 23 + Channel_id int `json:"channel_id"`
  24 + Invite_type int `json:"invite_type"`
  25 + Invite_res_id int `json:"invite_res_id"`
  26 + User_invite_uid int `json:"user_invite_uid"`
  27 + Code string `json:"code"`
  28 + Signature string `json:"signature"`
  29 + Iv string `json:"iv"`
  30 + Raw_data string `json:"raw_data"`
  31 + Encrypted_data string `json:"encrypted_data"`
  32 + Token string `json:"token"`
  33 + Version string `json:"version"`
34 } 34 }
35 35
36 type UserLoginReq struct { 36 type UserLoginReq struct {
37 - Channel_id int `json:"channel_id"`  
38 - Invite_type int `json:"invite_type"`  
39 - Invite_res_id int `json:"invite_res_id"`  
40 - User_invite_uid int `json:"user_invite_uid"`  
41 - Scene int `json:"scene"`  
42 - RefAppId int `json:"refAppId"`  
43 - Code string `json:"code"`  
44 - Token string `json:"token"`  
45 - Version string `json:"version"`  
46 - 37 + Channel_id int `json:"channel_id"`
  38 + Invite_type int `json:"invite_type"`
  39 + Invite_res_id int `json:"invite_res_id"`
  40 + User_invite_uid int `json:"user_invite_uid"`
  41 + Scene int `json:"scene"`
  42 + RefAppId int `json:"refAppId"`
  43 + Code string `json:"code"`
  44 + Token string `json:"token"`
  45 + Version string `json:"version"`
47 } 46 }
48 47
49 type UserBaseData struct { 48 type UserBaseData struct {
50 - User_id int `json:"user_id"`  
51 - User_gender int `json:"user_gender"`  
52 - User_nickname string `json:"user_nickname"`  
53 - User_openid string `json:"user_openid"` 49 + User_id int `json:"user_id"`
  50 + User_gender int `json:"user_gender"`
  51 + User_nickname string `json:"user_nickname"`
  52 + User_openid string `json:"user_openid"`
54 User_avatar_url string `json:"user_avatar_url"` 53 User_avatar_url string `json:"user_avatar_url"`
55 - User_city string `json:"user_city"`  
56 - User_token string `json:"user_token"` 54 + User_city string `json:"user_city"`
  55 + User_token string `json:"user_token"`
57 } 56 }
58 57
59 type UserExtData struct { 58 type UserExtData struct {
60 - User_id int `json:"user_id"`  
61 - Hot int `json:"hot"`  
62 - Coin int64 `json:"coin"`  
63 - LoveExp int `json:"loveExp"`  
64 - Bean int `json:"bean"`  
65 - ShopNum int `json:"shopNum"`  
66 - Lv int `json:"lv"`  
67 - Exp int `json:"exp"`  
68 - User_invite_uid int `json:"user_invite_uid"`  
69 - User_reg_time int `json:"user_reg_time"`  
70 - User_channel int `json:"user_channel"`  
71 - User_is_black int `json:"user_is_black"`  
72 - User_scene int `json:"user_scene"`  
73 - Reg_time int `json:"reg_time"`  
74 - Invite_uid int `json:"invite_uid"` 59 + User_id int `json:"user_id"`
  60 + Hot int `json:"hot"`
  61 + Coin int64 `json:"coin"`
  62 + LoveExp int `json:"loveExp"`
  63 + Bean int `json:"bean"`
  64 + ShopNum int `json:"shopNum"`
  65 + Lv int `json:"lv"`
  66 + Exp int `json:"exp"`
  67 + User_invite_uid int `json:"user_invite_uid"`
  68 + User_reg_time int `json:"user_reg_time"`
  69 + User_channel int `json:"user_channel"`
  70 + User_is_black int `json:"user_is_black"`
  71 + User_scene int `json:"user_scene"`
  72 + Reg_time int `json:"reg_time"`
  73 + Invite_uid int `json:"invite_uid"`
75 } 74 }
76 75
77 type UserLoginData struct { 76 type UserLoginData struct {
78 Dasedata UserBaseData `json:"UserBaseData"` 77 Dasedata UserBaseData `json:"UserBaseData"`
79 - Extdata UserExtData `json:"user_ext_data"` 78 + Extdata UserExtData `json:"user_ext_data"`
80 } 79 }
81 80
82 type UserLoginResult struct { 81 type UserLoginResult struct {
83 - Code int `json:"code"` 82 + Code int `json:"code"`
84 Data UserLoginData `json:"data"` 83 Data UserLoginData `json:"data"`
85 } 84 }
86 85
87 -  
88 -  
89 type UserLoginResp struct { 86 type UserLoginResp struct {
90 - Status string `json:"status"` 87 + Status string `json:"status"`
91 Result UserLoginResult `json:"result"` 88 Result UserLoginResult `json:"result"`
92 -  
93 } 89 }
94 90
95 -  
96 -type QueryInviteReq struct{ 91 +type QueryInviteReq struct {
97 Uuid int `json:"uuid"` 92 Uuid int `json:"uuid"`
98 } 93 }
99 94
100 type QueryInviteData struct { 95 type QueryInviteData struct {
101 - Uuid int `json:"uuid"`  
102 - Nickname string `json:"nickname"`  
103 - Headurl string `json:"headurl"`  
104 - Isfetched int `json:"isfetched"` 96 + Uuid int `json:"uuid"`
  97 + Nickname string `json:"nickname"`
  98 + Headurl string `json:"headurl"`
  99 + Isfetched int `json:"isfetched"`
105 } 100 }
106 101
107 type QueryInviteDesc struct { 102 type QueryInviteDesc struct {
@@ -109,16 +104,43 @@ type QueryInviteDesc struct { @@ -109,16 +104,43 @@ type QueryInviteDesc struct {
109 } 104 }
110 105
111 type QueryInviteResult struct { 106 type QueryInviteResult struct {
112 - Code int `json:"code"` 107 + Code int `json:"code"`
113 Data QueryInviteDesc `json:"data"` 108 Data QueryInviteDesc `json:"data"`
114 } 109 }
115 110
116 type QueryInviteResp struct { 111 type QueryInviteResp struct {
117 - Status string `json:"status"` 112 + Status string `json:"status"`
118 Result QueryInviteResult `json:"result"` 113 Result QueryInviteResult `json:"result"`
119 } 114 }
120 115
121 -type QueryNewMessageReq struct{ 116 +type QueryBrifeMessageReq struct {
  117 + Uuid int `json:"uuid"`
  118 +}
  119 +
  120 +type QueryBrifeMessageData struct {
  121 + Uuid int `json:"uuid"`
  122 + Ctype int `json:"ctype"`
  123 + Isnew int `json:"isnew"`
  124 + Headurl string `json:"headurl"`
  125 + Nickname string `json:"nickname"`
  126 +}
  127 +
  128 +type QueryBrifeMessageDesc struct {
  129 + Emojinfo []int `json:"emojinfo"`
  130 + Channelinfo []QueryBrifeMessageData `json:"channelinfo"`
  131 +}
  132 +
  133 +type QueryBrifeMessageResult struct {
  134 + Code int `json:"code"`
  135 + Data QueryBrifeMessageDesc `json:"data"`
  136 +}
  137 +
  138 +type QueryBrifeMessageResp struct {
  139 + Status string `json:"status"`
  140 + Result QueryBrifeMessageResult `json:"result"`
  141 +}
  142 +
  143 +type QueryNewMessageReq struct {
122 Uuid int `json:"uuid"` 144 Uuid int `json:"uuid"`
123 } 145 }
124 146
@@ -127,152 +149,144 @@ type QueryNewMessageDesc struct { @@ -127,152 +149,144 @@ type QueryNewMessageDesc struct {
127 } 149 }
128 150
129 type QueryNewMessageResult struct { 151 type QueryNewMessageResult struct {
130 - Code int `json:"code"` 152 + Code int `json:"code"`
131 Data QueryNewMessageDesc `json:"data"` 153 Data QueryNewMessageDesc `json:"data"`
132 } 154 }
133 155
134 type QueryNewMessageResp struct { 156 type QueryNewMessageResp struct {
135 - Status string `json:"status"` 157 + Status string `json:"status"`
136 Result QueryNewMessageResult `json:"result"` 158 Result QueryNewMessageResult `json:"result"`
137 } 159 }
138 160
139 -  
140 -type InviteWorkReq struct{ 161 +type InviteWorkReq struct {
141 Uuid int `json:"uuid"` 162 Uuid int `json:"uuid"`
142 } 163 }
143 164
144 //邀请打工数据结构 165 //邀请打工数据结构
145 type InviteWorkDesc struct { 166 type InviteWorkDesc struct {
146 - Uuid int `json:"uuid"` //打工者ID  
147 - InviteTime int `json:"invitetime"`//开始打工时间  
148 - Nickname string `json:"nickname"`//昵称  
149 - HeadUrl string `json:"headurl"`//头像 167 + Uuid int `json:"uuid"` //打工者ID
  168 + InviteTime int `json:"invitetime"` //开始打工时间
  169 + Nickname string `json:"nickname"` //昵称
  170 + HeadUrl string `json:"headurl"` //头像
150 171
151 } 172 }
152 173
153 type InviteWorkOffDesc struct { 174 type InviteWorkOffDesc struct {
154 - Uuid int `json:"uuid"` //打工者ID  
155 - InviteTime int `json:"invitetime"` //打工者ID 175 + Uuid int `json:"uuid"` //打工者ID
  176 + InviteTime int `json:"invitetime"` //打工者ID
156 177
157 } 178 }
158 179
159 type InviteWorksDesc struct { 180 type InviteWorksDesc struct {
160 - Invite_data []InviteWorkDesc `json:"invite_data"` 181 + Invite_data []InviteWorkDesc `json:"invite_data"`
161 Offlinelist []InviteWorkOffDesc `json:"offlinelist"` 182 Offlinelist []InviteWorkOffDesc `json:"offlinelist"`
162 } 183 }
163 184
164 type InviteWorkResult struct { 185 type InviteWorkResult struct {
165 - Code int `json:"code"` 186 + Code int `json:"code"`
166 Data InviteWorksDesc `json:"data"` 187 Data InviteWorksDesc `json:"data"`
167 } 188 }
168 189
169 type InviteWorkResp struct { 190 type InviteWorkResp struct {
170 - Status string `json:"status"` 191 + Status string `json:"status"`
171 Result InviteWorkResult `json:"result"` 192 Result InviteWorkResult `json:"result"`
172 } 193 }
173 194
174 type InitIndexDesc struct { 195 type InitIndexDesc struct {
175 - Env_enum int `json:"env_enum"`  
176 - Lbase64 int `json:"lbase64"`  
177 - Res_url string `json:"res_url"`  
178 - Version_config string `json:"version_config"` 196 + Env_enum int `json:"env_enum"`
  197 + Lbase64 int `json:"lbase64"`
  198 + Res_url string `json:"res_url"`
  199 + Version_config string `json:"version_config"`
179 } 200 }
180 201
181 type InitIndexResult struct { 202 type InitIndexResult struct {
182 - Code int `json:"code"` 203 + Code int `json:"code"`
183 Data InitIndexDesc `json:"data"` 204 Data InitIndexDesc `json:"data"`
184 } 205 }
185 206
186 type InitIndexResp struct { 207 type InitIndexResp struct {
187 - Status string `json:"status"` 208 + Status string `json:"status"`
188 Result InitIndexResult `json:"result"` 209 Result InitIndexResult `json:"result"`
189 } 210 }
190 211
191 -  
192 -type SaveDataBackupReq struct{  
193 - Uuid int `json:"uuid"` 212 +type SaveDataBackupReq struct {
  213 + Uuid int `json:"uuid"`
194 Value string `json:"value"` 214 Value string `json:"value"`
195 } 215 }
196 216
197 -  
198 type SaveDataBackupResp struct { 217 type SaveDataBackupResp struct {
199 - Status string `json:"status"` 218 + Status string `json:"status"`
200 Result CommonResult `json:"result"` 219 Result CommonResult `json:"result"`
201 } 220 }
202 221
203 -  
204 -type FetchInviteReq struct{ 222 +type FetchInviteReq struct {
205 Selfuuid int `json:"selfuuid"` 223 Selfuuid int `json:"selfuuid"`
206 - Fuuid int `json:"fuuid"` 224 + Fuuid int `json:"fuuid"`
207 } 225 }
208 226
209 -  
210 type FetchInviteResp struct { 227 type FetchInviteResp struct {
211 - Status string `json:"status"` 228 + Status string `json:"status"`
212 Result CommonResult `json:"result"` 229 Result CommonResult `json:"result"`
213 } 230 }
214 231
215 -type EnterInviteReq struct{  
216 - Selfuuid int `json:"selfuuid"` 232 +type EnterInviteReq struct {
  233 + Selfuuid int `json:"selfuuid"`
217 Inviteuuid int `json:"inviteuuid"` 234 Inviteuuid int `json:"inviteuuid"`
218 Invitetype int `json:"invitetype"` 235 Invitetype int `json:"invitetype"`
219 } 236 }
220 237
221 -  
222 type EnterInviteResp struct { 238 type EnterInviteResp struct {
223 - Status string `json:"status"` 239 + Status string `json:"status"`
224 Result CommonResult `json:"result"` 240 Result CommonResult `json:"result"`
225 } 241 }
226 242
227 -  
228 -type RegeisterReq struct{  
229 - Account string `json:"account"` 243 +type RegeisterReq struct {
  244 + Account string `json:"account"`
230 Password string `json:"password"` 245 Password string `json:"password"`
231 } 246 }
232 247
233 type RegeisteraResp struct { 248 type RegeisteraResp struct {
234 - Status string `json:"status"` 249 + Status string `json:"status"`
235 Result CommonResult `json:"result"` 250 Result CommonResult `json:"result"`
236 } 251 }
237 252
238 -type AccounLoginReq struct{  
239 - Account string `json:"account"` 253 +type AccounLoginReq struct {
  254 + Account string `json:"account"`
240 Password string `json:"password"` 255 Password string `json:"password"`
241 } 256 }
242 257
243 type AccounLoginResp struct { 258 type AccounLoginResp struct {
244 - Status string `json:"status"` 259 + Status string `json:"status"`
245 Result UserLoginResult `json:"result"` 260 Result UserLoginResult `json:"result"`
246 } 261 }
247 262
248 -  
249 -type SaveUserDataReq struct{  
250 - Token string `json:"token"`  
251 - Hot int `json:"hot"`  
252 - Coin int64 `json:"coin"`  
253 - Loveexp int `json:"loveexp"`  
254 - Bean int `json:"bean"`  
255 - Shopnum int `json:"shopnum"` 263 +type SaveUserDataReq struct {
  264 + Token string `json:"token"`
  265 + Hot int `json:"hot"`
  266 + Coin int64 `json:"coin"`
  267 + Loveexp int `json:"loveexp"`
  268 + Bean int `json:"bean"`
  269 + Shopnum int `json:"shopnum"`
256 } 270 }
257 271
258 type SaveUserDataResp struct { 272 type SaveUserDataResp struct {
259 - Status string `json:"status"` 273 + Status string `json:"status"`
260 Result UserLoginResult `json:"result"` 274 Result UserLoginResult `json:"result"`
261 } 275 }
262 276
263 type CommonResult struct { 277 type CommonResult struct {
264 - Code int `json:"code"` 278 + Code int `json:"code"`
265 Data string `json:"data"` 279 Data string `json:"data"`
266 } 280 }
267 281
268 -type SaveDataReq struct{ 282 +type SaveDataReq struct {
269 Token string `json:"token"` 283 Token string `json:"token"`
270 Field string `json:"field"` 284 Field string `json:"field"`
271 Value string `json:"value"` 285 Value string `json:"value"`
272 } 286 }
273 287
274 type SaveDataResp struct { 288 type SaveDataResp struct {
275 - Status string `json:"status"` 289 + Status string `json:"status"`
276 Result CommonResult `json:"result"` 290 Result CommonResult `json:"result"`
277 } 291 }
278 292
@@ -281,32 +295,32 @@ type GetDataDesc struct { @@ -281,32 +295,32 @@ type GetDataDesc struct {
281 } 295 }
282 296
283 type GetDataResult struct { 297 type GetDataResult struct {
284 - Code int `json:"code"` 298 + Code int `json:"code"`
285 Data GetDataDesc `json:"data"` 299 Data GetDataDesc `json:"data"`
286 } 300 }
287 301
288 -type GetDataReq struct{  
289 - Uuid int `json:"uuid"` 302 +type GetDataReq struct {
  303 + Uuid int `json:"uuid"`
290 Field string `json:"field"` 304 Field string `json:"field"`
291 } 305 }
292 306
293 type GetDataResp struct { 307 type GetDataResp struct {
294 - Status string `json:"status"` 308 + Status string `json:"status"`
295 Result GetDataResult `json:"result"` 309 Result GetDataResult `json:"result"`
296 } 310 }
297 311
298 type GetDataSaveDesc struct { 312 type GetDataSaveDesc struct {
299 - Data_uid string `json:"data_uid"` 313 + Data_uid string `json:"data_uid"`
300 Data_value string `json:"data_value"` 314 Data_value string `json:"data_value"`
301 } 315 }
302 316
303 -type TextCheckReq struct{ 317 +type TextCheckReq struct {
304 Token string `json:"token"` 318 Token string `json:"token"`
305 - Text string `json:"text"` 319 + Text string `json:"text"`
306 } 320 }
307 321
308 type TextCheckResp struct { 322 type TextCheckResp struct {
309 - Status string `json:"status"` 323 + Status string `json:"status"`
310 Result CommonResult `json:"result"` 324 Result CommonResult `json:"result"`
311 } 325 }
312 326
@@ -316,71 +330,70 @@ type MsgCheckDesc struct { @@ -316,71 +330,70 @@ type MsgCheckDesc struct {
316 330
317 type MsgCheckResp struct { 331 type MsgCheckResp struct {
318 Errcode string `json:"errcode"` 332 Errcode string `json:"errcode"`
319 - Errmsg string `json:"errmsg"` 333 + Errmsg string `json:"errmsg"`
320 } 334 }
321 335
322 type GetAccessTokenResp struct { 336 type GetAccessTokenResp struct {
323 Access_token string `json:"access_token"` 337 Access_token string `json:"access_token"`
324 - Expires_in string `json:"expires_in"` 338 + Expires_in string `json:"expires_in"`
325 } 339 }
326 340
327 -  
328 -type CreateTeamReq struct{  
329 - Token string `json:"token"`  
330 - Name string `json:"name"`  
331 - Is_open int `json:"is_open"`  
332 - Limit int `json:"limit"` 341 +type CreateTeamReq struct {
  342 + Token string `json:"token"`
  343 + Name string `json:"name"`
  344 + Is_open int `json:"is_open"`
  345 + Limit int `json:"limit"`
333 } 346 }
334 347
335 //队伍列表人员id 348 //队伍列表人员id
336 type TeamMemInfo struct { 349 type TeamMemInfo struct {
337 - MemList []int 350 + MemList []int
338 } 351 }
339 352
340 //玩家投资信心 353 //玩家投资信心
341 type TeamDevoteInfo struct { 354 type TeamDevoteInfo struct {
342 - UserId int `json:"userid"`  
343 - Type int `json:"type"`  
344 - Assets int `json:"assets"` 355 + UserId int `json:"userid"`
  356 + Type int `json:"type"`
  357 + Assets int `json:"assets"`
345 } 358 }
346 359
347 //玩家buff 360 //玩家buff
348 type TeamBuffInfo struct { 361 type TeamBuffInfo struct {
349 - BeginTime int  
350 - EndTime int 362 + BeginTime int
  363 + EndTime int
351 } 364 }
352 365
353 // 366 //
354 type TeamAllBuff struct { 367 type TeamAllBuff struct {
355 - Type int 368 + Type int
356 BuffInfo []TeamBuffInfo 369 BuffInfo []TeamBuffInfo
357 } 370 }
358 371
359 //队伍建筑信息 372 //队伍建筑信息
360 type TeamBuildingInfo struct { 373 type TeamBuildingInfo struct {
361 Devote []TeamDevoteInfo 374 Devote []TeamDevoteInfo
362 - Buff []TeamAllBuff 375 + Buff []TeamAllBuff
363 } 376 }
364 377
365 type CreateTeamInfo struct { 378 type CreateTeamInfo struct {
366 - Id int `json:"id"`  
367 - Name string `json:"name"`  
368 - Is_open int `json:"is_open"`  
369 - Num int `json:"num"`  
370 - Assets int `json:"assets"`  
371 - Least int `json:"least"`  
372 - Captain_id int `json:"captain_id"`  
373 - Creator_id int `json:"creator_id"`  
374 - Status int `json:"status"`  
375 - Create_time int `json:"create_time"`  
376 - Update_time int `json:"update_time"` 379 + Id int `json:"id"`
  380 + Name string `json:"name"`
  381 + Is_open int `json:"is_open"`
  382 + Num int `json:"num"`
  383 + Assets int `json:"assets"`
  384 + Least int `json:"least"`
  385 + Captain_id int `json:"captain_id"`
  386 + Creator_id int `json:"creator_id"`
  387 + Status int `json:"status"`
  388 + Create_time int `json:"create_time"`
  389 + Update_time int `json:"update_time"`
377 } 390 }
378 391
379 //队伍信息 392 //队伍信息
380 type TeamInfo struct { 393 type TeamInfo struct {
381 BaseInfo CreateTeamInfo 394 BaseInfo CreateTeamInfo
382 - MemInfo TeamMemInfo  
383 - BInfo TeamBuildingInfo 395 + MemInfo TeamMemInfo
  396 + BInfo TeamBuildingInfo
384 } 397 }
385 398
386 type CreateTeamDesc struct { 399 type CreateTeamDesc struct {
@@ -388,53 +401,51 @@ type CreateTeamDesc struct { @@ -388,53 +401,51 @@ type CreateTeamDesc struct {
388 } 401 }
389 402
390 type CreateTeamData struct { 403 type CreateTeamData struct {
391 - Code int `json:"code"` 404 + Code int `json:"code"`
392 Data CreateTeamDesc `json:"data"` 405 Data CreateTeamDesc `json:"data"`
393 } 406 }
394 407
395 type CreateTeamResp struct { 408 type CreateTeamResp struct {
396 - Status string `json:"status"` 409 + Status string `json:"status"`
397 Result CreateTeamData `json:"result"` 410 Result CreateTeamData `json:"result"`
398 } 411 }
399 412
400 -  
401 -type JoinTeamReq struct{  
402 - Token string `json:"token"`  
403 - Team_id int `json:"team_id"` 413 +type JoinTeamReq struct {
  414 + Token string `json:"token"`
  415 + Team_id int `json:"team_id"`
404 } 416 }
405 417
406 type JoinTeamResp struct { 418 type JoinTeamResp struct {
407 - Status string `json:"status"` 419 + Status string `json:"status"`
408 Result CommonResult `json:"result"` 420 Result CommonResult `json:"result"`
409 } 421 }
410 422
411 -  
412 -type JoinTeamByInviteReq struct{  
413 - Token string `json:"token"`  
414 - Inviter_id int `json:"inviter_id"` 423 +type JoinTeamByInviteReq struct {
  424 + Token string `json:"token"`
  425 + Inviter_id int `json:"inviter_id"`
415 } 426 }
416 427
417 type JoinTeamByInviteResp struct { 428 type JoinTeamByInviteResp struct {
418 - Status string `json:"status"` 429 + Status string `json:"status"`
419 Result CommonResult `json:"result"` 430 Result CommonResult `json:"result"`
420 } 431 }
421 432
422 -type QuitTeamReq struct{  
423 - Token string `json:"token"`  
424 - User_id int `json:"user_id"`  
425 - Type int `json:"type"` 433 +type QuitTeamReq struct {
  434 + Token string `json:"token"`
  435 + User_id int `json:"user_id"`
  436 + Type int `json:"type"`
426 } 437 }
427 438
428 type QuitTeamResp struct { 439 type QuitTeamResp struct {
429 - Status string `json:"status"` 440 + Status string `json:"status"`
430 Result CommonResult `json:"result"` 441 Result CommonResult `json:"result"`
431 } 442 }
432 443
433 -type UpdateTeamBuildReq struct{  
434 - Token string `json:"token"`  
435 - Build_type int `json:"build_type"`  
436 - Assets int `json:"assets"`  
437 - Muti int `json:"muti"` 444 +type UpdateTeamBuildReq struct {
  445 + Token string `json:"token"`
  446 + Build_type int `json:"build_type"`
  447 + Assets int `json:"assets"`
  448 + Muti int `json:"muti"`
438 } 449 }
439 450
440 type QuitTeamDesc struct { 451 type QuitTeamDesc struct {
@@ -442,30 +453,28 @@ type QuitTeamDesc struct { @@ -442,30 +453,28 @@ type QuitTeamDesc struct {
442 } 453 }
443 454
444 type QuitTeamResult struct { 455 type QuitTeamResult struct {
445 - Code int `json:"code"` 456 + Code int `json:"code"`
446 Data QuitTeamDesc `json:"data"` 457 Data QuitTeamDesc `json:"data"`
447 } 458 }
448 459
449 type UpdateTeamBuildResp struct { 460 type UpdateTeamBuildResp struct {
450 - Status string `json:"status"` 461 + Status string `json:"status"`
451 Result QuitTeamResult `json:"result"` 462 Result QuitTeamResult `json:"result"`
452 } 463 }
453 464
454 -  
455 -  
456 -type AddTeamBuffReq struct{  
457 - Token string `json:"token"`  
458 - Build_type int `json:"build_type"`  
459 - Muti int `json:"muti"` 465 +type AddTeamBuffReq struct {
  466 + Token string `json:"token"`
  467 + Build_type int `json:"build_type"`
  468 + Muti int `json:"muti"`
460 } 469 }
461 470
462 type BuffTimeInfo struct { 471 type BuffTimeInfo struct {
463 Buff_begin_time int `json:"buff_begin_time"` 472 Buff_begin_time int `json:"buff_begin_time"`
464 - Buff_end_time int `json:"buff_end_time"` 473 + Buff_end_time int `json:"buff_end_time"`
465 } 474 }
466 475
467 type AddTeamBuffSpec struct { 476 type AddTeamBuffSpec struct {
468 - Build_type int `json:"build_type"` 477 + Build_type int `json:"build_type"`
469 Buff_time []BuffTimeInfo `json:"buff_time"` 478 Buff_time []BuffTimeInfo `json:"buff_time"`
470 } 479 }
471 480
@@ -474,25 +483,25 @@ type AddTeamBuffDesc struct { @@ -474,25 +483,25 @@ type AddTeamBuffDesc struct {
474 } 483 }
475 484
476 type AddTeamBuffResult struct { 485 type AddTeamBuffResult struct {
477 - Code int `json:"code"` 486 + Code int `json:"code"`
478 Data AddTeamBuffDesc `json:"data"` 487 Data AddTeamBuffDesc `json:"data"`
479 } 488 }
480 489
481 type AddTeamBuffResp struct { 490 type AddTeamBuffResp struct {
482 - Status string `json:"status"` 491 + Status string `json:"status"`
483 Result AddTeamBuffResult `json:"result"` 492 Result AddTeamBuffResult `json:"result"`
484 } 493 }
485 494
486 -type GetTeamBuffReq struct{ 495 +type GetTeamBuffReq struct {
487 Token string `json:"token"` 496 Token string `json:"token"`
488 } 497 }
489 498
490 type GetTeamBuffResp struct { 499 type GetTeamBuffResp struct {
491 - Status string `json:"status"` 500 + Status string `json:"status"`
492 Result AddTeamBuffResult `json:"result"` 501 Result AddTeamBuffResult `json:"result"`
493 } 502 }
494 503
495 -type GetTeamDataReq struct{ 504 +type GetTeamDataReq struct {
496 Token string `json:"token"` 505 Token string `json:"token"`
497 } 506 }
498 507
@@ -501,80 +510,78 @@ type GetTeamDataTeamUserList struct { @@ -501,80 +510,78 @@ type GetTeamDataTeamUserList struct {
501 } 510 }
502 511
503 type GetTeamDataDesc struct { 512 type GetTeamDataDesc struct {
504 - Team_data CreateTeamInfo `json:"team_data"` 513 + Team_data CreateTeamInfo `json:"team_data"`
505 Team_user_list []GetTeamDataTeamUserList `json:"team_user_list"` 514 Team_user_list []GetTeamDataTeamUserList `json:"team_user_list"`
506 - Build_list QuitTeamDesc `json:"build_list"` 515 + Build_list QuitTeamDesc `json:"build_list"`
507 } 516 }
508 517
509 type GetTeamDataResult struct { 518 type GetTeamDataResult struct {
510 - Code int `json:"code"` 519 + Code int `json:"code"`
511 Data GetTeamDataDesc `json:"data"` 520 Data GetTeamDataDesc `json:"data"`
512 } 521 }
513 522
514 type GetTeamDataResp struct { 523 type GetTeamDataResp struct {
515 - Status string `json:"status"` 524 + Status string `json:"status"`
516 Result GetTeamDataResult `json:"result"` 525 Result GetTeamDataResult `json:"result"`
517 } 526 }
518 527
519 -type GetDataByUserIdReq struct{  
520 - Token string `json:"token"`  
521 - Field string `json:"field"`  
522 - User_id int `json:"user_id"` 528 +type GetDataByUserIdReq struct {
  529 + Token string `json:"token"`
  530 + Field string `json:"field"`
  531 + User_id int `json:"user_id"`
523 } 532 }
524 533
525 type GetDataByUserIdDesc struct { 534 type GetDataByUserIdDesc struct {
526 - Base_data string `json:"base_data"` 535 + Base_data string `json:"base_data"`
527 User_base_data UserBaseData `json:"user_base_data"` 536 User_base_data UserBaseData `json:"user_base_data"`
528 - Extdata UserExtData `json:"user_ext_data"` 537 + Extdata UserExtData `json:"user_ext_data"`
529 } 538 }
530 539
531 type GetDataByUserIdResult struct { 540 type GetDataByUserIdResult struct {
532 - Code int `json:"code"` 541 + Code int `json:"code"`
533 Data GetDataByUserIdDesc `json:"data"` 542 Data GetDataByUserIdDesc `json:"data"`
534 } 543 }
535 544
536 type GetDataByUserIdResp struct { 545 type GetDataByUserIdResp struct {
537 - Status string `json:"status"` 546 + Status string `json:"status"`
538 Result GetDataByUserIdResult `json:"result"` 547 Result GetDataByUserIdResult `json:"result"`
539 } 548 }
540 549
541 -  
542 -type GetTeamListReq struct{  
543 - Token string `json:"token"`  
544 - Store_num int `json:"store_num"`  
545 - Page int `json:"page"` 550 +type GetTeamListReq struct {
  551 + Token string `json:"token"`
  552 + Store_num int `json:"store_num"`
  553 + Page int `json:"page"`
546 } 554 }
547 555
548 type GetTeamListDesc struct { 556 type GetTeamListDesc struct {
549 Items []int `json:"items"` 557 Items []int `json:"items"`
550 - Count int `json:"count"` 558 + Count int `json:"count"`
551 } 559 }
552 560
553 type GetTeamListResult struct { 561 type GetTeamListResult struct {
554 - Code int `json:"code"` 562 + Code int `json:"code"`
555 Data GetTeamListDesc `json:"data"` 563 Data GetTeamListDesc `json:"data"`
556 } 564 }
557 565
558 -  
559 type GetTeamListResp struct { 566 type GetTeamListResp struct {
560 - Status string `json:"status"` 567 + Status string `json:"status"`
561 Result GetTeamListResult `json:"result"` 568 Result GetTeamListResult `json:"result"`
562 } 569 }
563 570
564 -type SearchTeamReq struct{  
565 - Token string `json:"token"`  
566 - Name string `json:"name"`  
567 - Store_num int `json:"store_num"`  
568 - Page int `json:"page"` 571 +type SearchTeamReq struct {
  572 + Token string `json:"token"`
  573 + Name string `json:"name"`
  574 + Store_num int `json:"store_num"`
  575 + Page int `json:"page"`
569 } 576 }
570 577
571 type SearchTeamResp struct { 578 type SearchTeamResp struct {
572 - Status string `json:"status"` 579 + Status string `json:"status"`
573 Result GetTeamListResult `json:"result"` 580 Result GetTeamListResult `json:"result"`
574 } 581 }
575 582
576 type FriendInfo struct { 583 type FriendInfo struct {
577 - Uuid int `json:"uuid"` 584 + Uuid int `json:"uuid"`
578 Status int `json:"status"` 585 Status int `json:"status"`
579 } 586 }
580 587
@@ -583,7 +590,7 @@ type FriendList struct { @@ -583,7 +590,7 @@ type FriendList struct {
583 } 590 }
584 591
585 type ApplyInfo struct { 592 type ApplyInfo struct {
586 - Uuid int `json:"uuid"` 593 + Uuid int `json:"uuid"`
587 Apply_time int `json:"apply_time"` 594 Apply_time int `json:"apply_time"`
588 } 595 }
589 type ApplyList struct { 596 type ApplyList struct {
@@ -594,18 +601,17 @@ type ApproveList struct { @@ -594,18 +601,17 @@ type ApproveList struct {
594 Approve_info []ApplyInfo `json:"approve_info"` 601 Approve_info []ApplyInfo `json:"approve_info"`
595 } 602 }
596 603
597 -type SetFriendReq struct{  
598 - Token string `json:"token"`  
599 - User_id int `json:"user_id"` 604 +type SetFriendReq struct {
  605 + Token string `json:"token"`
  606 + User_id int `json:"user_id"`
600 } 607 }
601 608
602 -  
603 type SetFriendResp struct { 609 type SetFriendResp struct {
604 - Status string `json:"status"` 610 + Status string `json:"status"`
605 Result CommonResult `json:"result"` 611 Result CommonResult `json:"result"`
606 } 612 }
607 613
608 -type GetFriendListReq struct{ 614 +type GetFriendListReq struct {
609 Token string `json:"token"` 615 Token string `json:"token"`
610 } 616 }
611 617
@@ -614,17 +620,16 @@ type GetFriendListDesc struct { @@ -614,17 +620,16 @@ type GetFriendListDesc struct {
614 } 620 }
615 621
616 type GetFriendListResult struct { 622 type GetFriendListResult struct {
617 - Code int `json:"code"` 623 + Code int `json:"code"`
618 Data GetFriendListDesc `json:"data"` 624 Data GetFriendListDesc `json:"data"`
619 } 625 }
620 626
621 type GetFriendListResp struct { 627 type GetFriendListResp struct {
622 - Status string `json:"status"` 628 + Status string `json:"status"`
623 Result GetFriendListResult `json:"result"` 629 Result GetFriendListResult `json:"result"`
624 } 630 }
625 631
626 -  
627 -type GetAuditListReq struct{ 632 +type GetAuditListReq struct {
628 Token string `json:"token"` 633 Token string `json:"token"`
629 } 634 }
630 635
@@ -633,35 +638,34 @@ type GetAuditListDesc struct { @@ -633,35 +638,34 @@ type GetAuditListDesc struct {
633 } 638 }
634 639
635 type GetAuditListResult struct { 640 type GetAuditListResult struct {
636 - Code int `json:"code"` 641 + Code int `json:"code"`
637 Data GetAuditListDesc `json:"data"` 642 Data GetAuditListDesc `json:"data"`
638 } 643 }
639 644
640 type GetAuditListResp struct { 645 type GetAuditListResp struct {
641 - Status string `json:"status"` 646 + Status string `json:"status"`
642 Result GetAuditListResult `json:"result"` 647 Result GetAuditListResult `json:"result"`
643 } 648 }
644 649
645 -  
646 -type GetRecommendListReq struct{ 650 +type GetRecommendListReq struct {
647 Token string `json:"token"` 651 Token string `json:"token"`
648 } 652 }
649 653
650 type GetRecommendListInfo struct { 654 type GetRecommendListInfo struct {
651 - Userid int `json:"userid"`  
652 - Nickname string `json:"nickname"` 655 + Userid int `json:"userid"`
  656 + Nickname string `json:"nickname"`
653 Avatar_url string `json:"avatar_url"` 657 Avatar_url string `json:"avatar_url"`
654 - Gender int `json:"gender"`  
655 - City string `json:"city"`  
656 - Hot int `json:"hot"`  
657 - Coin int64 `json:"coin"`  
658 - Love_exp int `json:"love_exp"`  
659 - Bean int `json:"bean"`  
660 - Shop_num int `json:"shop_num"` 658 + Gender int `json:"gender"`
  659 + City string `json:"city"`
  660 + Hot int `json:"hot"`
  661 + Coin int64 `json:"coin"`
  662 + Love_exp int `json:"love_exp"`
  663 + Bean int `json:"bean"`
  664 + Shop_num int `json:"shop_num"`
661 Cat_num int `json:"cat_num"` 665 Cat_num int `json:"cat_num"`
662 - Lv int `json:"lv"`  
663 - Exp int `json:"exp"`  
664 - Reg_time int `json:"reg_time"` 666 + Lv int `json:"lv"`
  667 + Exp int `json:"exp"`
  668 + Reg_time int `json:"reg_time"`
665 } 669 }
666 670
667 type GetRecommendListDesc struct { 671 type GetRecommendListDesc struct {
@@ -669,42 +673,39 @@ type GetRecommendListDesc struct { @@ -669,42 +673,39 @@ type GetRecommendListDesc struct {
669 } 673 }
670 674
671 type GetRecommendListResult struct { 675 type GetRecommendListResult struct {
672 - Code int `json:"code"` 676 + Code int `json:"code"`
673 Data GetRecommendListDesc `json:"data"` 677 Data GetRecommendListDesc `json:"data"`
674 } 678 }
675 679
676 type GetRecommendListResp struct { 680 type GetRecommendListResp struct {
677 - Status string `json:"status"` 681 + Status string `json:"status"`
678 Result GetRecommendListResult `json:"result"` 682 Result GetRecommendListResult `json:"result"`
679 } 683 }
680 684
681 -  
682 -type HandleFriendRequestReq struct{  
683 - Token string `json:"token"`  
684 - User_id int `json:"user_id"`  
685 - Type int `json:"type"` 685 +type HandleFriendRequestReq struct {
  686 + Token string `json:"token"`
  687 + User_id int `json:"user_id"`
  688 + Type int `json:"type"`
686 } 689 }
687 690
688 -  
689 type HandleFriendRequestResp struct { 691 type HandleFriendRequestResp struct {
690 - Status string `json:"status"` 692 + Status string `json:"status"`
691 Result CommonResult `json:"result"` 693 Result CommonResult `json:"result"`
692 } 694 }
693 695
694 -type DelFriendReq struct{  
695 - Token string `json:"token"`  
696 - User_id int `json:"user_id"` 696 +type DelFriendReq struct {
  697 + Token string `json:"token"`
  698 + User_id int `json:"user_id"`
697 } 699 }
698 700
699 -  
700 type DelFriendResp struct { 701 type DelFriendResp struct {
701 - Status string `json:"status"` 702 + Status string `json:"status"`
702 Result CommonResult `json:"result"` 703 Result CommonResult `json:"result"`
703 } 704 }
704 705
705 -type QueryPlayerDataReq struct{  
706 - Token string `json:"token"`  
707 - User_id int `json:"user_id"` 706 +type QueryPlayerDataReq struct {
  707 + Token string `json:"token"`
  708 + User_id int `json:"user_id"`
708 } 709 }
709 710
710 type QueryPlayerDataDesc struct { 711 type QueryPlayerDataDesc struct {
@@ -712,64 +713,58 @@ type QueryPlayerDataDesc struct { @@ -712,64 +713,58 @@ type QueryPlayerDataDesc struct {
712 } 713 }
713 714
714 type QueryPlayerDataResult struct { 715 type QueryPlayerDataResult struct {
715 - Code int `json:"code"` 716 + Code int `json:"code"`
716 Data QueryPlayerDataDesc `json:"data"` 717 Data QueryPlayerDataDesc `json:"data"`
717 } 718 }
718 719
719 type QueryPlayerDataResp struct { 720 type QueryPlayerDataResp struct {
720 - Status string `json:"status"` 721 + Status string `json:"status"`
721 Result QueryPlayerDataResult `json:"result"` 722 Result QueryPlayerDataResult `json:"result"`
722 } 723 }
723 724
724 //********************************************************************************************************** 725 //**********************************************************************************************************
725 726
726 -  
727 -  
728 -  
729 //玩家数据 727 //玩家数据
730 type UserData struct { 728 type UserData struct {
731 - Userid int //玩家id  
732 - Hot int  
733 - Coin int64 //金币  
734 - Loevexp int  
735 - Bean int //咖啡豆  
736 - Shopnum int //店铺数量  
737 - Lv int  
738 - Exp int  
739 - UserInviteId int  
740 - Userregtime int  
741 - Channel int  
742 - Isblack int  
743 - Scene int  
744 - Regtime int  
745 - InviteUid int  
746 - LoginTime int  
747 - LoginDay int 729 + Userid int //玩家id
  730 + Hot int
  731 + Coin int64 //金币
  732 + Loevexp int
  733 + Bean int //咖啡豆
  734 + Shopnum int //店铺数量
  735 + Lv int
  736 + Exp int
  737 + UserInviteId int
  738 + Userregtime int
  739 + Channel int
  740 + Isblack int
  741 + Scene int
  742 + Regtime int
  743 + InviteUid int
  744 + LoginTime int
  745 + LoginDay int
748 } 746 }
749 747
750 //--------------------------------------------------------------------------------------------------------------------- 748 //---------------------------------------------------------------------------------------------------------------------
751 //聊天相关 749 //聊天相关
752 type ChatInfoDesc struct { 750 type ChatInfoDesc struct {
753 - Uuid int `json:"uuid"`  
754 - Headurl string `json:"headurl"`  
755 - Nickname string `json:"nickname"`  
756 - Sex int `json:"sex"` //1男0女  
757 - ChatTime int `json:"chattime"` 751 + Uuid int `json:"uuid"`
  752 + Headurl string `json:"headurl"`
  753 + Nickname string `json:"nickname"`
  754 + Sex int `json:"sex"` //1男0女
  755 + ChatTime int `json:"chattime"`
758 Message string `json:"message"` 756 Message string `json:"message"`
759 -  
760 } 757 }
761 758
762 //聊天单个页签信息 759 //聊天单个页签信息
763 -type ChatRoomInfo struct {  
764 - Chats []ChatInfoDesc `json:"chats"`  
765 - Pos int `json:"pos"`  
766 - Isnew int `json:"isnew"` //是否有新聊天 760 +type ChannelInfo struct {
  761 + Uuid int `json:"uuid"`
  762 + Ctype int `json:"ctype"`
  763 + Isnew int `json:"isnew"` //是否有新聊天
  764 + Headurl string `json:"headurl"`
  765 + Nickname string `json:"nickname"`
767 } 766 }
768 767
769 -type ChatRoomInfos []ChatRoomInfo  
770 -  
771 -type ChatMessagesInfo struct {  
772 - World ChatRoomInfo `json:"world"`  
773 - Team ChatRoomInfo `json:"team"`  
774 - Private ChatRoomInfos `json:"privete"`  
775 -}  
776 \ No newline at end of file 768 \ No newline at end of file
  769 +type EmojunlockInfo struct {
  770 + Emojinfo []int `json:"emojinfo"`
  771 +}
src/HttpServer/logic/function.go
@@ -886,8 +886,20 @@ func QueryUserTeamId(uuid int) (int, error) { @@ -886,8 +886,20 @@ func QueryUserTeamId(uuid int) (int, error) {
886 return tmp.Team_id, nil 886 return tmp.Team_id, nil
887 } 887 }
888 888
889 -func CheckHasNewMessage(uuid int) (bool, error) {  
890 - //首先检查工会记录 889 +func GetChatEmojInfo(uuid int) []int {
  890 + var tmp EmojunlockInfo
  891 + vv, err := redishandler.GetRedisClient().HGet(redis.USER_CHAT_EMOJUNLOCK_KEY, strconv.Itoa(uuid))
  892 + if err != nil {
  893 + return nil
  894 + }
  895 + err = json.Unmarshal([]byte(vv), &tmp)
  896 + if err != nil {
  897 + return nil
  898 + }
  899 + return tmp.Emojinfo
  900 +}
  901 +
  902 +func CheckTeamHasNewMessage(uuid int) (bool, error) {
891 lastteamsec := 0 903 lastteamsec := 0
892 lastchatteamsec := 0 904 lastchatteamsec := 0
893 laststr, err := redishandler.GetRedisClient().HGet(redis.USER_CHAT_TEAM_LASTGET_KEY, strconv.Itoa(uuid)) 905 laststr, err := redishandler.GetRedisClient().HGet(redis.USER_CHAT_TEAM_LASTGET_KEY, strconv.Itoa(uuid))
@@ -920,6 +932,89 @@ func CheckHasNewMessage(uuid int) (bool, error) { @@ -920,6 +932,89 @@ func CheckHasNewMessage(uuid int) (bool, error) {
920 redishandler.GetRedisClient().HSet(redis.USER_CHAT_ISNEW, strconv.Itoa(uuid), "1") 932 redishandler.GetRedisClient().HSet(redis.USER_CHAT_ISNEW, strconv.Itoa(uuid), "1")
921 return true, nil 933 return true, nil
922 } 934 }
  935 + return false, nil
  936 +}
  937 +
  938 +func GetPrivateBriefList(uuid int) []QueryBrifeMessageData {
  939 + var rtsl []QueryBrifeMessageData
  940 + var talklistuid []int //所有的聊天列表
  941 + var nonewmesslist []int //没有新消息的列表
  942 + rselfkey := redis.USER_CHAT_PRIVATE_LASTGET_KEY + ":" + strconv.Itoa(uuid)
  943 + vv, err := redishandler.GetRedisClient().HGetAllKeys(rselfkey)
  944 + if err != nil {
  945 + logger.Error("GetPrivateBriefList failed err=%v", err)
  946 + return nil
  947 + }
  948 +
  949 + for _, val := range vv {
  950 + bytestr := string(val.([]byte))
  951 + bytenum, _ := strconv.Atoi(bytestr)
  952 + talklistuid = append(talklistuid, bytenum)
  953 + }
  954 +
  955 + for _, val := range talklistuid {
  956 + selfgetsec := 0
  957 + selftalksec := 0
  958 + rkeysselfs := redis.USER_CHAT_PRIVATE_INFO_KEY + ":" + strconv.Itoa(uuid) + ":" + strconv.Itoa(val)
  959 + tmpstr, err := redishandler.GetRedisClient().HGet(rselfkey, strconv.Itoa(uuid))
  960 + if err == nil {
  961 + selfgetsec, _ = strconv.Atoi(tmpstr)
  962 + }
  963 +
  964 + //查询最后一条记录
  965 + cselfstr, err := redishandler.GetRedisClient().LIndex(rkeysselfs, 0)
  966 + if err == nil {
  967 + var chats ChatInfoDesc
  968 + err = json.Unmarshal([]byte(cselfstr), &chats)
  969 + if err == nil {
  970 + selftalksec = chats.ChatTime
  971 + }
  972 + }
  973 +
  974 + if selfgetsec < selftalksec {
  975 + var tmp QueryBrifeMessageData
  976 + tmp.Uuid = val
  977 + tmp.Isnew = 1
  978 + tmp.Ctype = 2
  979 + heads, names, err := mysql.QueryNameAndHead(val)
  980 + if err != nil {
  981 + logger.Error("GetPrivateBriefList err=%v", err)
  982 + }
  983 + tmp.Nickname = names
  984 + tmp.Headurl = heads
  985 + rtsl = append(rtsl, tmp)
  986 + } else {
  987 + nonewmesslist = append(nonewmesslist, val)
  988 + }
  989 + }
  990 +
  991 + //如果没有满五个 则从没有新消息的列表取获取
  992 + for _, val := range nonewmesslist {
  993 + if len(rtsl) >= 5 {
  994 + break
  995 + }
  996 +
  997 + var tmp QueryBrifeMessageData
  998 + tmp.Uuid = val
  999 + tmp.Isnew = 0
  1000 + tmp.Ctype = 2
  1001 + heads, names, err := mysql.QueryNameAndHead(val)
  1002 + if err != nil {
  1003 + logger.Error("GetPrivateBriefList err=%v", err)
  1004 + }
  1005 + tmp.Nickname = names
  1006 + tmp.Headurl = heads
  1007 + rtsl = append(rtsl, tmp)
  1008 + }
  1009 + return rtsl
  1010 +}
  1011 +
  1012 +func CheckHasNewMessage(uuid int) (bool, error) {
  1013 + //首先检查工会记录
  1014 + isnew, err := CheckTeamHasNewMessage(uuid)
  1015 + if err == nil && isnew {
  1016 + return true, nil
  1017 + }
923 1018
924 //判断自己的私人聊天记录 1019 //判断自己的私人聊天记录
925 var talklistuid []int 1020 var talklistuid []int
src/HttpServer/logic/httpserver.go
@@ -27,8 +27,9 @@ func StartHttpServe() { @@ -27,8 +27,9 @@ func StartHttpServe() {
27 type TestTes struct { 27 type TestTes struct {
28 TestInt int 28 TestInt int
29 } 29 }
  30 +
30 //just for test 31 //just for test
31 -func (d *TestTes)Testsendhttp() { 32 +func (d *TestTes) Testsendhttp() {
32 d.TestInt = 99 33 d.TestInt = 99
33 } 34 }
34 35
@@ -43,62 +44,72 @@ func startServerHttpServe() { @@ -43,62 +44,72 @@ func startServerHttpServe() {
43 //recover() //可以打印panic的错误信息 44 //recover() //可以打印panic的错误信息
44 //fmt.Println(recover()) 45 //fmt.Println(recover())
45 if err := recover(); err != nil { //产生了panic异常 46 if err := recover(); err != nil { //产生了panic异常
46 - logger.Error("%v",err) 47 + logger.Error("%v", err)
47 } 48 }
48 49
49 }() //别忘了(), 调用此匿名函数 50 }() //别忘了(), 调用此匿名函数
50 51
51 //------------------------------------------------------------- 52 //-------------------------------------------------------------
52 - http.HandleFunc("/catcafe/ClearData", ClearData) //情况账号的测试接口  
53 - http.HandleFunc("/catcafe/AddWhiteList", AddWhiteList) //情况账号的测试接口  
54 - http.HandleFunc("/catcafe/AddGoldAndLove", AddGoldAndLove) //情况账号的测试接口  
55 - http.HandleFunc("/catcafe/QueryAllAccount", QueryAllAccount) //查询所有账号的等级信息等数据 53 + http.HandleFunc("/catcafe/ClearData", ClearData) //情况账号的测试接口
  54 + http.HandleFunc("/catcafe/AddWhiteList", AddWhiteList) //情况账号的测试接口
  55 + http.HandleFunc("/catcafe/AddGoldAndLove", AddGoldAndLove) //情况账号的测试接口
  56 + http.HandleFunc("/catcafe/QueryAllAccount", QueryAllAccount) //查询所有账号的等级信息等数据
56 //------------------------------------------------------------- 57 //-------------------------------------------------------------
57 - http.HandleFunc("/catcafe/login", UserLogin) //游客登录  
58 - http.HandleFunc("/catcafe/user/regeister", Regeister) //账号注册  
59 - http.HandleFunc("/catcafe/user/accountlogin", AccounLogin) //账号登录  
60 - http.HandleFunc("/catcafe/user/weakLogin", Wechatlogin) //微信登录  
61 - http.HandleFunc("/catcafe/user/saveUserData", SaveUserData) //保存用户数据  
62 - http.HandleFunc("/catcafe/data/saveData", SaveData) //保存游戏自定义数据  
63 - http.HandleFunc("/catcafe/data/getData", GetData) //获取自定义数据  
64 - http.HandleFunc("/catcafe/team/textCheck", TextCheck) //敏感词检测  
65 - http.HandleFunc("/catcafe/team/createTeam", CreateTeam) //创建队伍  
66 - http.HandleFunc("/catcafe/team/updateTeamData", UpdateTeamData) //修改队伍信息  
67 - http.HandleFunc("/catcafe/team/joinTeam", JoinTeam) //主动加入队伍  
68 - http.HandleFunc("/catcafe/team/joinTeamByInvite", JoinTeamByInvite) //被邀请加入队伍  
69 - http.HandleFunc("/catcafe/team/quitTeam", QuitTeam) //被邀请加入队伍  
70 - http.HandleFunc("/catcafe/team/updateTeamBuild", UpdateTeamBuild) //升级队伍建筑等级  
71 - http.HandleFunc("/catcafe/team/addTeamBuff", AddTeamBuff) //添加BUFF时间  
72 - http.HandleFunc("/catcafe/team/getTeamBuff", GetTeamBuff) //获取BUFF时间  
73 - http.HandleFunc("/catcafe/team/getTeamData", GetTeamData) //获取玩家队伍信息  
74 - http.HandleFunc("/catcafe/team/getDataByUserId", GetDataByUserId) //获取队伍成员的详细数据  
75 - http.HandleFunc("/catcafe/team/getTeamList", GetTeamList) //查询队伍列表  
76 - http.HandleFunc("/catcafe/team/searchTeam", SearchTeam) //根据名称搜索队伍  
77 - http.HandleFunc("/catcafe/friend/setFriendRequest", SetFriendRequest) //申请添加好友  
78 - http.HandleFunc("/catcafe/friend/getList", GetFriendList) //获取好友列表  
79 - http.HandleFunc("/catcafe/friend/getAuditList", GetAuditList) //获取待审核好友列表  
80 - http.HandleFunc("/catcafe/friend/getRecommendList", GetRecommendList) //获取推荐好友列表  
81 - http.HandleFunc("/catcafe/friend/handleFriendRequest", HandleFriendRequest) //处理好友请求  
82 - http.HandleFunc("/catcafe/friend/delFriend", DelFriend) //删除好友  
83 - http.HandleFunc("/catcafe/friend/QueryPlayerData", QueryPlayerData) //根据用户id获取用户信息 好友用 58 + http.HandleFunc("/catcafe/login", UserLogin) //游客登录
  59 + http.HandleFunc("/catcafe/user/regeister", Regeister) //账号注册
  60 + http.HandleFunc("/catcafe/user/accountlogin", AccounLogin) //账号登录
  61 + http.HandleFunc("/catcafe/user/weakLogin", Wechatlogin) //微信登录
  62 + http.HandleFunc("/catcafe/user/saveUserData", SaveUserData) //保存用户数据
  63 + http.HandleFunc("/catcafe/data/saveData", SaveData) //保存游戏自定义数据
  64 + http.HandleFunc("/catcafe/data/getData", GetData) //获取自定义数据
  65 + http.HandleFunc("/catcafe/team/textCheck", TextCheck) //敏感词检测
  66 + http.HandleFunc("/catcafe/team/createTeam", CreateTeam) //创建队伍
  67 + http.HandleFunc("/catcafe/team/updateTeamData", UpdateTeamData) //修改队伍信息
  68 + http.HandleFunc("/catcafe/team/joinTeam", JoinTeam) //主动加入队伍
  69 + http.HandleFunc("/catcafe/team/joinTeamByInvite", JoinTeamByInvite) //被邀请加入队伍
  70 + http.HandleFunc("/catcafe/team/quitTeam", QuitTeam) //被邀请加入队伍
  71 + http.HandleFunc("/catcafe/team/updateTeamBuild", UpdateTeamBuild) //升级队伍建筑等级
  72 + http.HandleFunc("/catcafe/team/addTeamBuff", AddTeamBuff) //添加BUFF时间
  73 + http.HandleFunc("/catcafe/team/getTeamBuff", GetTeamBuff) //获取BUFF时间
  74 + http.HandleFunc("/catcafe/team/getTeamData", GetTeamData) //获取玩家队伍信息
  75 + http.HandleFunc("/catcafe/team/getDataByUserId", GetDataByUserId) //获取队伍成员的详细数据
  76 + http.HandleFunc("/catcafe/team/getTeamList", GetTeamList) //查询队伍列表
  77 + http.HandleFunc("/catcafe/team/searchTeam", SearchTeam) //根据名称搜索队伍
  78 + http.HandleFunc("/catcafe/friend/setFriendRequest", SetFriendRequest) //申请添加好友
  79 + http.HandleFunc("/catcafe/friend/getList", GetFriendList) //获取好友列表
  80 + http.HandleFunc("/catcafe/friend/getAuditList", GetAuditList) //获取待审核好友列表
  81 + http.HandleFunc("/catcafe/friend/getRecommendList", GetRecommendList) //获取推荐好友列表
  82 + http.HandleFunc("/catcafe/friend/handleFriendRequest", HandleFriendRequest) //处理好友请求
  83 + http.HandleFunc("/catcafe/friend/delFriend", DelFriend) //删除好友
  84 + http.HandleFunc("/catcafe/friend/QueryPlayerData", QueryPlayerData) //根据用户id获取用户信息 好友用
84 http.HandleFunc("/catcafe/env/index", InitIndex) // 85 http.HandleFunc("/catcafe/env/index", InitIndex) //
85 86
86 //................................................................................................................... 87 //...................................................................................................................
87 - http.HandleFunc("/catcafe/user/queryInvite", QueryInvite) //查询玩家对应邀请关系  
88 - http.HandleFunc("/catcafe/user/fetchInviteReward",FetchInviteReward) //领取邀请奖励  
89 - http.HandleFunc("/catcafe/user/enterInvite",EnterInvite) //别的玩家(新玩家)通过邀请连接进来  
90 - http.HandleFunc("/catcafe/user/queryInviteWork",QueryInviteWork) //获取邀请打工列表  
91 - http.HandleFunc("/catcafe/user/saveDataBackup",SaveDataBackup) //保存玩家数据 备份数据接口  
92 - http.HandleFunc("/catcafe/user/newGetData",NewGetData) //新的获取玩家数据接口  
93 - http.HandleFunc("/catcafe/user/newSaveData",NewSaveData) //新的保存玩家数据接口  
94 -  
95 - http.HandleFunc("/catcafe/chat/queryNewMessage",queryNewMessage) //查询红点请求 88 + http.HandleFunc("/catcafe/user/queryInvite", QueryInvite) //查询玩家对应邀请关系
  89 + http.HandleFunc("/catcafe/user/fetchInviteReward", FetchInviteReward) //领取邀请奖励
  90 + http.HandleFunc("/catcafe/user/enterInvite", EnterInvite) //别的玩家(新玩家)通过邀请连接进来
  91 + http.HandleFunc("/catcafe/user/queryInviteWork", QueryInviteWork) //获取邀请打工列表
  92 + http.HandleFunc("/catcafe/user/saveDataBackup", SaveDataBackup) //保存玩家数据 备份数据接口
  93 + http.HandleFunc("/catcafe/user/newGetData", NewGetData) //新的获取玩家数据接口
  94 + http.HandleFunc("/catcafe/user/newSaveData", NewSaveData) //新的保存玩家数据接口
96 95
  96 + http.HandleFunc("/catcafe/chat/queryNewMessage", queryNewMessage) //查询红点请求
  97 + http.HandleFunc("/catcafe/chat/queryBrifeMessage", queryBrifeMessage) //获取聊天页签请求
97 98
98 err := http.ListenAndServe(conf.GetServerHttpAddrConf(), nil) 99 err := http.ListenAndServe(conf.GetServerHttpAddrConf(), nil)
99 CheckErr(err) 100 CheckErr(err)
100 } 101 }
101 102
  103 +func queryBrifeMessage(w http.ResponseWriter, r *http.Request) {
  104 +
  105 + result, _ := ioutil.ReadAll(r.Body)
  106 + r.Body.Close()
  107 +
  108 + s := string(result)
  109 + logger.Info("queryBrifeMessage , body:%v", s)
  110 +
  111 + HandlequeryBrifeMessage(w, s)
  112 +}
102 113
103 func queryNewMessage(w http.ResponseWriter, r *http.Request) { 114 func queryNewMessage(w http.ResponseWriter, r *http.Request) {
104 115
@@ -108,7 +119,7 @@ func queryNewMessage(w http.ResponseWriter, r *http.Request) { @@ -108,7 +119,7 @@ func queryNewMessage(w http.ResponseWriter, r *http.Request) {
108 s := string(result) 119 s := string(result)
109 //logger.Info("queryNewMessage , body:%v", s) 120 //logger.Info("queryNewMessage , body:%v", s)
110 121
111 - HandlequeryNewMessage(w,s) 122 + HandlequeryNewMessage(w, s)
112 } 123 }
113 124
114 func NewSaveData(w http.ResponseWriter, r *http.Request) { 125 func NewSaveData(w http.ResponseWriter, r *http.Request) {
@@ -119,10 +130,9 @@ func NewSaveData(w http.ResponseWriter, r *http.Request) { @@ -119,10 +130,9 @@ func NewSaveData(w http.ResponseWriter, r *http.Request) {
119 s := string(result) 130 s := string(result)
120 logger.Info("NewSaveData , body:%v", s) 131 logger.Info("NewSaveData , body:%v", s)
121 132
122 - HandleNewSaveData(w,s) 133 + HandleNewSaveData(w, s)
123 } 134 }
124 135
125 -  
126 func NewGetData(w http.ResponseWriter, r *http.Request) { 136 func NewGetData(w http.ResponseWriter, r *http.Request) {
127 137
128 result, _ := ioutil.ReadAll(r.Body) 138 result, _ := ioutil.ReadAll(r.Body)
@@ -131,7 +141,7 @@ func NewGetData(w http.ResponseWriter, r *http.Request) { @@ -131,7 +141,7 @@ func NewGetData(w http.ResponseWriter, r *http.Request) {
131 s := string(result) 141 s := string(result)
132 //logger.Info("NewGetData , body:%v", s) 142 //logger.Info("NewGetData , body:%v", s)
133 143
134 - HandleNewGetData(w,s) 144 + HandleNewGetData(w, s)
135 } 145 }
136 146
137 func InitIndex(w http.ResponseWriter, r *http.Request) { 147 func InitIndex(w http.ResponseWriter, r *http.Request) {
@@ -142,10 +152,9 @@ func InitIndex(w http.ResponseWriter, r *http.Request) { @@ -142,10 +152,9 @@ func InitIndex(w http.ResponseWriter, r *http.Request) {
142 s := string(result) 152 s := string(result)
143 logger.Info("InitIndex , body:%v,uuid=%v", s) 153 logger.Info("InitIndex , body:%v,uuid=%v", s)
144 154
145 - HandleInitIndex(w,s) 155 + HandleInitIndex(w, s)
146 } 156 }
147 157
148 -  
149 func checkFileIsExist(filename string) bool { 158 func checkFileIsExist(filename string) bool {
150 var exist = true 159 var exist = true
151 if _, err := os.Stat(filename); os.IsNotExist(err) { 160 if _, err := os.Stat(filename); os.IsNotExist(err) {
@@ -163,7 +172,6 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { @@ -163,7 +172,6 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) {
163 a.a = 1*/ 172 a.a = 1*/
164 logger.Info("QueryAllAccount ") 173 logger.Info("QueryAllAccount ")
165 174
166 -  
167 //先打开文件 175 //先打开文件
168 filename := "./data.txt" 176 filename := "./data.txt"
169 var f *os.File 177 var f *os.File
@@ -172,8 +180,8 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { @@ -172,8 +180,8 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) {
172 if checkFileIsExist(filename) { //如果文件存在 180 if checkFileIsExist(filename) { //如果文件存在
173 f, err1 = os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, os.ModeAppend) //打开文件 181 f, err1 = os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, os.ModeAppend) //打开文件
174 if err1 != nil { 182 if err1 != nil {
175 - logger.Error("QueryAllData OpenFile failed err=%v",err1)  
176 - }else { 183 + logger.Error("QueryAllData OpenFile failed err=%v", err1)
  184 + } else {
177 os.Remove(filename) 185 os.Remove(filename)
178 } 186 }
179 } 187 }
@@ -186,47 +194,46 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { @@ -186,47 +194,46 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) {
186 f.Read(fileHeader) 194 f.Read(fileHeader)
187 fileStat, _ := f.Stat() 195 fileStat, _ := f.Stat()
188 196
189 - w.Header().Set("Content-Disposition", "attachment; filename=" + filename) 197 + w.Header().Set("Content-Disposition", "attachment; filename="+filename)
190 w.Header().Set("Content-Type", http.DetectContentType(fileHeader)) 198 w.Header().Set("Content-Type", http.DetectContentType(fileHeader))
191 w.Header().Set("Content-Length", strconv.FormatInt(fileStat.Size(), 10)) 199 w.Header().Set("Content-Length", strconv.FormatInt(fileStat.Size(), 10))
192 200
193 f.Seek(0, 0) 201 f.Seek(0, 0)
194 io.Copy(w, f) 202 io.Copy(w, f)
195 //io.Copy(f,r.Body) 203 //io.Copy(f,r.Body)
196 - fmt.Fprint(w,"success") 204 + fmt.Fprint(w, "success")
197 } 205 }
198 206
199 -  
200 func AddGoldAndLove(w http.ResponseWriter, r *http.Request) { 207 func AddGoldAndLove(w http.ResponseWriter, r *http.Request) {
201 208
202 query := r.URL.Query() 209 query := r.URL.Query()
203 suuid := query.Get("uuid") 210 suuid := query.Get("uuid")
204 - sgold := query.Get("gold")  
205 - slove := query.Get("love")  
206 - uuid,_ := strconv.Atoi(suuid)  
207 - gold,_ := strconv.Atoi(sgold)  
208 - love,_ := strconv.Atoi(slove)  
209 - logger.Info("ClearData , uuid:%v,gold:%v,love:%v", suuid,sgold,slove) 211 + sgold := query.Get("gold")
  212 + slove := query.Get("love")
  213 + uuid, _ := strconv.Atoi(suuid)
  214 + gold, _ := strconv.Atoi(sgold)
  215 + love, _ := strconv.Atoi(slove)
  216 + logger.Info("ClearData , uuid:%v,gold:%v,love:%v", suuid, sgold, slove)
210 if suuid == "" { 217 if suuid == "" {
211 fmt.Fprint(w, "uuid is nil,please check") 218 fmt.Fprint(w, "uuid is nil,please check")
212 return 219 return
213 } 220 }
214 - var wilteist []int 221 + var wilteist []int
215 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" 222 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST"
216 - vv,err := redishandler.GetRedisClient().HGetAllKeys(rkey) 223 + vv, err := redishandler.GetRedisClient().HGetAllKeys(rkey)
217 if err != nil { 224 if err != nil {
218 - fmt.Fprint(w,"获取白名单失败!,请检查") 225 + fmt.Fprint(w, "获取白名单失败!,请检查")
219 } 226 }
220 227
221 - for _,val := range vv { 228 + for _, val := range vv {
222 bytestr := string(val.([]byte)) 229 bytestr := string(val.([]byte))
223 - bytenum,_ := strconv.Atoi(bytestr)  
224 - wilteist = append(wilteist,bytenum) 230 + bytenum, _ := strconv.Atoi(bytestr)
  231 + wilteist = append(wilteist, bytenum)
225 232
226 } 233 }
227 - logger.Info("AddGoldAndLove white list wilteist=%v",wilteist) 234 + logger.Info("AddGoldAndLove white list wilteist=%v", wilteist)
228 isinwhitelist := false 235 isinwhitelist := false
229 - for _,val := range wilteist { 236 + for _, val := range wilteist {
230 if val == uuid { 237 if val == uuid {
231 isinwhitelist = true 238 isinwhitelist = true
232 break 239 break
@@ -240,21 +247,21 @@ func AddGoldAndLove(w http.ResponseWriter, r *http.Request) { @@ -240,21 +247,21 @@ func AddGoldAndLove(w http.ResponseWriter, r *http.Request) {
240 } 247 }
241 248
242 //加金币 249 //加金币
243 - err = mysql.DoAddGold(uuid,gold,love) 250 + err = mysql.DoAddGold(uuid, gold, love)
244 if err != nil { 251 if err != nil {
245 - fmt.Fprint(w, "加金币失败了,错误码%v",err) 252 + fmt.Fprint(w, "加金币失败了,错误码%v", err)
246 } 253 }
247 254
248 //清楚redis 255 //清楚redis
249 rediskey1 := "cat:cafe:userext:where:user_id:" + suuid 256 rediskey1 := "cat:cafe:userext:where:user_id:" + suuid
250 err = redishandler.GetRedisClient().Delete(rediskey1) 257 err = redishandler.GetRedisClient().Delete(rediskey1)
251 if err != nil { 258 if err != nil {
252 - fmt.Fprint(w, "加金币失败了,错误码%v",err) 259 + fmt.Fprint(w, "加金币失败了,错误码%v", err)
253 } 260 }
254 261
255 //将id从白名单删除 262 //将id从白名单删除
256 - redishandler.GetRedisClient().HDel(rkey,suuid)  
257 - fmt.Fprint(w,"加金币成功了") 263 + redishandler.GetRedisClient().HDel(rkey, suuid)
  264 + fmt.Fprint(w, "加金币成功了")
258 } 265 }
259 266
260 func AddWhiteList(w http.ResponseWriter, r *http.Request) { 267 func AddWhiteList(w http.ResponseWriter, r *http.Request) {
@@ -268,12 +275,12 @@ func AddWhiteList(w http.ResponseWriter, r *http.Request) { @@ -268,12 +275,12 @@ func AddWhiteList(w http.ResponseWriter, r *http.Request) {
268 } 275 }
269 //uuidnum,_ := strconv.Atoi(uuid) 276 //uuidnum,_ := strconv.Atoi(uuid)
270 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" 277 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST"
271 - err := redishandler.GetRedisClient().HSet(rkey,uuid,uuid)  
272 - if err!= nil {  
273 - fmt.Fprint(w, "添加白名单失败,err=%v",err)  
274 - }else {  
275 - fmt.Fprint(w, "添加白名单成功!")  
276 -} 278 + err := redishandler.GetRedisClient().HSet(rkey, uuid, uuid)
  279 + if err != nil {
  280 + fmt.Fprint(w, "添加白名单失败,err=%v", err)
  281 + } else {
  282 + fmt.Fprint(w, "添加白名单成功!")
  283 + }
277 284
278 } 285 }
279 286
@@ -286,7 +293,7 @@ func ClearData(w http.ResponseWriter, r *http.Request) { @@ -286,7 +293,7 @@ func ClearData(w http.ResponseWriter, r *http.Request) {
286 fmt.Fprint(w, "uuid is nil,please check") 293 fmt.Fprint(w, "uuid is nil,please check")
287 return 294 return
288 } 295 }
289 - uuidnum,_ := strconv.Atoi(uuid) 296 + uuidnum, _ := strconv.Atoi(uuid)
290 /*coin,err := mysql.TestClearData(uuidnum) 297 /*coin,err := mysql.TestClearData(uuidnum)
291 if err != nil { 298 if err != nil {
292 logger.Error("ClearData err=%v",err) 299 logger.Error("ClearData err=%v",err)
@@ -295,22 +302,22 @@ func ClearData(w http.ResponseWriter, r *http.Request) { @@ -295,22 +302,22 @@ func ClearData(w http.ResponseWriter, r *http.Request) {
295 fmt.Fprint(w, "ClearData coin=%v",coin)*/ 302 fmt.Fprint(w, "ClearData coin=%v",coin)*/
296 303
297 //首先检查白名单 304 //首先检查白名单
298 - var wilteist []int 305 + var wilteist []int
299 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" 306 rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST"
300 - vv,err := redishandler.GetRedisClient().HGetAllKeys(rkey) 307 + vv, err := redishandler.GetRedisClient().HGetAllKeys(rkey)
301 if err != nil { 308 if err != nil {
302 - fmt.Fprint(w,"获取白名单失败!,请检查") 309 + fmt.Fprint(w, "获取白名单失败!,请检查")
303 } 310 }
304 311
305 - for _,val := range vv { 312 + for _, val := range vv {
306 bytestr := string(val.([]byte)) 313 bytestr := string(val.([]byte))
307 - bytenum,_ := strconv.Atoi(bytestr)  
308 - wilteist = append(wilteist,bytenum) 314 + bytenum, _ := strconv.Atoi(bytestr)
  315 + wilteist = append(wilteist, bytenum)
309 316
310 } 317 }
311 - logger.Info("ClearData white list wilteist=%v",wilteist) 318 + logger.Info("ClearData white list wilteist=%v", wilteist)
312 isinwhitelist := false 319 isinwhitelist := false
313 - for _,val := range wilteist { 320 + for _, val := range wilteist {
314 if val == uuidnum { 321 if val == uuidnum {
315 isinwhitelist = true 322 isinwhitelist = true
316 break 323 break
@@ -325,39 +332,36 @@ func ClearData(w http.ResponseWriter, r *http.Request) { @@ -325,39 +332,36 @@ func ClearData(w http.ResponseWriter, r *http.Request) {
325 332
326 err = mysql.DoClearData(uuidnum) 333 err = mysql.DoClearData(uuidnum)
327 if err != nil { 334 if err != nil {
328 - fmt.Fprint(w, "清除数据失败了,错误码%v",err) 335 + fmt.Fprint(w, "清除数据失败了,错误码%v", err)
329 } 336 }
330 337
331 //下面清楚redis 338 //下面清楚redis
332 rediskey := "cat:cafe:data:where:data_uid:" + uuid 339 rediskey := "cat:cafe:data:where:data_uid:" + uuid
333 - exist,_ := redishandler.GetRedisClient().Exists(rediskey) 340 + exist, _ := redishandler.GetRedisClient().Exists(rediskey)
334 if exist { 341 if exist {
335 //存在,即删除 342 //存在,即删除
336 err = redishandler.GetRedisClient().Delete(rediskey) 343 err = redishandler.GetRedisClient().Delete(rediskey)
337 if err != nil { 344 if err != nil {
338 - fmt.Fprint(w, "清除数据失败了1,错误码%v",err) 345 + fmt.Fprint(w, "清除数据失败了1,错误码%v", err)
339 } 346 }
340 } 347 }
341 348
342 -  
343 rediskey1 := "cat:cafe:data_new:where:data_uid:" + uuid 349 rediskey1 := "cat:cafe:data_new:where:data_uid:" + uuid
344 - exist,_ = redishandler.GetRedisClient().Exists(rediskey1) 350 + exist, _ = redishandler.GetRedisClient().Exists(rediskey1)
345 if exist { 351 if exist {
346 //存在,即删除 352 //存在,即删除
347 err = redishandler.GetRedisClient().Delete(rediskey1) 353 err = redishandler.GetRedisClient().Delete(rediskey1)
348 if err != nil { 354 if err != nil {
349 - fmt.Fprint(w, "清除数据失败了2,错误码%v",err) 355 + fmt.Fprint(w, "清除数据失败了2,错误码%v", err)
350 } 356 }
351 } 357 }
352 358
353 -  
354 - fmt.Fprint(w, "清除数据成功了,恭喜!uuid=%v",uuid) 359 + fmt.Fprint(w, "清除数据成功了,恭喜!uuid=%v", uuid)
355 //将id从白名单删除 360 //将id从白名单删除
356 - redishandler.GetRedisClient().HDel(rkey,uuid) 361 + redishandler.GetRedisClient().HDel(rkey, uuid)
357 //HandleRegeister(w,s) 362 //HandleRegeister(w,s)
358 } 363 }
359 364
360 -  
361 func SaveDataBackup(w http.ResponseWriter, r *http.Request) { 365 func SaveDataBackup(w http.ResponseWriter, r *http.Request) {
362 366
363 result, _ := ioutil.ReadAll(r.Body) 367 result, _ := ioutil.ReadAll(r.Body)
@@ -366,7 +370,7 @@ func SaveDataBackup(w http.ResponseWriter, r *http.Request) { @@ -366,7 +370,7 @@ func SaveDataBackup(w http.ResponseWriter, r *http.Request) {
366 s := string(result) 370 s := string(result)
367 //logger.Info("SaveDataBackup , body:%v,uuid=%v", s) 371 //logger.Info("SaveDataBackup , body:%v,uuid=%v", s)
368 372
369 - HandleSaveDataBackup(w,s) 373 + HandleSaveDataBackup(w, s)
370 374
371 } 375 }
372 376
@@ -378,7 +382,7 @@ func QueryInviteWork(w http.ResponseWriter, r *http.Request) { @@ -378,7 +382,7 @@ func QueryInviteWork(w http.ResponseWriter, r *http.Request) {
378 s := string(result) 382 s := string(result)
379 logger.Info("QueryInviteWork , body:%v,uuid=%v", s) 383 logger.Info("QueryInviteWork , body:%v,uuid=%v", s)
380 384
381 - HandleQueryInviteWork(w,s) 385 + HandleQueryInviteWork(w, s)
382 386
383 } 387 }
384 388
@@ -390,11 +394,10 @@ func EnterInvite(w http.ResponseWriter, r *http.Request) { @@ -390,11 +394,10 @@ func EnterInvite(w http.ResponseWriter, r *http.Request) {
390 s := string(result) 394 s := string(result)
391 //logger.Info("EnterInvite , body:%v,uuid=%v", s) 395 //logger.Info("EnterInvite , body:%v,uuid=%v", s)
392 396
393 - HandleEnterInvite(w,s) 397 + HandleEnterInvite(w, s)
394 398
395 } 399 }
396 400
397 -  
398 func FetchInviteReward(w http.ResponseWriter, r *http.Request) { 401 func FetchInviteReward(w http.ResponseWriter, r *http.Request) {
399 402
400 result, _ := ioutil.ReadAll(r.Body) 403 result, _ := ioutil.ReadAll(r.Body)
@@ -403,7 +406,7 @@ func FetchInviteReward(w http.ResponseWriter, r *http.Request) { @@ -403,7 +406,7 @@ func FetchInviteReward(w http.ResponseWriter, r *http.Request) {
403 s := string(result) 406 s := string(result)
404 //logger.Info("FetchInviteReward , body:%v", s) 407 //logger.Info("FetchInviteReward , body:%v", s)
405 408
406 - HandleFetchInviteReward(w,s) 409 + HandleFetchInviteReward(w, s)
407 410
408 } 411 }
409 412
@@ -415,7 +418,7 @@ func QueryInvite(w http.ResponseWriter, r *http.Request) { @@ -415,7 +418,7 @@ func QueryInvite(w http.ResponseWriter, r *http.Request) {
415 s := string(result) 418 s := string(result)
416 //logger.Info("QueryInvite , body:%v,uuid=%v", s) 419 //logger.Info("QueryInvite , body:%v,uuid=%v", s)
417 420
418 - HandleQueryInvite(w,s) 421 + HandleQueryInvite(w, s)
419 422
420 } 423 }
421 424
@@ -427,7 +430,7 @@ func Regeister(w http.ResponseWriter, r *http.Request) { @@ -427,7 +430,7 @@ func Regeister(w http.ResponseWriter, r *http.Request) {
427 s := string(result) 430 s := string(result)
428 logger.Info("Regeister , body:%v,uuid=%v", s) 431 logger.Info("Regeister , body:%v,uuid=%v", s)
429 432
430 - HandleRegeister(w,s) 433 + HandleRegeister(w, s)
431 434
432 } 435 }
433 436
@@ -439,10 +442,9 @@ func AccounLogin(w http.ResponseWriter, r *http.Request) { @@ -439,10 +442,9 @@ func AccounLogin(w http.ResponseWriter, r *http.Request) {
439 s := string(result) 442 s := string(result)
440 logger.Info("AccounLogin , body:%v,uuid=%v", s) 443 logger.Info("AccounLogin , body:%v,uuid=%v", s)
441 444
442 - HandleAccounLogin(w,s) 445 + HandleAccounLogin(w, s)
443 } 446 }
444 447
445 -  
446 func Wechatlogin(w http.ResponseWriter, r *http.Request) { 448 func Wechatlogin(w http.ResponseWriter, r *http.Request) {
447 449
448 result, _ := ioutil.ReadAll(r.Body) 450 result, _ := ioutil.ReadAll(r.Body)
@@ -451,10 +453,9 @@ func Wechatlogin(w http.ResponseWriter, r *http.Request) { @@ -451,10 +453,9 @@ func Wechatlogin(w http.ResponseWriter, r *http.Request) {
451 s := string(result) 453 s := string(result)
452 logger.Info("Wechatlogin , body:%v,uuid=%v", s) 454 logger.Info("Wechatlogin , body:%v,uuid=%v", s)
453 455
454 - HandleWechatlogin(w,s) 456 + HandleWechatlogin(w, s)
455 } 457 }
456 458
457 -  
458 func QueryPlayerData(w http.ResponseWriter, r *http.Request) { 459 func QueryPlayerData(w http.ResponseWriter, r *http.Request) {
459 460
460 result, _ := ioutil.ReadAll(r.Body) 461 result, _ := ioutil.ReadAll(r.Body)
@@ -463,10 +464,9 @@ func QueryPlayerData(w http.ResponseWriter, r *http.Request) { @@ -463,10 +464,9 @@ func QueryPlayerData(w http.ResponseWriter, r *http.Request) {
463 s := string(result) 464 s := string(result)
464 logger.Info("QueryPlayerData , body:%v,uuid=%v", s) 465 logger.Info("QueryPlayerData , body:%v,uuid=%v", s)
465 466
466 - HandleQueryPlayerData(w,s) 467 + HandleQueryPlayerData(w, s)
467 } 468 }
468 469
469 -  
470 func DelFriend(w http.ResponseWriter, r *http.Request) { 470 func DelFriend(w http.ResponseWriter, r *http.Request) {
471 471
472 result, _ := ioutil.ReadAll(r.Body) 472 result, _ := ioutil.ReadAll(r.Body)
@@ -475,10 +475,9 @@ func DelFriend(w http.ResponseWriter, r *http.Request) { @@ -475,10 +475,9 @@ func DelFriend(w http.ResponseWriter, r *http.Request) {
475 s := string(result) 475 s := string(result)
476 logger.Info("DelFriend , body:%v,uuid=%v", s) 476 logger.Info("DelFriend , body:%v,uuid=%v", s)
477 477
478 - HandleDelFriend(w,s) 478 + HandleDelFriend(w, s)
479 } 479 }
480 480
481 -  
482 func HandleFriendRequest(w http.ResponseWriter, r *http.Request) { 481 func HandleFriendRequest(w http.ResponseWriter, r *http.Request) {
483 482
484 result, _ := ioutil.ReadAll(r.Body) 483 result, _ := ioutil.ReadAll(r.Body)
@@ -487,10 +486,9 @@ func HandleFriendRequest(w http.ResponseWriter, r *http.Request) { @@ -487,10 +486,9 @@ func HandleFriendRequest(w http.ResponseWriter, r *http.Request) {
487 s := string(result) 486 s := string(result)
488 logger.Info("HandleFriendRequest , body:%v,uuid=%v", s) 487 logger.Info("HandleFriendRequest , body:%v,uuid=%v", s)
489 488
490 - HandleHandleFriendRequest(w,s) 489 + HandleHandleFriendRequest(w, s)
491 } 490 }
492 491
493 -  
494 func GetRecommendList(w http.ResponseWriter, r *http.Request) { 492 func GetRecommendList(w http.ResponseWriter, r *http.Request) {
495 493
496 result, _ := ioutil.ReadAll(r.Body) 494 result, _ := ioutil.ReadAll(r.Body)
@@ -499,7 +497,7 @@ func GetRecommendList(w http.ResponseWriter, r *http.Request) { @@ -499,7 +497,7 @@ func GetRecommendList(w http.ResponseWriter, r *http.Request) {
499 s := string(result) 497 s := string(result)
500 logger.Info("GetRecommendList , body:%v,uuid=%v", s) 498 logger.Info("GetRecommendList , body:%v,uuid=%v", s)
501 499
502 - HandleGetRecommendList(w,s) 500 + HandleGetRecommendList(w, s)
503 } 501 }
504 502
505 func GetAuditList(w http.ResponseWriter, r *http.Request) { 503 func GetAuditList(w http.ResponseWriter, r *http.Request) {
@@ -510,10 +508,9 @@ func GetAuditList(w http.ResponseWriter, r *http.Request) { @@ -510,10 +508,9 @@ func GetAuditList(w http.ResponseWriter, r *http.Request) {
510 s := string(result) 508 s := string(result)
511 logger.Info("GetAuditList , body:%v,uuid=%v", s) 509 logger.Info("GetAuditList , body:%v,uuid=%v", s)
512 510
513 - HandleGetAuditList(w,s) 511 + HandleGetAuditList(w, s)
514 } 512 }
515 513
516 -  
517 func GetFriendList(w http.ResponseWriter, r *http.Request) { 514 func GetFriendList(w http.ResponseWriter, r *http.Request) {
518 515
519 result, _ := ioutil.ReadAll(r.Body) 516 result, _ := ioutil.ReadAll(r.Body)
@@ -522,7 +519,7 @@ func GetFriendList(w http.ResponseWriter, r *http.Request) { @@ -522,7 +519,7 @@ func GetFriendList(w http.ResponseWriter, r *http.Request) {
522 s := string(result) 519 s := string(result)
523 logger.Info("GetFriendList , body:%v,uuid=%v", s) 520 logger.Info("GetFriendList , body:%v,uuid=%v", s)
524 521
525 - HandleGetFriendList(w,s) 522 + HandleGetFriendList(w, s)
526 } 523 }
527 524
528 func SetFriendRequest(w http.ResponseWriter, r *http.Request) { 525 func SetFriendRequest(w http.ResponseWriter, r *http.Request) {
@@ -533,7 +530,7 @@ func SetFriendRequest(w http.ResponseWriter, r *http.Request) { @@ -533,7 +530,7 @@ func SetFriendRequest(w http.ResponseWriter, r *http.Request) {
533 s := string(result) 530 s := string(result)
534 logger.Info("SetFriendRequest , body:%v,uuid=%v", s) 531 logger.Info("SetFriendRequest , body:%v,uuid=%v", s)
535 532
536 - HandleSetFriendRequest(w,s) 533 + HandleSetFriendRequest(w, s)
537 } 534 }
538 535
539 func SearchTeam(w http.ResponseWriter, r *http.Request) { 536 func SearchTeam(w http.ResponseWriter, r *http.Request) {
@@ -544,7 +541,7 @@ func SearchTeam(w http.ResponseWriter, r *http.Request) { @@ -544,7 +541,7 @@ func SearchTeam(w http.ResponseWriter, r *http.Request) {
544 s := string(result) 541 s := string(result)
545 logger.Info("SearchTeam , body:%v,uuid=%v", s) 542 logger.Info("SearchTeam , body:%v,uuid=%v", s)
546 543
547 - HandleSearchTeam(w,s) 544 + HandleSearchTeam(w, s)
548 } 545 }
549 546
550 func GetTeamList(w http.ResponseWriter, r *http.Request) { 547 func GetTeamList(w http.ResponseWriter, r *http.Request) {
@@ -555,7 +552,7 @@ func GetTeamList(w http.ResponseWriter, r *http.Request) { @@ -555,7 +552,7 @@ func GetTeamList(w http.ResponseWriter, r *http.Request) {
555 s := string(result) 552 s := string(result)
556 logger.Info("GetTeamList , body:%v,uuid=%v", s) 553 logger.Info("GetTeamList , body:%v,uuid=%v", s)
557 554
558 - HandleGetTeamList(w,s) 555 + HandleGetTeamList(w, s)
559 } 556 }
560 557
561 func GetDataByUserId(w http.ResponseWriter, r *http.Request) { 558 func GetDataByUserId(w http.ResponseWriter, r *http.Request) {
@@ -566,7 +563,7 @@ func GetDataByUserId(w http.ResponseWriter, r *http.Request) { @@ -566,7 +563,7 @@ func GetDataByUserId(w http.ResponseWriter, r *http.Request) {
566 s := string(result) 563 s := string(result)
567 logger.Info("GetDataByUserId , body:%v,uuid=%v", s) 564 logger.Info("GetDataByUserId , body:%v,uuid=%v", s)
568 565
569 - HandleGetDataByUserId(w,s) 566 + HandleGetDataByUserId(w, s)
570 } 567 }
571 568
572 func GetTeamData(w http.ResponseWriter, r *http.Request) { 569 func GetTeamData(w http.ResponseWriter, r *http.Request) {
@@ -577,7 +574,7 @@ func GetTeamData(w http.ResponseWriter, r *http.Request) { @@ -577,7 +574,7 @@ func GetTeamData(w http.ResponseWriter, r *http.Request) {
577 s := string(result) 574 s := string(result)
578 logger.Info("GetTeamData , body:%v,uuid=%v", s) 575 logger.Info("GetTeamData , body:%v,uuid=%v", s)
579 576
580 - HandleGetTeamData(w,s) 577 + HandleGetTeamData(w, s)
581 } 578 }
582 579
583 func GetTeamBuff(w http.ResponseWriter, r *http.Request) { 580 func GetTeamBuff(w http.ResponseWriter, r *http.Request) {
@@ -588,10 +585,9 @@ func GetTeamBuff(w http.ResponseWriter, r *http.Request) { @@ -588,10 +585,9 @@ func GetTeamBuff(w http.ResponseWriter, r *http.Request) {
588 s := string(result) 585 s := string(result)
589 logger.Info("GetTeamBuff , body:%v,uuid=%v", s) 586 logger.Info("GetTeamBuff , body:%v,uuid=%v", s)
590 587
591 - HandleGetTeamBuff(w,s) 588 + HandleGetTeamBuff(w, s)
592 } 589 }
593 590
594 -  
595 func AddTeamBuff(w http.ResponseWriter, r *http.Request) { 591 func AddTeamBuff(w http.ResponseWriter, r *http.Request) {
596 592
597 result, _ := ioutil.ReadAll(r.Body) 593 result, _ := ioutil.ReadAll(r.Body)
@@ -600,7 +596,7 @@ func AddTeamBuff(w http.ResponseWriter, r *http.Request) { @@ -600,7 +596,7 @@ func AddTeamBuff(w http.ResponseWriter, r *http.Request) {
600 s := string(result) 596 s := string(result)
601 logger.Info("AddTeamBuff , body:%v,uuid=%v", s) 597 logger.Info("AddTeamBuff , body:%v,uuid=%v", s)
602 598
603 - HandleAddTeamBuff(w,s) 599 + HandleAddTeamBuff(w, s)
604 } 600 }
605 601
606 func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) { 602 func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) {
@@ -611,7 +607,7 @@ func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) { @@ -611,7 +607,7 @@ func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) {
611 s := string(result) 607 s := string(result)
612 logger.Info("UpdateTeamBuild , body:%v,uuid=%v", s) 608 logger.Info("UpdateTeamBuild , body:%v,uuid=%v", s)
613 609
614 - HandleUpdateTeamBuild(w,s) 610 + HandleUpdateTeamBuild(w, s)
615 } 611 }
616 612
617 func QuitTeam(w http.ResponseWriter, r *http.Request) { 613 func QuitTeam(w http.ResponseWriter, r *http.Request) {
@@ -622,7 +618,7 @@ func QuitTeam(w http.ResponseWriter, r *http.Request) { @@ -622,7 +618,7 @@ func QuitTeam(w http.ResponseWriter, r *http.Request) {
622 s := string(result) 618 s := string(result)
623 logger.Info("QuitTeam , body:%v,uuid=%v", s) 619 logger.Info("QuitTeam , body:%v,uuid=%v", s)
624 620
625 - HandleQuitTeam(w,s) 621 + HandleQuitTeam(w, s)
626 } 622 }
627 623
628 func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) { 624 func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) {
@@ -633,7 +629,7 @@ func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) { @@ -633,7 +629,7 @@ func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) {
633 s := string(result) 629 s := string(result)
634 logger.Info("JoinTeamByInvite , body:%v,uuid=%v", s) 630 logger.Info("JoinTeamByInvite , body:%v,uuid=%v", s)
635 631
636 - HandleJoinTeamByInvite(w,s) 632 + HandleJoinTeamByInvite(w, s)
637 } 633 }
638 634
639 func JoinTeam(w http.ResponseWriter, r *http.Request) { 635 func JoinTeam(w http.ResponseWriter, r *http.Request) {
@@ -644,7 +640,7 @@ func JoinTeam(w http.ResponseWriter, r *http.Request) { @@ -644,7 +640,7 @@ func JoinTeam(w http.ResponseWriter, r *http.Request) {
644 s := string(result) 640 s := string(result)
645 logger.Info("JoinTeam , body:%v,uuid=%v", s) 641 logger.Info("JoinTeam , body:%v,uuid=%v", s)
646 642
647 - HandleJoinTeam(w,s) 643 + HandleJoinTeam(w, s)
648 } 644 }
649 645
650 func UpdateTeamData(w http.ResponseWriter, r *http.Request) { 646 func UpdateTeamData(w http.ResponseWriter, r *http.Request) {
@@ -655,7 +651,7 @@ func UpdateTeamData(w http.ResponseWriter, r *http.Request) { @@ -655,7 +651,7 @@ func UpdateTeamData(w http.ResponseWriter, r *http.Request) {
655 s := string(result) 651 s := string(result)
656 logger.Info("UpdateTeamData , body:%v,uuid=%v", s) 652 logger.Info("UpdateTeamData , body:%v,uuid=%v", s)
657 653
658 - HandleUpdateTeamData(w,s) 654 + HandleUpdateTeamData(w, s)
659 } 655 }
660 656
661 func CreateTeam(w http.ResponseWriter, r *http.Request) { 657 func CreateTeam(w http.ResponseWriter, r *http.Request) {
@@ -666,7 +662,7 @@ func CreateTeam(w http.ResponseWriter, r *http.Request) { @@ -666,7 +662,7 @@ func CreateTeam(w http.ResponseWriter, r *http.Request) {
666 s := string(result) 662 s := string(result)
667 logger.Info("CreateTeam , body:%v,uuid=%v", s) 663 logger.Info("CreateTeam , body:%v,uuid=%v", s)
668 664
669 - HandleCreateTeam(w,s) 665 + HandleCreateTeam(w, s)
670 } 666 }
671 667
672 func TextCheck(w http.ResponseWriter, r *http.Request) { 668 func TextCheck(w http.ResponseWriter, r *http.Request) {
@@ -677,7 +673,7 @@ func TextCheck(w http.ResponseWriter, r *http.Request) { @@ -677,7 +673,7 @@ func TextCheck(w http.ResponseWriter, r *http.Request) {
677 s := string(result) 673 s := string(result)
678 logger.Info("TextCheck , body:%v,uuid=%v", s) 674 logger.Info("TextCheck , body:%v,uuid=%v", s)
679 675
680 - HandleTextCheck(w,s) 676 + HandleTextCheck(w, s)
681 } 677 }
682 678
683 func SaveUserData(w http.ResponseWriter, r *http.Request) { 679 func SaveUserData(w http.ResponseWriter, r *http.Request) {
@@ -688,7 +684,7 @@ func SaveUserData(w http.ResponseWriter, r *http.Request) { @@ -688,7 +684,7 @@ func SaveUserData(w http.ResponseWriter, r *http.Request) {
688 s := string(result) 684 s := string(result)
689 logger.Info("saveUserData , body:%v,uuid=%v", s) 685 logger.Info("saveUserData , body:%v,uuid=%v", s)
690 686
691 - HandleSaveUserData(w,s) 687 + HandleSaveUserData(w, s)
692 } 688 }
693 689
694 func SaveData(w http.ResponseWriter, r *http.Request) { 690 func SaveData(w http.ResponseWriter, r *http.Request) {
@@ -699,7 +695,7 @@ func SaveData(w http.ResponseWriter, r *http.Request) { @@ -699,7 +695,7 @@ func SaveData(w http.ResponseWriter, r *http.Request) {
699 s := string(result) 695 s := string(result)
700 logger.Info("saveData , body:%v,uuid=%v", s) 696 logger.Info("saveData , body:%v,uuid=%v", s)
701 697
702 - HandlesaveData(w,s) 698 + HandlesaveData(w, s)
703 } 699 }
704 700
705 func GetData(w http.ResponseWriter, r *http.Request) { 701 func GetData(w http.ResponseWriter, r *http.Request) {
@@ -710,10 +706,9 @@ func GetData(w http.ResponseWriter, r *http.Request) { @@ -710,10 +706,9 @@ func GetData(w http.ResponseWriter, r *http.Request) {
710 s := string(result) 706 s := string(result)
711 logger.Info("GetData , body:%v,uuid=%v", s) 707 logger.Info("GetData , body:%v,uuid=%v", s)
712 708
713 - HandlegetData(w,s) 709 + HandlegetData(w, s)
714 } 710 }
715 711
716 -  
717 func UserLogin(w http.ResponseWriter, r *http.Request) { 712 func UserLogin(w http.ResponseWriter, r *http.Request) {
718 //logger.Info("%%%%%%%%%%%%%%%%path=%v", *r.URL) 713 //logger.Info("%%%%%%%%%%%%%%%%path=%v", *r.URL)
719 //for k, v := range r.Header { 714 //for k, v := range r.Header {
@@ -737,7 +732,5 @@ func UserLogin(w http.ResponseWriter, r *http.Request) { @@ -737,7 +732,5 @@ func UserLogin(w http.ResponseWriter, r *http.Request) {
737 s := string(result) 732 s := string(result)
738 logger.Info("UserLogin , body:%v,uuid=%v", s) 733 logger.Info("UserLogin , body:%v,uuid=%v", s)
739 734
740 - HandleUserLogin(w,s) 735 + HandleUserLogin(w, s)
741 } 736 }
742 -  
743 -  
src/HttpServer/logic/logic.go
@@ -26,8 +26,7 @@ func init() { @@ -26,8 +26,7 @@ func init() {
26 m_userInfo = beegomap.NewBeeMap() 26 m_userInfo = beegomap.NewBeeMap()
27 } 27 }
28 28
29 -  
30 -func InitUserExt(req *UserLoginReq,resp *UserLoginResp,uuid int) { 29 +func InitUserExt(req *UserLoginReq, resp *UserLoginResp, uuid int) {
31 var extdata UserExtData 30 var extdata UserExtData
32 extdata.User_id = uuid 31 extdata.User_id = uuid
33 extdata.Lv = 1 32 extdata.Lv = 1
@@ -45,7 +44,7 @@ func InitUserExt(req *UserLoginReq,resp *UserLoginResp,uuid int) { @@ -45,7 +44,7 @@ func InitUserExt(req *UserLoginReq,resp *UserLoginResp,uuid int) {
45 extdata.User_scene = req.Scene 44 extdata.User_scene = req.Scene
46 resp.Result.Data.Extdata = extdata 45 resp.Result.Data.Extdata = extdata
47 //保存 46 //保存
48 - udata :=new(UserData) 47 + udata := new(UserData)
49 udata.Scene = extdata.User_scene 48 udata.Scene = extdata.User_scene
50 udata.Hot = extdata.Hot 49 udata.Hot = extdata.Hot
51 udata.Exp = extdata.Exp 50 udata.Exp = extdata.Exp
@@ -71,7 +70,7 @@ func InitAccountLogin(account string) { @@ -71,7 +70,7 @@ func InitAccountLogin(account string) {
71 //首先生成token 70 //首先生成token
72 newToken := ksuid.New().String() 71 newToken := ksuid.New().String()
73 //保存token与account的关系 72 //保存token与account的关系
74 - SaveAccountToken(account,newToken) 73 + SaveAccountToken(account, newToken)
75 //首先生成user_base_data 74 //首先生成user_base_data
76 var basedata UserBaseData 75 var basedata UserBaseData
77 basedata.User_id = GetNewUUid() 76 basedata.User_id = GetNewUUid()
@@ -83,9 +82,9 @@ func InitAccountLogin(account string) { @@ -83,9 +82,9 @@ func InitAccountLogin(account string) {
83 basedata.User_token = newToken 82 basedata.User_token = newToken
84 //保存base data 83 //保存base data
85 basic, _ := json.Marshal(&basedata) 84 basic, _ := json.Marshal(&basedata)
86 - SaveUserBasic(basedata.User_id,string(basic)) 85 + SaveUserBasic(basedata.User_id, string(basic))
87 86
88 - SetTouristUid(newToken,basedata.User_id) 87 + SetTouristUid(newToken, basedata.User_id)
89 //然后生成user_ext_data 88 //然后生成user_ext_data
90 var extdata UserExtData 89 var extdata UserExtData
91 extdata.User_id = basedata.User_id 90 extdata.User_id = basedata.User_id
@@ -102,7 +101,7 @@ func InitAccountLogin(account string) { @@ -102,7 +101,7 @@ func InitAccountLogin(account string) {
102 extdata.User_is_black = 0 101 extdata.User_is_black = 0
103 extdata.User_reg_time = int(time.Now().Unix()) 102 extdata.User_reg_time = int(time.Now().Unix())
104 extdata.User_scene = 0 103 extdata.User_scene = 0
105 - udata :=new(UserData) 104 + udata := new(UserData)
106 udata.Scene = extdata.User_scene 105 udata.Scene = extdata.User_scene
107 udata.Hot = extdata.Hot 106 udata.Hot = extdata.Hot
108 udata.Exp = extdata.Exp 107 udata.Exp = extdata.Exp
@@ -124,7 +123,7 @@ func InitAccountLogin(account string) { @@ -124,7 +123,7 @@ func InitAccountLogin(account string) {
124 SaveUserExt(udata) 123 SaveUserExt(udata)
125 } 124 }
126 125
127 -func InitTourist(req *UserLoginReq,resp *UserLoginResp) { 126 +func InitTourist(req *UserLoginReq, resp *UserLoginResp) {
128 //首先生成user_base_data 127 //首先生成user_base_data
129 var basedata UserBaseData 128 var basedata UserBaseData
130 basedata.User_id = GetNewUUid() 129 basedata.User_id = GetNewUUid()
@@ -137,16 +136,16 @@ func InitTourist(req *UserLoginReq,resp *UserLoginResp) { @@ -137,16 +136,16 @@ func InitTourist(req *UserLoginReq,resp *UserLoginResp) {
137 resp.Result.Data.Dasedata = basedata 136 resp.Result.Data.Dasedata = basedata
138 //保存base data 137 //保存base data
139 basic, _ := json.Marshal(&basedata) 138 basic, _ := json.Marshal(&basedata)
140 - SaveUserBasic(basedata.User_id,string(basic)) 139 + SaveUserBasic(basedata.User_id, string(basic))
141 140
142 - SetTouristUid(req.Token,basedata.User_id) 141 + SetTouristUid(req.Token, basedata.User_id)
143 //然后生成user_ext_data 142 //然后生成user_ext_data
144 - InitUserExt(req,resp,basedata.User_id) 143 + InitUserExt(req, resp, basedata.User_id)
145 144
146 } 145 }
147 146
148 //微信登录账户初始化 147 //微信登录账户初始化
149 -func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) { 148 +func InitWeChatUser(req *WechatLoginReq, resp *UserLoginResp, uinfo *WxUserInfo) {
150 //首先生成user_base_data 149 //首先生成user_base_data
151 var basedata UserBaseData 150 var basedata UserBaseData
152 basedata.User_id = GetNewUUid() 151 basedata.User_id = GetNewUUid()
@@ -159,9 +158,9 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) { @@ -159,9 +158,9 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) {
159 resp.Result.Data.Dasedata = basedata 158 resp.Result.Data.Dasedata = basedata
160 //保存base data 159 //保存base data
161 basic, _ := json.Marshal(&basedata) 160 basic, _ := json.Marshal(&basedata)
162 - SaveUserBasic(basedata.User_id,string(basic)) 161 + SaveUserBasic(basedata.User_id, string(basic))
163 162
164 - SetTouristUid(uinfo.OpenID,basedata.User_id) 163 + SetTouristUid(uinfo.OpenID, basedata.User_id)
165 //然后生成user_ext_data 164 //然后生成user_ext_data
166 var extdata UserExtData 165 var extdata UserExtData
167 extdata.User_id = basedata.User_id 166 extdata.User_id = basedata.User_id
@@ -180,7 +179,7 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) { @@ -180,7 +179,7 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) {
180 extdata.User_scene = 0 179 extdata.User_scene = 0
181 resp.Result.Data.Extdata = extdata 180 resp.Result.Data.Extdata = extdata
182 //保存 181 //保存
183 - udata :=new(UserData) 182 + udata := new(UserData)
184 udata.Scene = extdata.User_scene 183 udata.Scene = extdata.User_scene
185 udata.Hot = extdata.Hot 184 udata.Hot = extdata.Hot
186 udata.Exp = extdata.Exp 185 udata.Exp = extdata.Exp
@@ -214,7 +213,7 @@ func HandleLoginTime(ext *UserData) { @@ -214,7 +213,7 @@ func HandleLoginTime(ext *UserData) {
214 } 213 }
215 } 214 }
216 215
217 -func TransmitUserData(in *UserData ,out *UserExtData) { 216 +func TransmitUserData(in *UserData, out *UserExtData) {
218 out.LoveExp = in.Loevexp 217 out.LoveExp = in.Loevexp
219 out.User_id = in.Userid 218 out.User_id = in.Userid
220 out.ShopNum = in.Shopnum 219 out.ShopNum = in.Shopnum
@@ -232,7 +231,6 @@ func TransmitUserData(in *UserData ,out *UserExtData) { @@ -232,7 +231,6 @@ func TransmitUserData(in *UserData ,out *UserExtData) {
232 out.Invite_uid = in.InviteUid 231 out.Invite_uid = in.InviteUid
233 } 232 }
234 233
235 -  
236 func HandleQueryInvite(w http.ResponseWriter, data string) { 234 func HandleQueryInvite(w http.ResponseWriter, data string) {
237 235
238 SetHeader(w) 236 SetHeader(w)
@@ -247,7 +245,7 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { @@ -247,7 +245,7 @@ func HandleQueryInvite(w http.ResponseWriter, data string) {
247 break 245 break
248 } 246 }
249 247
250 - inlist,err := mysql.QueryInvite(rdata.Uuid) 248 + inlist, err := mysql.QueryInvite(rdata.Uuid)
251 if err != nil { 249 if err != nil {
252 logger.Error("HandleQueryInvite QueryInvite failed=%v", err) 250 logger.Error("HandleQueryInvite QueryInvite failed=%v", err)
253 resp.Result.Code = ERROR_JSONUNMASHFAILED 251 resp.Result.Code = ERROR_JSONUNMASHFAILED
@@ -255,13 +253,13 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { @@ -255,13 +253,13 @@ func HandleQueryInvite(w http.ResponseWriter, data string) {
255 break 253 break
256 } 254 }
257 255
258 - for _,val := range inlist { 256 + for _, val := range inlist {
259 var tmp QueryInviteData 257 var tmp QueryInviteData
260 tmp.Uuid = val.Uuid 258 tmp.Uuid = val.Uuid
261 tmp.Nickname = val.NickName 259 tmp.Nickname = val.NickName
262 tmp.Isfetched = val.IsFecthed 260 tmp.Isfetched = val.IsFecthed
263 tmp.Headurl = val.HeadUrl 261 tmp.Headurl = val.HeadUrl
264 - resp.Result.Data.Invite_data = append(resp.Result.Data.Invite_data,tmp) 262 + resp.Result.Data.Invite_data = append(resp.Result.Data.Invite_data, tmp)
265 } 263 }
266 264
267 resp.Result.Code = ERROR_OK 265 resp.Result.Code = ERROR_OK
@@ -273,6 +271,51 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { @@ -273,6 +271,51 @@ func HandleQueryInvite(w http.ResponseWriter, data string) {
273 fmt.Fprint(w, string(respstr)) 271 fmt.Fprint(w, string(respstr))
274 } 272 }
275 273
  274 +func HandlequeryBrifeMessage(w http.ResponseWriter, data string) {
  275 +
  276 + SetHeader(w)
  277 + var resp QueryBrifeMessageResp
  278 + resp.Status = "true"
  279 + var rdata QueryBrifeMessageReq
  280 + err := json.Unmarshal([]byte(data), &rdata)
  281 + for {
  282 + if err != nil {
  283 + logger.Error("HandlequeryBrifeMessage json unmarshal failed=%v", err)
  284 + resp.Result.Code = ERROR_JSONUNMASHFAILED
  285 + break
  286 + }
  287 +
  288 + //先查询表情信息
  289 + emjs := GetChatEmojInfo(rdata.Uuid)
  290 + resp.Result.Data.Emojinfo = append(resp.Result.Data.Emojinfo, emjs...)
  291 +
  292 + //世界频道
  293 + var world QueryBrifeMessageData
  294 + world.Isnew = 0
  295 + world.Ctype = 0
  296 + resp.Result.Data.Channelinfo = append(resp.Result.Data.Channelinfo, world)
  297 +
  298 + //工会频道
  299 + var team QueryBrifeMessageData
  300 + team.Ctype = 1
  301 + team.Isnew = 0
  302 + teamnew, err := CheckTeamHasNewMessage(rdata.Uuid)
  303 + if err == nil && teamnew {
  304 + team.Isnew = 1
  305 + }
  306 + resp.Result.Data.Channelinfo = append(resp.Result.Data.Channelinfo, team)
  307 +
  308 + //私人频道
  309 + //优先加入有新消息的
  310 + privatebrief := GetPrivateBriefList(rdata.Uuid)
  311 + resp.Result.Data.Channelinfo = append(resp.Result.Data.Channelinfo, privatebrief...)
  312 + break
  313 + }
  314 +
  315 + //回包
  316 + respstr, _ := json.Marshal(&resp)
  317 + fmt.Fprint(w, string(respstr))
  318 +}
276 319
277 func HandlequeryNewMessage(w http.ResponseWriter, data string) { 320 func HandlequeryNewMessage(w http.ResponseWriter, data string) {
278 321
@@ -289,7 +332,7 @@ func HandlequeryNewMessage(w http.ResponseWriter, data string) { @@ -289,7 +332,7 @@ func HandlequeryNewMessage(w http.ResponseWriter, data string) {
289 break 332 break
290 } 333 }
291 //先从缓存取,如果已经有新消息则直接返回 334 //先从缓存取,如果已经有新消息则直接返回
292 - exist,err := redishandler.GetRedisClient().HExists(redis.USER_CHAT_ISNEW,strconv.Itoa(rdata.Uuid)) 335 + exist, err := redishandler.GetRedisClient().HExists(redis.USER_CHAT_ISNEW, strconv.Itoa(rdata.Uuid))
293 if err != nil { 336 if err != nil {
294 logger.Error("HandlequeryNewMessage save failed=%v", err) 337 logger.Error("HandlequeryNewMessage save failed=%v", err)
295 resp.Result.Code = ERROR_SRVDB_FAILED 338 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -303,7 +346,7 @@ func HandlequeryNewMessage(w http.ResponseWriter, data string) { @@ -303,7 +346,7 @@ func HandlequeryNewMessage(w http.ResponseWriter, data string) {
303 } 346 }
304 347
305 //如果没有 则进行判断 348 //如果没有 则进行判断
306 - isnew,err := CheckHasNewMessage(rdata.Uuid) 349 + isnew, err := CheckHasNewMessage(rdata.Uuid)
307 if err != nil { 350 if err != nil {
308 logger.Error("HandlequeryNewMessage CheckHasNewMessage failed=%v", err) 351 logger.Error("HandlequeryNewMessage CheckHasNewMessage failed=%v", err)
309 resp.Result.Code = ERROR_SRVDB_FAILED 352 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -337,23 +380,22 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -337,23 +380,22 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
337 break 380 break
338 } 381 }
339 382
340 -  
341 // 383 //
342 rkey := redis.USER_NEW_DATA_KEY + strconv.Itoa(rdata.Uuid) 384 rkey := redis.USER_NEW_DATA_KEY + strconv.Itoa(rdata.Uuid)
343 - val,err := redishandler.GetRedisClient().GetString(rkey) 385 + val, err := redishandler.GetRedisClient().GetString(rkey)
344 if err != nil { 386 if err != nil {
345 //如果没有 直接保存即可 387 //如果没有 直接保存即可
346 var tmp1 GetDataSaveDesc 388 var tmp1 GetDataSaveDesc
347 tmp1.Data_uid = strconv.Itoa(rdata.Uuid) 389 tmp1.Data_uid = strconv.Itoa(rdata.Uuid)
348 tmp1.Data_value = rdata.Value 390 tmp1.Data_value = rdata.Value
349 - savestr,err:= json.Marshal(&tmp1) 391 + savestr, err := json.Marshal(&tmp1)
350 if err != nil { 392 if err != nil {
351 logger.Error("HandleNewSaveData failed7,err=%v", err) 393 logger.Error("HandleNewSaveData failed7,err=%v", err)
352 resp.Result.Code = ERROR_SRVDB_FAILED 394 resp.Result.Code = ERROR_SRVDB_FAILED
353 resp.Result.Data = "ERROR_SRVDB_FAILED" 395 resp.Result.Data = "ERROR_SRVDB_FAILED"
354 break 396 break
355 } 397 }
356 - err = redishandler.GetRedisClient().SetString(rkey,string(savestr)) 398 + err = redishandler.GetRedisClient().SetString(rkey, string(savestr))
357 if err != nil { 399 if err != nil {
358 logger.Error("HandleNewSaveData failed7,err=%v", err) 400 logger.Error("HandleNewSaveData failed7,err=%v", err)
359 resp.Result.Code = ERROR_SRVDB_FAILED 401 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -378,7 +420,7 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -378,7 +420,7 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
378 420
379 //break*/ 421 //break*/
380 } 422 }
381 - val,_ = redishandler.GetRedisClient().GetString(rkey) 423 + val, _ = redishandler.GetRedisClient().GetString(rkey)
382 var final GetDataSaveDesc 424 var final GetDataSaveDesc
383 err = json.Unmarshal([]byte(val), &final) 425 err = json.Unmarshal([]byte(val), &final)
384 if err != nil { 426 if err != nil {
@@ -388,7 +430,6 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -388,7 +430,6 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
388 } 430 }
389 val = final.Data_value 431 val = final.Data_value
390 432
391 -  
392 //解析val json 433 //解析val json
393 m1 := make(map[string]interface{}) 434 m1 := make(map[string]interface{})
394 err = json.Unmarshal([]byte(val), &m1) 435 err = json.Unmarshal([]byte(val), &m1)
@@ -410,31 +451,31 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -410,31 +451,31 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
410 //比较猫数据 451 //比较猫数据
411 catmap1 := m1["catData"].(map[string]interface{}) 452 catmap1 := m1["catData"].(map[string]interface{})
412 catmap2 := m2["catData"].(map[string]interface{}) 453 catmap2 := m2["catData"].(map[string]interface{})
413 - logger.Info("HandleNewSaveData catmap1=%v",catmap1)  
414 - logger.Info("HandleNewSaveData catmap2=%v",catmap2) 454 + logger.Info("HandleNewSaveData catmap1=%v", catmap1)
  455 + logger.Info("HandleNewSaveData catmap2=%v", catmap2)
415 if len(catmap2) < len(catmap1) { 456 if len(catmap2) < len(catmap1) {
416 logger.Error("HandleNewSaveData failed1,err=%v", err) 457 logger.Error("HandleNewSaveData failed1,err=%v", err)
417 resp.Result.Code = ERROR_SRVDB_FAILED 458 resp.Result.Code = ERROR_SRVDB_FAILED
418 resp.Result.Data = "ERROR_SRVDB_FAILED" 459 resp.Result.Data = "ERROR_SRVDB_FAILED"
419 break 460 break
420 } 461 }
421 - for k,vak := range catmap2 { 462 + for k, vak := range catmap2 {
422 if catmap1[k] != nil { 463 if catmap1[k] != nil {
423 //需要比较等级 464 //需要比较等级
424 c2 := vak.(map[string]interface{}) 465 c2 := vak.(map[string]interface{})
425 c1 := catmap1[k].(map[string]interface{}) 466 c1 := catmap1[k].(map[string]interface{})
426 - if c1["level"]!= nil && c2["level"]!= nil {  
427 - logger.Info("HandleNewSaveData c1=%v c2=%v",c1["level"],c2["level"]) 467 + if c1["level"] != nil && c2["level"] != nil {
  468 + logger.Info("HandleNewSaveData c1=%v c2=%v", c1["level"], c2["level"])
428 if c2["level"].(float64) < c1["level"].(float64) { 469 if c2["level"].(float64) < c1["level"].(float64) {
429 logger.Error("HandleNewSaveData failed2,err=%v", err) 470 logger.Error("HandleNewSaveData failed2,err=%v", err)
430 resp.Result.Code = ERROR_SRVDB_FAILED 471 resp.Result.Code = ERROR_SRVDB_FAILED
431 resp.Result.Data = "ERROR_SRVDB_FAILED" 472 resp.Result.Data = "ERROR_SRVDB_FAILED"
432 break 473 break
433 } 474 }
434 - }else {  
435 - logger.Error("HandleNewSaveData failed11,k=%v",k) 475 + } else {
  476 + logger.Error("HandleNewSaveData failed11,k=%v", k)
436 } 477 }
437 - }else { 478 + } else {
438 //logger.Error("HandleNewSaveData failed10,k=%v",k) 479 //logger.Error("HandleNewSaveData failed10,k=%v",k)
439 } 480 }
440 } 481 }
@@ -442,15 +483,15 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -442,15 +483,15 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
442 //比较roomData 483 //比较roomData
443 roommap1 := m1["roomData"].(map[string]interface{}) 484 roommap1 := m1["roomData"].(map[string]interface{})
444 roommap2 := m2["roomData"].(map[string]interface{}) 485 roommap2 := m2["roomData"].(map[string]interface{})
445 - logger.Info("HandleNewSaveData catmap1=%v",roommap1)  
446 - logger.Info("HandleNewSaveData catmap2=%v",roommap2) 486 + logger.Info("HandleNewSaveData catmap1=%v", roommap1)
  487 + logger.Info("HandleNewSaveData catmap2=%v", roommap2)
447 if len(roommap2) < len(roommap1) { 488 if len(roommap2) < len(roommap1) {
448 logger.Error("HandleNewSaveData failed3,err=%v", err) 489 logger.Error("HandleNewSaveData failed3,err=%v", err)
449 resp.Result.Code = ERROR_SRVDB_FAILED 490 resp.Result.Code = ERROR_SRVDB_FAILED
450 resp.Result.Data = "ERROR_SRVDB_FAILED" 491 resp.Result.Data = "ERROR_SRVDB_FAILED"
451 break 492 break
452 } 493 }
453 - for k,val := range roommap2 { 494 + for k, val := range roommap2 {
454 if roommap1[k] != nil { 495 if roommap1[k] != nil {
455 r2 := val.(map[string]interface{}) 496 r2 := val.(map[string]interface{})
456 r1 := roommap1[k].(map[string]interface{}) 497 r1 := roommap1[k].(map[string]interface{})
@@ -465,8 +506,8 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -465,8 +506,8 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
465 }*/ 506 }*/
466 507
467 //比较furnitData 508 //比较furnitData
468 - rrr2 := r2["furnitData"].(map[string]interface{})  
469 - rrr1 := r1["furnitData"].(map[string]interface{}) 509 + rrr2 := r2["furnitData"].(map[string]interface{})
  510 + rrr1 := r1["furnitData"].(map[string]interface{})
470 if len(rrr2) < len(rrr1) { 511 if len(rrr2) < len(rrr1) {
471 logger.Error("HandleNewSaveData failed5,err=%v", err) 512 logger.Error("HandleNewSaveData failed5,err=%v", err)
472 resp.Result.Code = ERROR_SRVDB_FAILED 513 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -474,24 +515,24 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -474,24 +515,24 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
474 break 515 break
475 } 516 }
476 517
477 - for k,_ := range rrr2 { 518 + for k, _ := range rrr2 {
478 if rrr1[k] != nil { 519 if rrr1[k] != nil {
479 ddtr2 := rrr2[k].(map[string]interface{}) 520 ddtr2 := rrr2[k].(map[string]interface{})
480 ddtr1 := rrr1[k].(map[string]interface{}) 521 ddtr1 := rrr1[k].(map[string]interface{})
481 - if ddtr2["state"]!= nil && ddtr1["state"]!= nil { 522 + if ddtr2["state"] != nil && ddtr1["state"] != nil {
482 if ddtr2["state"].(float64) < ddtr1["state"].(float64) { 523 if ddtr2["state"].(float64) < ddtr1["state"].(float64) {
483 logger.Error("HandleNewSaveData failed15,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) 524 logger.Error("HandleNewSaveData failed15,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64))
484 resp.Result.Code = ERROR_SRVDB_FAILED 525 resp.Result.Code = ERROR_SRVDB_FAILED
485 resp.Result.Data = "ERROR_SRVDB_FAILED" 526 resp.Result.Data = "ERROR_SRVDB_FAILED"
486 break 527 break
487 - }else { 528 + } else {
488 //logger.Error("HandleNewSaveData failed17,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) 529 //logger.Error("HandleNewSaveData failed17,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64))
489 } 530 }
490 - }else { 531 + } else {
491 logger.Error("HandleNewSaveData failed18,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) 532 logger.Error("HandleNewSaveData failed18,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64))
492 } 533 }
493 534
494 - }else { 535 + } else {
495 //logger.Error("HandleNewSaveData failed16,k", k) 536 //logger.Error("HandleNewSaveData failed16,k", k)
496 } 537 }
497 } 538 }
@@ -511,8 +552,8 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -511,8 +552,8 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
511 } 552 }
512 553
513 //签到数据校验 554 //签到数据校验
514 - issign1,ok1 := m1["isSign"].(bool)  
515 - issign2,ok2 := m2["isSign"].(bool) 555 + issign1, ok1 := m1["isSign"].(bool)
  556 + issign2, ok2 := m2["isSign"].(bool)
516 if ok1 && ok2 { 557 if ok1 && ok2 {
517 if !issign2 && issign1 { 558 if !issign2 && issign1 {
518 //无需验证 559 //无需验证
@@ -523,10 +564,10 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -523,10 +564,10 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
523 } 564 }
524 } 565 }
525 566
526 - signNowLoop1,ok1 := m1["signNowLoop"].(float64)  
527 - signNowLoop2,ok2 := m2["signNowLoop"].(float64)  
528 - signLoopId1,ok3 := m2["signLoopId"].(float64)  
529 - signLoopId2,ok4 := m2["signLoopId"].(float64) 567 + signNowLoop1, ok1 := m1["signNowLoop"].(float64)
  568 + signNowLoop2, ok2 := m2["signNowLoop"].(float64)
  569 + signLoopId1, ok3 := m2["signLoopId"].(float64)
  570 + signLoopId2, ok4 := m2["signLoopId"].(float64)
530 if ok1 && ok2 && ok3 && ok4 { 571 if ok1 && ok2 && ok3 && ok4 {
531 if signLoopId2 < signLoopId1 { 572 if signLoopId2 < signLoopId1 {
532 logger.Error("HandleNewSaveData failed31,err=%v", err) 573 logger.Error("HandleNewSaveData failed31,err=%v", err)
@@ -550,14 +591,14 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { @@ -550,14 +591,14 @@ func HandleNewSaveData(w http.ResponseWriter, data string) {
550 var tmp GetDataSaveDesc 591 var tmp GetDataSaveDesc
551 tmp.Data_uid = strconv.Itoa(rdata.Uuid) 592 tmp.Data_uid = strconv.Itoa(rdata.Uuid)
552 tmp.Data_value = rdata.Value 593 tmp.Data_value = rdata.Value
553 - savestr,err:= json.Marshal(&tmp) 594 + savestr, err := json.Marshal(&tmp)
554 if err != nil { 595 if err != nil {
555 logger.Error("HandleNewSaveData failed7,err=%v", err) 596 logger.Error("HandleNewSaveData failed7,err=%v", err)
556 resp.Result.Code = ERROR_SRVDB_FAILED 597 resp.Result.Code = ERROR_SRVDB_FAILED
557 resp.Result.Data = "ERROR_SRVDB_FAILED" 598 resp.Result.Data = "ERROR_SRVDB_FAILED"
558 break 599 break
559 } 600 }
560 - err = redishandler.GetRedisClient().SetString(rkey,string(savestr)) 601 + err = redishandler.GetRedisClient().SetString(rkey, string(savestr))
561 if err != nil { 602 if err != nil {
562 logger.Error("HandleNewSaveData failed7,err=%v", err) 603 logger.Error("HandleNewSaveData failed7,err=%v", err)
563 resp.Result.Code = ERROR_SRVDB_FAILED 604 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -588,7 +629,7 @@ func HandleSaveDataBackup(w http.ResponseWriter, data string) { @@ -588,7 +629,7 @@ func HandleSaveDataBackup(w http.ResponseWriter, data string) {
588 break 629 break
589 } 630 }
590 631
591 - err = redishandler.GetRedisClient().HSet(redis.USER_BACKUP_DATA,strconv.Itoa(rdata.Uuid),rdata.Value) 632 + err = redishandler.GetRedisClient().HSet(redis.USER_BACKUP_DATA, strconv.Itoa(rdata.Uuid), rdata.Value)
592 if err != nil { 633 if err != nil {
593 logger.Error("HandleQueryInviteWork save failed=%v", err) 634 logger.Error("HandleQueryInviteWork save failed=%v", err)
594 resp.Result.Code = ERROR_SRVDB_FAILED 635 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -622,19 +663,19 @@ func HandleNewGetData(w http.ResponseWriter, data string) { @@ -622,19 +663,19 @@ func HandleNewGetData(w http.ResponseWriter, data string) {
622 //先去取出新的数据 663 //先去取出新的数据
623 rkey := redis.USER_NEW_DATA_KEY + strconv.Itoa(rdata.Uuid) 664 rkey := redis.USER_NEW_DATA_KEY + strconv.Itoa(rdata.Uuid)
624 665
625 - val,err := redishandler.GetRedisClient().GetString(rkey)  
626 - if err != nil {  
627 - logger.Error("HandleNewGetData err=%v",err)  
628 - //如果不存在数据则去老的取  
629 - rkey1 := "cat:cafe:data:where:data_uid:" + strconv.Itoa(rdata.Uuid)  
630 - val,err = redishandler.GetRedisClient().GetString(rkey1)  
631 - if err != nil {  
632 - resp.Result.Data.Base_data = "{}"  
633 - //resp.Result.Code = ERROR_JSONUNMASHFAILED  
634 - break  
635 - }  
636 - isfind = true  
637 - } 666 + val, err := redishandler.GetRedisClient().GetString(rkey)
  667 + if err != nil {
  668 + logger.Error("HandleNewGetData err=%v", err)
  669 + //如果不存在数据则去老的取
  670 + rkey1 := "cat:cafe:data:where:data_uid:" + strconv.Itoa(rdata.Uuid)
  671 + val, err = redishandler.GetRedisClient().GetString(rkey1)
  672 + if err != nil {
  673 + resp.Result.Data.Base_data = "{}"
  674 + //resp.Result.Code = ERROR_JSONUNMASHFAILED
  675 + break
  676 + }
  677 + isfind = true
  678 + }
638 679
639 var final GetDataSaveDesc 680 var final GetDataSaveDesc
640 err = json.Unmarshal([]byte(val), &final) 681 err = json.Unmarshal([]byte(val), &final)
@@ -648,19 +689,18 @@ func HandleNewGetData(w http.ResponseWriter, data string) { @@ -648,19 +689,18 @@ func HandleNewGetData(w http.ResponseWriter, data string) {
648 689
649 //如果是从老的数据过来的 存入新的数据key 690 //如果是从老的数据过来的 存入新的数据key
650 if isfind { 691 if isfind {
651 - err = redishandler.GetRedisClient().SetString(rkey,val) 692 + err = redishandler.GetRedisClient().SetString(rkey, val)
652 if err != nil { 693 if err != nil {
653 - logger.Error("HandleNewGetData err=%v",err) 694 + logger.Error("HandleNewGetData err=%v", err)
654 } 695 }
655 } 696 }
656 697
657 -  
658 break 698 break
659 } 699 }
660 700
661 //回包 701 //回包
662 respstr, _ := json.Marshal(&resp) 702 respstr, _ := json.Marshal(&resp)
663 - logger.Info("HandleNewGetData new is=%v",string(respstr)) 703 + logger.Info("HandleNewGetData new is=%v", string(respstr))
664 fmt.Fprint(w, string(respstr)) 704 fmt.Fprint(w, string(respstr))
665 } 705 }
666 706
@@ -686,7 +726,6 @@ func HandleInitIndex(w http.ResponseWriter, data string) { @@ -686,7 +726,6 @@ func HandleInitIndex(w http.ResponseWriter, data string) {
686 fmt.Fprint(w, string(respstr)) 726 fmt.Fprint(w, string(respstr))
687 } 727 }
688 728
689 -  
690 func HandleQueryInviteWork(w http.ResponseWriter, data string) { 729 func HandleQueryInviteWork(w http.ResponseWriter, data string) {
691 730
692 SetHeader(w) 731 SetHeader(w)
@@ -702,18 +741,18 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) { @@ -702,18 +741,18 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) {
702 break 741 break
703 } 742 }
704 743
705 - dalist,offlist,_ := GetdagongList(rdata.Uuid) 744 + dalist, offlist, _ := GetdagongList(rdata.Uuid)
706 if dalist == nil { 745 if dalist == nil {
707 resp.Result.Code = ERROR_OK 746 resp.Result.Code = ERROR_OK
708 break 747 break
709 } 748 }
710 749
711 - for _,val := range *dalist {  
712 - resp.Result.Data.Invite_data = append(resp.Result.Data.Invite_data,val) 750 + for _, val := range *dalist {
  751 + resp.Result.Data.Invite_data = append(resp.Result.Data.Invite_data, val)
713 } 752 }
714 753
715 - for _,val := range offlist {  
716 - resp.Result.Data.Offlinelist = append(resp.Result.Data.Offlinelist,val) 754 + for _, val := range offlist {
  755 + resp.Result.Data.Offlinelist = append(resp.Result.Data.Offlinelist, val)
717 } 756 }
718 757
719 resp.Result.Code = ERROR_OK 758 resp.Result.Code = ERROR_OK
@@ -725,8 +764,6 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) { @@ -725,8 +764,6 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) {
725 fmt.Fprint(w, string(respstr)) 764 fmt.Fprint(w, string(respstr))
726 } 765 }
727 766
728 -  
729 -  
730 func HandleEnterInvite(w http.ResponseWriter, data string) { 767 func HandleEnterInvite(w http.ResponseWriter, data string) {
731 768
732 SetHeader(w) 769 SetHeader(w)
@@ -749,7 +786,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -749,7 +786,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
749 //邀请新用户 786 //邀请新用户
750 //首先要判断一下这个玩家是否已经被邀请过了 787 //首先要判断一下这个玩家是否已经被邀请过了
751 rkey := redis.USER_BEINVITE_UUIDRELATION + ":" + strconv.Itoa(rdata.Inviteuuid) 788 rkey := redis.USER_BEINVITE_UUIDRELATION + ":" + strconv.Itoa(rdata.Inviteuuid)
752 - exist,err := redishandler.GetRedisClient().HExists(rkey,strconv.Itoa(rdata.Selfuuid)) 789 + exist, err := redishandler.GetRedisClient().HExists(rkey, strconv.Itoa(rdata.Selfuuid))
753 if err != nil { 790 if err != nil {
754 logger.Error("HandleEnterInvite redis failed=%v", err) 791 logger.Error("HandleEnterInvite redis failed=%v", err)
755 resp.Result.Code = ERROR_JSONUNMASHFAILED 792 resp.Result.Code = ERROR_JSONUNMASHFAILED
@@ -764,17 +801,16 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -764,17 +801,16 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
764 break 801 break
765 } 802 }
766 803
767 -  
768 //记录被邀请关系 804 //记录被邀请关系
769 - redishandler.GetRedisClient().HSet(rkey,strconv.Itoa(rdata.Selfuuid),strconv.Itoa(rdata.Selfuuid)) 805 + redishandler.GetRedisClient().HSet(rkey, strconv.Itoa(rdata.Selfuuid), strconv.Itoa(rdata.Selfuuid))
770 806
771 //记录邀请关系 807 //记录邀请关系
772 rkey = redis.USER_INVITEREWARD_FETCH_REWARD + ":" + strconv.Itoa(rdata.Inviteuuid) 808 rkey = redis.USER_INVITEREWARD_FETCH_REWARD + ":" + strconv.Itoa(rdata.Inviteuuid)
773 - redishandler.GetRedisClient().HSet(rkey,strconv.Itoa(rdata.Selfuuid),"0")  
774 - }else { 809 + redishandler.GetRedisClient().HSet(rkey, strconv.Itoa(rdata.Selfuuid), "0")
  810 + } else {
775 //邀请打工 811 //邀请打工
776 //invitelist,err := GetdagongList(rdata.Inviteuuid) 812 //invitelist,err := GetdagongList(rdata.Inviteuuid)
777 - invitelist,reallist,err :=GetRealDagonglist(rdata.Inviteuuid) 813 + invitelist, reallist, err := GetRealDagonglist(rdata.Inviteuuid)
778 if err != nil { 814 if err != nil {
779 /*logger.Error("HandleEnterInvite GetdagongList failed") 815 /*logger.Error("HandleEnterInvite GetdagongList failed")
780 resp.Result.Code = ERROR_SRVDB_FAILED 816 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -783,7 +819,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -783,7 +819,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
783 } 819 }
784 820
785 if reallist != nil { 821 if reallist != nil {
786 - if len(*reallist) > 2 { 822 + if len(*reallist) > 2 {
787 logger.Error("HandleEnterInvite dagong num is full") 823 logger.Error("HandleEnterInvite dagong num is full")
788 resp.Result.Code = ERROR_DAGONG_FULL 824 resp.Result.Code = ERROR_DAGONG_FULL
789 //resp.Message = "dagong full" 825 //resp.Message = "dagong full"
@@ -799,26 +835,24 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -799,26 +835,24 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
799 } 835 }
800 836
801 if invitelist != nil { 837 if invitelist != nil {
802 - err = AddDagongList(rdata.Selfuuid,rdata.Inviteuuid,*invitelist)  
803 - }else { 838 + err = AddDagongList(rdata.Selfuuid, rdata.Inviteuuid, *invitelist)
  839 + } else {
804 //此时列表为空 新建一个 840 //此时列表为空 新建一个
805 var newlist WorkList 841 var newlist WorkList
806 - err = AddDagongList(rdata.Selfuuid,rdata.Inviteuuid,newlist) 842 + err = AddDagongList(rdata.Selfuuid, rdata.Inviteuuid, newlist)
807 } 843 }
808 844
809 -  
810 - }else { 845 + } else {
811 //此时列表为空 新建一个 846 //此时列表为空 新建一个
812 if invitelist != nil { 847 if invitelist != nil {
813 - err = AddDagongList(rdata.Selfuuid,rdata.Inviteuuid,*invitelist)  
814 - }else { 848 + err = AddDagongList(rdata.Selfuuid, rdata.Inviteuuid, *invitelist)
  849 + } else {
815 //此时列表为空 新建一个 850 //此时列表为空 新建一个
816 var newlist WorkList 851 var newlist WorkList
817 - err = AddDagongList(rdata.Selfuuid,rdata.Inviteuuid,newlist) 852 + err = AddDagongList(rdata.Selfuuid, rdata.Inviteuuid, newlist)
818 } 853 }
819 } 854 }
820 855
821 -  
822 if err != nil { 856 if err != nil {
823 logger.Error("HandleEnterInvite ERROR_SRVDB_FAILED") 857 logger.Error("HandleEnterInvite ERROR_SRVDB_FAILED")
824 resp.Result.Code = ERROR_SRVDB_FAILED 858 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -827,7 +861,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -827,7 +861,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
827 } 861 }
828 } 862 }
829 863
830 -  
831 resp.Result.Code = ERROR_OK 864 resp.Result.Code = ERROR_OK
832 break 865 break
833 } 866 }
@@ -837,7 +870,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { @@ -837,7 +870,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) {
837 fmt.Fprint(w, string(respstr)) 870 fmt.Fprint(w, string(respstr))
838 } 871 }
839 872
840 -  
841 func HandleFetchInviteReward(w http.ResponseWriter, data string) { 873 func HandleFetchInviteReward(w http.ResponseWriter, data string) {
842 874
843 SetHeader(w) 875 SetHeader(w)
@@ -854,7 +886,7 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) { @@ -854,7 +886,7 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) {
854 } 886 }
855 887
856 rkey := redis.USER_INVITEREWARD_FETCH_REWARD + ":" + strconv.Itoa(rdata.Selfuuid) 888 rkey := redis.USER_INVITEREWARD_FETCH_REWARD + ":" + strconv.Itoa(rdata.Selfuuid)
857 - fetch,err := redishandler.GetRedisClient().HGet(rkey,strconv.Itoa(rdata.Fuuid)) 889 + fetch, err := redishandler.GetRedisClient().HGet(rkey, strconv.Itoa(rdata.Fuuid))
858 if err != nil { 890 if err != nil {
859 logger.Error("HandleFetchInviteReward redis failed=%v", err) 891 logger.Error("HandleFetchInviteReward redis failed=%v", err)
860 resp.Result.Code = ERROR_JSONUNMASHFAILED 892 resp.Result.Code = ERROR_JSONUNMASHFAILED
@@ -870,7 +902,7 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) { @@ -870,7 +902,7 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) {
870 } 902 }
871 903
872 //将领取记录记录 904 //将领取记录记录
873 - redishandler.GetRedisClient().HSet(rkey,strconv.Itoa(rdata.Fuuid),"1") 905 + redishandler.GetRedisClient().HSet(rkey, strconv.Itoa(rdata.Fuuid), "1")
874 906
875 resp.Result.Code = ERROR_OK 907 resp.Result.Code = ERROR_OK
876 break 908 break
@@ -881,7 +913,6 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) { @@ -881,7 +913,6 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) {
881 fmt.Fprint(w, string(respstr)) 913 fmt.Fprint(w, string(respstr))
882 } 914 }
883 915
884 -  
885 func HandleRegeister(w http.ResponseWriter, data string) { 916 func HandleRegeister(w http.ResponseWriter, data string) {
886 917
887 SetHeader(w) 918 SetHeader(w)
@@ -900,7 +931,7 @@ func HandleRegeister(w http.ResponseWriter, data string) { @@ -900,7 +931,7 @@ func HandleRegeister(w http.ResponseWriter, data string) {
900 //todo 判断密码强度? 931 //todo 判断密码强度?
901 932
902 //判断账号是否重复有 933 //判断账号是否重复有
903 - exist,err := redishandler.GetRedisClient().HExists(redis.USER_ACCOUNT_PASSWORD_KEY,rdata.Account) 934 + exist, err := redishandler.GetRedisClient().HExists(redis.USER_ACCOUNT_PASSWORD_KEY, rdata.Account)
904 if err != nil { 935 if err != nil {
905 logger.Error("HandleRegeister redis failed failed=%v", err) 936 logger.Error("HandleRegeister redis failed failed=%v", err)
906 resp.Result.Code = ERROR_SRVDB_FAILED 937 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -913,7 +944,7 @@ func HandleRegeister(w http.ResponseWriter, data string) { @@ -913,7 +944,7 @@ func HandleRegeister(w http.ResponseWriter, data string) {
913 break 944 break
914 } 945 }
915 946
916 - err = SaveAccount(rdata.Account,rdata.Password) 947 + err = SaveAccount(rdata.Account, rdata.Password)
917 if err != nil { 948 if err != nil {
918 logger.Error("HandleRegeister redis failed failed=%v", err) 949 logger.Error("HandleRegeister redis failed failed=%v", err)
919 resp.Result.Code = ERROR_SRVDB_FAILED 950 resp.Result.Code = ERROR_SRVDB_FAILED
@@ -932,7 +963,6 @@ func HandleRegeister(w http.ResponseWriter, data string) { @@ -932,7 +963,6 @@ func HandleRegeister(w http.ResponseWriter, data string) {
932 fmt.Fprint(w, string(respstr)) 963 fmt.Fprint(w, string(respstr))
933 } 964 }
934 965
935 -  
936 func HandleAccounLogin(w http.ResponseWriter, data string) { 966 func HandleAccounLogin(w http.ResponseWriter, data string) {
937 967
938 SetHeader(w) 968 SetHeader(w)
@@ -948,7 +978,7 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { @@ -948,7 +978,7 @@ func HandleAccounLogin(w http.ResponseWriter, data string) {
948 break 978 break
949 } 979 }
950 980
951 - err := CheckAccout(rdata.Account,rdata.Password) 981 + err := CheckAccout(rdata.Account, rdata.Password)
952 982
953 if err != nil { 983 if err != nil {
954 logger.Error("HandleRegeister pwssword failed failed=%v", err) 984 logger.Error("HandleRegeister pwssword failed failed=%v", err)
@@ -959,14 +989,14 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { @@ -959,14 +989,14 @@ func HandleAccounLogin(w http.ResponseWriter, data string) {
959 //查询数据 989 //查询数据
960 token := GetAccountToken(rdata.Account) 990 token := GetAccountToken(rdata.Account)
961 991
962 - uuid,err := GetTouristUid(token)  
963 - if err != nil || uuid==0{ 992 + uuid, err := GetTouristUid(token)
  993 + if err != nil || uuid == 0 {
964 logger.Error("HandleAccounLogin getuuid failed=%v", err) 994 logger.Error("HandleAccounLogin getuuid failed=%v", err)
965 resp.Result.Code = ERROR_GETUSERIDFAILED 995 resp.Result.Code = ERROR_GETUSERIDFAILED
966 break 996 break
967 } 997 }
968 998
969 - basic,err := GetUserBasic(uuid) 999 + basic, err := GetUserBasic(uuid)
970 if err != nil { 1000 if err != nil {
971 logger.Error("HandleAccounLogin getbasic failed=%v", err) 1001 logger.Error("HandleAccounLogin getbasic failed=%v", err)
972 resp.Result.Code = ERROR_GETUSERBASICFAILED 1002 resp.Result.Code = ERROR_GETUSERBASICFAILED
@@ -974,21 +1004,20 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { @@ -974,21 +1004,20 @@ func HandleAccounLogin(w http.ResponseWriter, data string) {
974 } 1004 }
975 resp.Result.Data.Dasedata = *basic 1005 resp.Result.Data.Dasedata = *basic
976 1006
977 - ext,err := GetUserExt(uuid) 1007 + ext, err := GetUserExt(uuid)
978 if err != nil { 1008 if err != nil {
979 logger.Error("HandleAccounLogin getext failed=%v", err) 1009 logger.Error("HandleAccounLogin getext failed=%v", err)
980 resp.Result.Code = ERROR_GETUSEREXTFAILED 1010 resp.Result.Code = ERROR_GETUSEREXTFAILED
981 break 1011 break
982 } 1012 }
983 - TransmitUserData(ext,&resp.Result.Data.Extdata) 1013 + TransmitUserData(ext, &resp.Result.Data.Extdata)
984 1014
985 //需要处理登录数据 1015 //需要处理登录数据
986 HandleLoginTime(ext) 1016 HandleLoginTime(ext)
987 1017
988 - m_userInfo.Set(uint32(ext.Userid),ext) 1018 + m_userInfo.Set(uint32(ext.Userid), ext)
989 SaveUserExt(ext) 1019 SaveUserExt(ext)
990 1020
991 -  
992 resp.Result.Code = ERROR_OK 1021 resp.Result.Code = ERROR_OK
993 break 1022 break
994 } 1023 }
@@ -998,7 +1027,6 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { @@ -998,7 +1027,6 @@ func HandleAccounLogin(w http.ResponseWriter, data string) {
998 fmt.Fprint(w, string(respstr)) 1027 fmt.Fprint(w, string(respstr))
999 } 1028 }
1000 1029
1001 -  
1002 //处理微信登录 1030 //处理微信登录
1003 func HandleWechatlogin(w http.ResponseWriter, data string) { 1031 func HandleWechatlogin(w http.ResponseWriter, data string) {
1004 1032
@@ -1022,15 +1050,15 @@ func HandleWechatlogin(w http.ResponseWriter, data string) { @@ -1022,15 +1050,15 @@ func HandleWechatlogin(w http.ResponseWriter, data string) {
1022 resp.Result.Code = ERROR_WECHATLOGINFAILED 1050 resp.Result.Code = ERROR_WECHATLOGINFAILED
1023 break 1051 break
1024 } 1052 }
1025 - logger.Info("HandleWechatlogin userInfo=%v",userInfo) 1053 + logger.Info("HandleWechatlogin userInfo=%v", userInfo)
1026 1054
1027 - uuid,_ := GetTouristUid(userInfo.OpenID) 1055 + uuid, _ := GetTouristUid(userInfo.OpenID)
1028 if uuid == 0 { 1056 if uuid == 0 {
1029 //新的账号 需要初始化保存 1057 //新的账号 需要初始化保存
1030 - InitWeChatUser(&rdata,&resp,userInfo)  
1031 - }else { 1058 + InitWeChatUser(&rdata, &resp, userInfo)
  1059 + } else {
1032 //读取数据 1060 //读取数据
1033 - basic,err := GetUserBasic(uuid) 1061 + basic, err := GetUserBasic(uuid)
1034 if err != nil { 1062 if err != nil {
1035 logger.Error("HandleWechatlogin getbasic failed=%v", err) 1063 logger.Error("HandleWechatlogin getbasic failed=%v", err)
1036 resp.Result.Code = ERROR_GETUSERBASICFAILED 1064 resp.Result.Code = ERROR_GETUSERBASICFAILED
@@ -1038,25 +1066,22 @@ func HandleWechatlogin(w http.ResponseWriter, data string) { @@ -1038,25 +1066,22 @@ func HandleWechatlogin(w http.ResponseWriter, data string) {
1038 } 1066 }
1039 resp.Result.Data.Dasedata = *basic 1067 resp.Result.Data.Dasedata = *basic
1040 1068
1041 - ext,err := GetUserExt(uuid) 1069 + ext, err := GetUserExt(uuid)
1042 if err != nil { 1070 if err != nil {
1043 logger.Error("HandleWechatlogin getext failed=%v", err) 1071 logger.Error("HandleWechatlogin getext failed=%v", err)
1044 resp.Result.Code = ERROR_GETUSEREXTFAILED 1072 resp.Result.Code = ERROR_GETUSEREXTFAILED
1045 break 1073 break
1046 } 1074 }
1047 - TransmitUserData(ext,&resp.Result.Data.Extdata) 1075 + TransmitUserData(ext, &resp.Result.Data.Extdata)
1048 //resp.Result.Data.Extdata = *ext 1076 //resp.Result.Data.Extdata = *ext
1049 1077
1050 //需要处理登录数据 1078 //需要处理登录数据
1051 HandleLoginTime(ext) 1079 HandleLoginTime(ext)
1052 1080
1053 - m_userInfo.Set(uint32(ext.Userid),ext) 1081 + m_userInfo.Set(uint32(ext.Userid), ext)
1054 SaveUserExt(ext) 1082 SaveUserExt(ext)
1055 } 1083 }
1056 1084
1057 -  
1058 -  
1059 -  
1060 resp.Result.Code = ERROR_OK 1085 resp.Result.Code = ERROR_OK
1061 break 1086 break
1062 } 1087 }
@@ -1067,18 +1092,18 @@ func HandleWechatlogin(w http.ResponseWriter, data string) { @@ -1067,18 +1092,18 @@ func HandleWechatlogin(w http.ResponseWriter, data string) {
1067 } 1092 }
1068 1093
1069 //处理游客登录 1094 //处理游客登录
1070 -func HandleTouristLogin(w http.ResponseWriter, req *UserLoginReq,resp *UserLoginResp) { 1095 +func HandleTouristLogin(w http.ResponseWriter, req *UserLoginReq, resp *UserLoginResp) {
1071 1096
1072 - logger.Info("HandleTouristLogin req=%v,resp=%v",req,resp) 1097 + logger.Info("HandleTouristLogin req=%v,resp=%v", req, resp)
1073 for { 1098 for {
1074 //首先判断是否存在这个游客账号 1099 //首先判断是否存在这个游客账号
1075 - uuid,err := GetTouristUid(req.Token) 1100 + uuid, err := GetTouristUid(req.Token)
1076 if err != nil { 1101 if err != nil {
1077 //新账号 初始化 1102 //新账号 初始化
1078 - InitTourist(req,resp)  
1079 - }else { 1103 + InitTourist(req, resp)
  1104 + } else {
1080 //读取数据 1105 //读取数据
1081 - basic,err := GetUserBasic(uuid) 1106 + basic, err := GetUserBasic(uuid)
1082 if err != nil { 1107 if err != nil {
1083 logger.Error("HandleTouristLogin getbasic failed=%v", err) 1108 logger.Error("HandleTouristLogin getbasic failed=%v", err)
1084 resp.Result.Code = ERROR_GETUSERBASICFAILED 1109 resp.Result.Code = ERROR_GETUSERBASICFAILED
@@ -1086,16 +1111,16 @@ func HandleTouristLogin(w http.ResponseWriter, req *UserLoginReq,resp *UserLogin @@ -1086,16 +1111,16 @@ func HandleTouristLogin(w http.ResponseWriter, req *UserLoginReq,resp *UserLogin
1086 } 1111 }
1087 resp.Result.Data.Dasedata = *basic 1112 resp.Result.Data.Dasedata = *basic
1088 1113
1089 - ext,err := GetUserExt(uuid) 1114 + ext, err := GetUserExt(uuid)
1090 if err != nil { 1115 if err != nil {
1091 logger.Error("HandleTouristLogin getext failed=%v", err) 1116 logger.Error("HandleTouristLogin getext failed=%v", err)
1092 resp.Result.Code = ERROR_GETUSEREXTFAILED 1117 resp.Result.Code = ERROR_GETUSEREXTFAILED
1093 break 1118 break
1094 } 1119 }
1095 //resp.Result.Data.Extdata = *ext 1120 //resp.Result.Data.Extdata = *ext
1096 - TransmitUserData(ext,&resp.Result.Data.Extdata) 1121 + TransmitUserData(ext, &resp.Result.Data.Extdata)
1097 1122
1098 - m_userInfo.Set(uint32(ext.Userid),ext) 1123 + m_userInfo.Set(uint32(ext.Userid), ext)
1099 SaveUserExt(ext) 1124 SaveUserExt(ext)
1100 } 1125 }
1101 1126
@@ -1121,12 +1146,7 @@ func HandleUserLogin(w http.ResponseWriter, data string) { @@ -1121,12 +1146,7 @@ func HandleUserLogin(w http.ResponseWriter, data string) {
1121 break 1146 break
1122 } 1147 }
1123 1148
1124 -  
1125 - HandleTouristLogin(w,&rdata,&resp)  
1126 -  
1127 -  
1128 -  
1129 - 1149 + HandleTouristLogin(w, &rdata, &resp)
1130 1150
1131 } 1151 }
1132 1152
@@ -1149,8 +1169,8 @@ func HandleSaveUserData(w http.ResponseWriter, data string) { @@ -1149,8 +1169,8 @@ func HandleSaveUserData(w http.ResponseWriter, data string) {
1149 break 1169 break
1150 } 1170 }
1151 1171
1152 - uuid,err := GetTouristUid(rdata.Token)  
1153 - if err != nil || uuid==0{ 1172 + uuid, err := GetTouristUid(rdata.Token)
  1173 + if err != nil || uuid == 0 {
1154 logger.Error("HandleSaveUserData json unmarshal failed=%v", err) 1174 logger.Error("HandleSaveUserData json unmarshal failed=%v", err)
1155 resp.Result.Code = ERROR_GETUSERIDFAILED 1175 resp.Result.Code = ERROR_GETUSERIDFAILED
1156 break 1176 break
@@ -1171,7 +1191,7 @@ func HandleSaveUserData(w http.ResponseWriter, data string) { @@ -1171,7 +1191,7 @@ func HandleSaveUserData(w http.ResponseWriter, data string) {
1171 uinfo.Shopnum = rdata.Shopnum 1191 uinfo.Shopnum = rdata.Shopnum
1172 SaveUserExt(uinfo) 1192 SaveUserExt(uinfo)
1173 1193
1174 - basic,err := GetUserBasic(uuid) 1194 + basic, err := GetUserBasic(uuid)
1175 if err != nil { 1195 if err != nil {
1176 logger.Error("HandleTouristLogin getbasic failed=%v", err) 1196 logger.Error("HandleTouristLogin getbasic failed=%v", err)
1177 resp.Result.Code = ERROR_GETUSERBASICFAILED 1197 resp.Result.Code = ERROR_GETUSERBASICFAILED
@@ -1179,14 +1199,14 @@ func HandleSaveUserData(w http.ResponseWriter, data string) { @@ -1179,14 +1199,14 @@ func HandleSaveUserData(w http.ResponseWriter, data string) {
1179 } 1199 }
1180 resp.Result.Data.Dasedata = *basic 1200 resp.Result.Data.Dasedata = *basic
1181 1201
1182 - ext,err := GetUserExt(uuid) 1202 + ext, err := GetUserExt(uuid)
1183 if err != nil { 1203 if err != nil {
1184 logger.Error("HandleTouristLogin getext failed=%v", err) 1204 logger.Error("HandleTouristLogin getext failed=%v", err)
1185 resp.Result.Code = ERROR_GETUSEREXTFAILED 1205 resp.Result.Code = ERROR_GETUSEREXTFAILED
1186 break 1206 break
1187 } 1207 }
1188 //resp.Result.Data.Extdata = *ext 1208 //resp.Result.Data.Extdata = *ext
1189 - TransmitUserData(ext,&resp.Result.Data.Extdata) 1209 + TransmitUserData(ext, &resp.Result.Data.Extdata)
1190 1210
1191 resp.Result.Code = ERROR_OK 1211 resp.Result.Code = ERROR_OK
1192 break 1212 break
@@ -1211,15 +1231,14 @@ func HandlesaveData(w http.ResponseWriter, data string) { @@ -1211,15 +1231,14 @@ func HandlesaveData(w http.ResponseWriter, data string) {
1211 break 1231 break
1212 } 1232 }
1213 1233
1214 - uuid,err := GetTouristUid(rdata.Token)  
1215 - if err != nil || uuid==0{ 1234 + uuid, err := GetTouristUid(rdata.Token)
  1235 + if err != nil || uuid == 0 {
1216 logger.Error("HandlesaveData GetTouristUid failed=%v", err) 1236 logger.Error("HandlesaveData GetTouristUid failed=%v", err)
1217 resp.Result.Code = ERROR_GETUSERIDFAILED 1237 resp.Result.Code = ERROR_GETUSERIDFAILED
1218 break 1238 break
1219 } 1239 }
1220 1240
1221 -  
1222 - err = SaveUserBaseData(uuid,rdata.Value) 1241 + err = SaveUserBaseData(uuid, rdata.Value)
1223 1242
1224 if err != nil { 1243 if err != nil {
1225 logger.Error("HandlesaveData save failed=%v", err) 1244 logger.Error("HandlesaveData save failed=%v", err)
@@ -1276,18 +1295,18 @@ func HandlegetData(w http.ResponseWriter, data string) { @@ -1276,18 +1295,18 @@ func HandlegetData(w http.ResponseWriter, data string) {
1276 fmt.Fprint(w, string(respstr))*/ 1295 fmt.Fprint(w, string(respstr))*/
1277 } 1296 }
1278 1297
1279 -func GetAccessToken() string{ 1298 +func GetAccessToken() string {
1280 //首先从缓存取kwiffwiffiaowosfwkfko 1299 //首先从缓存取kwiffwiffiaowosfwkfko
1281 - exist,err := redishandler.GetRedisClient().Exists(redis.MSG_CKECK_ACCESSTOKEN) 1300 + exist, err := redishandler.GetRedisClient().Exists(redis.MSG_CKECK_ACCESSTOKEN)
1282 if err != nil { 1301 if err != nil {
1283 - logger.Error("GetAccessToken err=%v",err) 1302 + logger.Error("GetAccessToken err=%v", err)
1284 return "" 1303 return ""
1285 } 1304 }
1286 1305
1287 if exist { 1306 if exist {
1288 - key,err := redishandler.GetRedisClient().GetString(redis.MSG_CKECK_ACCESSTOKEN) 1307 + key, err := redishandler.GetRedisClient().GetString(redis.MSG_CKECK_ACCESSTOKEN)
1289 if err != nil { 1308 if err != nil {
1290 - logger.Error("GetAccessToken err=%v",err) 1309 + logger.Error("GetAccessToken err=%v", err)
1291 return "" 1310 return ""
1292 } 1311 }
1293 1312
@@ -1296,9 +1315,9 @@ func GetAccessToken() string{ @@ -1296,9 +1315,9 @@ func GetAccessToken() string{
1296 1315
1297 //去微信获取 1316 //去微信获取
1298 url := URL_WEIXINGETACCESS_TOKEN + "?grant_type=client_credential&" + "appid=wx572a2a5ec4538f33&" + "secret=b31e2e7406af88fe7395cd178bdb64fc" 1317 url := URL_WEIXINGETACCESS_TOKEN + "?grant_type=client_credential&" + "appid=wx572a2a5ec4538f33&" + "secret=b31e2e7406af88fe7395cd178bdb64fc"
1299 - res,err :=http.Get(url) 1318 + res, err := http.Get(url)
1300 if err != nil { 1319 if err != nil {
1301 - logger.Error("GetAccessToken http failed err=%v",err) 1320 + logger.Error("GetAccessToken http failed err=%v", err)
1302 return "" 1321 return ""
1303 } 1322 }
1304 1323
@@ -1309,8 +1328,8 @@ func GetAccessToken() string{ @@ -1309,8 +1328,8 @@ func GetAccessToken() string{
1309 _ = json.Unmarshal(result, &msgresp) 1328 _ = json.Unmarshal(result, &msgresp)
1310 1329
1311 //存入缓存 1330 //存入缓存
1312 - expiretime,_ :=strconv.Atoi(msgresp.Expires_in)  
1313 - redishandler.GetRedisClient().SetExString(redis.MSG_CKECK_ACCESSTOKEN,msgresp.Access_token,expiretime-60) 1331 + expiretime, _ := strconv.Atoi(msgresp.Expires_in)
  1332 + redishandler.GetRedisClient().SetExString(redis.MSG_CKECK_ACCESSTOKEN, msgresp.Access_token, expiretime-60)
1314 1333
1315 return msgresp.Access_token 1334 return msgresp.Access_token
1316 } 1335 }
@@ -1329,14 +1348,13 @@ func HandleTextCheck(w http.ResponseWriter, data string) { @@ -1329,14 +1348,13 @@ func HandleTextCheck(w http.ResponseWriter, data string) {
1329 break 1348 break
1330 } 1349 }
1331 1350
1332 - uuid,err := GetTouristUid(rdata.Token)  
1333 - if err != nil || uuid==0{ 1351 + uuid, err := GetTouristUid(rdata.Token)
  1352 + if err != nil || uuid == 0 {
1334 logger.Error("HandleTextCheck GetTouristUid failed=%v", err) 1353 logger.Error("HandleTextCheck GetTouristUid failed=%v", err)
1335 resp.Result.Code = ERROR_GETUSERIDFAILED 1354 resp.Result.Code = ERROR_GETUSERIDFAILED
1336 break 1355 break
1337 } 1356 }
1338 1357
1339 -  
1340 //首先获取 1358 //首先获取
1341 msgtoken := GetAccessToken() 1359 msgtoken := GetAccessToken()
1342 msgurl := URL_WEIXINMSG_CHECK + "?access_token=" + msgtoken 1360 msgurl := URL_WEIXINMSG_CHECK + "?access_token=" + msgtoken
@@ -1352,7 +1370,7 @@ func HandleTextCheck(w http.ResponseWriter, data string) { @@ -1352,7 +1370,7 @@ func HandleTextCheck(w http.ResponseWriter, data string) {
1352 body := bytes.NewBuffer(bys) 1370 body := bytes.NewBuffer(bys)
1353 res, err := http.Post(msgurl, "application/json;charset=utf-8", body) 1371 res, err := http.Post(msgurl, "application/json;charset=utf-8", body)
1354 if err != nil { 1372 if err != nil {
1355 - logger.Error(" HandleTextCheck ERROR_HTTPPOSTFAILED err=%v", err) 1373 + logger.Error(" HandleTextCheck ERROR_HTTPPOSTFAILED err=%v", err)
1356 resp.Result.Code = ERROR_HTTPPOSTFAILED 1374 resp.Result.Code = ERROR_HTTPPOSTFAILED
1357 return 1375 return
1358 } 1376 }
@@ -1363,8 +1381,8 @@ func HandleTextCheck(w http.ResponseWriter, data string) { @@ -1363,8 +1381,8 @@ func HandleTextCheck(w http.ResponseWriter, data string) {
1363 var msgresp MsgCheckResp 1381 var msgresp MsgCheckResp
1364 _ = json.Unmarshal(result, &msgresp) 1382 _ = json.Unmarshal(result, &msgresp)
1365 1383
1366 - code,_ := strconv.Atoi(msgresp.Errcode)  
1367 - resp.Result.Code =code 1384 + code, _ := strconv.Atoi(msgresp.Errcode)
  1385 + resp.Result.Code = code
1368 resp.Result.Data = msgresp.Errmsg 1386 resp.Result.Data = msgresp.Errmsg
1369 1387
1370 resp.Result.Code = ERROR_OK 1388 resp.Result.Code = ERROR_OK
@@ -1390,14 +1408,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { @@ -1390,14 +1408,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) {
1390 break 1408 break
1391 } 1409 }
1392 1410
1393 - uuid,err := GetTouristUid(rdata.Token)  
1394 - if err != nil || uuid==0{ 1411 + uuid, err := GetTouristUid(rdata.Token)
  1412 + if err != nil || uuid == 0 {
1395 logger.Error("HandleCreateTeam GetTouristUid failed=%v", err) 1413 logger.Error("HandleCreateTeam GetTouristUid failed=%v", err)
1396 resp.Result.Code = ERROR_GETUSERIDFAILED 1414 resp.Result.Code = ERROR_GETUSERIDFAILED
1397 break 1415 break
1398 } 1416 }
1399 1417
1400 -  
1401 //首先判断一下当前队伍名称是否已经存在 1418 //首先判断一下当前队伍名称是否已经存在
1402 isexist := GetUserTeamNameIsExist(rdata.Name) 1419 isexist := GetUserTeamNameIsExist(rdata.Name)
1403 if isexist { 1420 if isexist {
@@ -1423,7 +1440,7 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { @@ -1423,7 +1440,7 @@ func HandleCreateTeam(w http.ResponseWriter, data string) {
1423 1440
1424 //初始化队伍数据 1441 //初始化队伍数据
1425 var bteaminfo TeamInfo 1442 var bteaminfo TeamInfo
1426 - bteaminfo.MemInfo.MemList = append(bteaminfo.MemInfo.MemList,uuid) 1443 + bteaminfo.MemInfo.MemList = append(bteaminfo.MemInfo.MemList, uuid)
1427 var teaminfo CreateTeamInfo 1444 var teaminfo CreateTeamInfo
1428 teaminfo.Name = rdata.Name 1445 teaminfo.Name = rdata.Name
1429 teaminfo.Status = 0 1446 teaminfo.Status = 0
@@ -1439,13 +1456,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { @@ -1439,13 +1456,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) {
1439 resp.Result.Data.Team_data = teaminfo 1456 resp.Result.Data.Team_data = teaminfo
1440 bteaminfo.BaseInfo = teaminfo 1457 bteaminfo.BaseInfo = teaminfo
1441 //保存队伍数据 1458 //保存队伍数据
1442 - SaveTeamInfo(teaminfo.Id,&bteaminfo) 1459 + SaveTeamInfo(teaminfo.Id, &bteaminfo)
1443 1460
1444 //保存队伍id 1461 //保存队伍id
1445 - SaveTeamToUuid(teaminfo.Id,uuid) 1462 + SaveTeamToUuid(teaminfo.Id, uuid)
1446 1463
1447 //保存队伍名称 1464 //保存队伍名称
1448 - SetUserTeamName(rdata.Name,teaminfo.Id) 1465 + SetUserTeamName(rdata.Name, teaminfo.Id)
1449 1466
1450 resp.Result.Code = ERROR_OK 1467 resp.Result.Code = ERROR_OK
1451 break 1468 break
@@ -1470,14 +1487,13 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { @@ -1470,14 +1487,13 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) {
1470 break 1487 break
1471 } 1488 }
1472 1489
1473 - uuid,err := GetTouristUid(rdata.Token)  
1474 - if err != nil || uuid==0{ 1490 + uuid, err := GetTouristUid(rdata.Token)
  1491 + if err != nil || uuid == 0 {
1475 logger.Error("HandleUpdateTeamData GetTouristUid failed=%v", err) 1492 logger.Error("HandleUpdateTeamData GetTouristUid failed=%v", err)
1476 resp.Result.Code = ERROR_GETUSERIDFAILED 1493 resp.Result.Code = ERROR_GETUSERIDFAILED
1477 break 1494 break
1478 } 1495 }
1479 1496
1480 -  
1481 //首先判断一下当前队伍名称是否已经存在 1497 //首先判断一下当前队伍名称是否已经存在
1482 isexist := GetUserTeamNameIsExist(rdata.Name) 1498 isexist := GetUserTeamNameIsExist(rdata.Name)
1483 if isexist { 1499 if isexist {
@@ -1487,14 +1503,14 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { @@ -1487,14 +1503,14 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) {
1487 } 1503 }
1488 1504
1489 //首先查询teamid 1505 //首先查询teamid
1490 - teamid,err := GetTeamByUuid(uuid) 1506 + teamid, err := GetTeamByUuid(uuid)
1491 if err != nil { 1507 if err != nil {
1492 logger.Error("HandleUpdateTeamData getteamid failed=%v", err) 1508 logger.Error("HandleUpdateTeamData getteamid failed=%v", err)
1493 resp.Result.Code = ERROR_QUERYTEAMID_FAILED 1509 resp.Result.Code = ERROR_QUERYTEAMID_FAILED
1494 break 1510 break
1495 } 1511 }
1496 //查询队伍数据 1512 //查询队伍数据
1497 - teaminfo,err := GetTeamInfo(teamid) 1513 + teaminfo, err := GetTeamInfo(teamid)
1498 if err != nil { 1514 if err != nil {
1499 logger.Error("HandleUpdateTeamData getteaminfo failed=%v", err) 1515 logger.Error("HandleUpdateTeamData getteaminfo failed=%v", err)
1500 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1516 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1519,11 +1535,11 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { @@ -1519,11 +1535,11 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) {
1519 teaminfo.BaseInfo.Update_time = int(time.Now().Unix()) 1535 teaminfo.BaseInfo.Update_time = int(time.Now().Unix())
1520 1536
1521 //保存队伍数据 1537 //保存队伍数据
1522 - SaveTeamInfo(teaminfo.BaseInfo.Id,teaminfo) 1538 + SaveTeamInfo(teaminfo.BaseInfo.Id, teaminfo)
1523 1539
1524 DelUserTeamName(orinname) 1540 DelUserTeamName(orinname)
1525 //保存队伍名称 1541 //保存队伍名称
1526 - SetUserTeamName(rdata.Name,teaminfo.BaseInfo.Id) 1542 + SetUserTeamName(rdata.Name, teaminfo.BaseInfo.Id)
1527 1543
1528 resp.Result.Code = ERROR_OK 1544 resp.Result.Code = ERROR_OK
1529 break 1545 break
@@ -1534,7 +1550,6 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { @@ -1534,7 +1550,6 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) {
1534 fmt.Fprint(w, string(respstr)) 1550 fmt.Fprint(w, string(respstr))
1535 } 1551 }
1536 1552
1537 -  
1538 func HandleJoinTeam(w http.ResponseWriter, data string) { 1553 func HandleJoinTeam(w http.ResponseWriter, data string) {
1539 SetHeader(w) 1554 SetHeader(w)
1540 var resp JoinTeamResp 1555 var resp JoinTeamResp
@@ -1542,22 +1557,22 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { @@ -1542,22 +1557,22 @@ func HandleJoinTeam(w http.ResponseWriter, data string) {
1542 resp.Result.Code = ERROR_OK 1557 resp.Result.Code = ERROR_OK
1543 var rdata JoinTeamReq 1558 var rdata JoinTeamReq
1544 err := json.Unmarshal([]byte(data), &rdata) 1559 err := json.Unmarshal([]byte(data), &rdata)
1545 - for {  
1546 - if err != nil { 1560 + for {
  1561 + if err != nil {
1547 logger.Error("HandleJoinTeam json unmarshal failed=%v", err) 1562 logger.Error("HandleJoinTeam json unmarshal failed=%v", err)
1548 resp.Result.Code = ERROR_JSONUNMASHFAILED 1563 resp.Result.Code = ERROR_JSONUNMASHFAILED
1549 break 1564 break
1550 } 1565 }
1551 1566
1552 - uuid,err := GetTouristUid(rdata.Token)  
1553 - if err != nil || uuid==0{ 1567 + uuid, err := GetTouristUid(rdata.Token)
  1568 + if err != nil || uuid == 0 {
1554 logger.Error("HandleJoinTeam GetTouristUid failed=%v", err) 1569 logger.Error("HandleJoinTeam GetTouristUid failed=%v", err)
1555 resp.Result.Code = ERROR_GETUSERIDFAILED 1570 resp.Result.Code = ERROR_GETUSERIDFAILED
1556 break 1571 break
1557 } 1572 }
1558 1573
1559 //获取店铺数据 1574 //获取店铺数据
1560 - tinfo,err := GetTeamInfo(rdata.Team_id) 1575 + tinfo, err := GetTeamInfo(rdata.Team_id)
1561 if err != nil { 1576 if err != nil {
1562 logger.Error("HandleJoinTeam GetTeamInfoFailed failed=%v", err) 1577 logger.Error("HandleJoinTeam GetTeamInfoFailed failed=%v", err)
1563 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1578 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1595,13 +1610,12 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { @@ -1595,13 +1610,12 @@ func HandleJoinTeam(w http.ResponseWriter, data string) {
1595 break 1610 break
1596 } 1611 }
1597 1612
1598 - tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList,uuid) 1613 + tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList, uuid)
1599 1614
1600 //保存队伍与uuid 1615 //保存队伍与uuid
1601 - SaveTeamToUuid(tinfo.BaseInfo.Id,uuid) 1616 + SaveTeamToUuid(tinfo.BaseInfo.Id, uuid)
1602 //保存队伍数据 1617 //保存队伍数据
1603 - SaveTeamInfo(tinfo.BaseInfo.Id,tinfo)  
1604 - 1618 + SaveTeamInfo(tinfo.BaseInfo.Id, tinfo)
1605 1619
1606 resp.Result.Code = ERROR_OK 1620 resp.Result.Code = ERROR_OK
1607 resp.Result.Data = "" 1621 resp.Result.Data = ""
@@ -1613,7 +1627,6 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { @@ -1613,7 +1627,6 @@ func HandleJoinTeam(w http.ResponseWriter, data string) {
1613 fmt.Fprint(w, string(respstr)) 1627 fmt.Fprint(w, string(respstr))
1614 } 1628 }
1615 1629
1616 -  
1617 func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { 1630 func HandleJoinTeamByInvite(w http.ResponseWriter, data string) {
1618 SetHeader(w) 1631 SetHeader(w)
1619 var resp JoinTeamByInviteResp 1632 var resp JoinTeamByInviteResp
@@ -1628,29 +1641,27 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { @@ -1628,29 +1641,27 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) {
1628 break 1641 break
1629 } 1642 }
1630 1643
1631 - uuid,err := GetTouristUid(rdata.Token)  
1632 - if err != nil || uuid==0{ 1644 + uuid, err := GetTouristUid(rdata.Token)
  1645 + if err != nil || uuid == 0 {
1633 logger.Error("HandleJoinTeamByInvite GetTouristUid failed=%v", err) 1646 logger.Error("HandleJoinTeamByInvite GetTouristUid failed=%v", err)
1634 resp.Result.Code = ERROR_GETUSERIDFAILED 1647 resp.Result.Code = ERROR_GETUSERIDFAILED
1635 break 1648 break
1636 } 1649 }
1637 1650
1638 -  
1639 //获取店铺数据 1651 //获取店铺数据
1640 - teamid,err := GetTeamByUuid(rdata.Inviter_id) 1652 + teamid, err := GetTeamByUuid(rdata.Inviter_id)
1641 if err != nil { 1653 if err != nil {
1642 logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err) 1654 logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err)
1643 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1655 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1644 break 1656 break
1645 } 1657 }
1646 - tinfo ,err := GetTeamInfo(teamid) 1658 + tinfo, err := GetTeamInfo(teamid)
1647 if err != nil { 1659 if err != nil {
1648 logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err) 1660 logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err)
1649 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1661 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1650 break 1662 break
1651 } 1663 }
1652 1664
1653 -  
1654 //判断一下是否已经在队伍中 1665 //判断一下是否已经在队伍中
1655 inteam := tinfo.IsInTeam(uuid) 1666 inteam := tinfo.IsInTeam(uuid)
1656 1667
@@ -1660,14 +1671,12 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { @@ -1660,14 +1671,12 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) {
1660 break 1671 break
1661 } 1672 }
1662 1673
1663 - tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList,uuid)  
1664 - 1674 + tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList, uuid)
1665 1675
1666 //保存队伍与uuid 1676 //保存队伍与uuid
1667 - SaveTeamToUuid(tinfo.BaseInfo.Id,uuid) 1677 + SaveTeamToUuid(tinfo.BaseInfo.Id, uuid)
1668 //保存队伍数据 1678 //保存队伍数据
1669 - SaveTeamInfo(tinfo.BaseInfo.Id,tinfo)  
1670 - 1679 + SaveTeamInfo(tinfo.BaseInfo.Id, tinfo)
1671 1680
1672 resp.Result.Code = ERROR_OK 1681 resp.Result.Code = ERROR_OK
1673 resp.Result.Data = "" 1682 resp.Result.Data = ""
@@ -1679,7 +1688,6 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { @@ -1679,7 +1688,6 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) {
1679 fmt.Fprint(w, string(respstr)) 1688 fmt.Fprint(w, string(respstr))
1680 } 1689 }
1681 1690
1682 -  
1683 func HandleQuitTeam(w http.ResponseWriter, data string) { 1691 func HandleQuitTeam(w http.ResponseWriter, data string) {
1684 SetHeader(w) 1692 SetHeader(w)
1685 var resp QuitTeamResp 1693 var resp QuitTeamResp
@@ -1694,20 +1702,20 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { @@ -1694,20 +1702,20 @@ func HandleQuitTeam(w http.ResponseWriter, data string) {
1694 break 1702 break
1695 } 1703 }
1696 1704
1697 - uuid,err := GetTouristUid(rdata.Token)  
1698 - if err != nil || uuid==0{ 1705 + uuid, err := GetTouristUid(rdata.Token)
  1706 + if err != nil || uuid == 0 {
1699 logger.Error("HandleQuitTeam GetTouristUid failed=%v", err) 1707 logger.Error("HandleQuitTeam GetTouristUid failed=%v", err)
1700 resp.Result.Code = ERROR_GETUSERIDFAILED 1708 resp.Result.Code = ERROR_GETUSERIDFAILED
1701 break 1709 break
1702 } 1710 }
1703 1711
1704 - teamid,err := GetTeamByUuid(uuid) 1712 + teamid, err := GetTeamByUuid(uuid)
1705 if err != nil { 1713 if err != nil {
1706 logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err) 1714 logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err)
1707 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1715 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1708 break 1716 break
1709 } 1717 }
1710 - tinfo ,err := GetTeamInfo(teamid) 1718 + tinfo, err := GetTeamInfo(teamid)
1711 if err != nil { 1719 if err != nil {
1712 logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err) 1720 logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err)
1713 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1721 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1724,24 +1732,22 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { @@ -1724,24 +1732,22 @@ func HandleQuitTeam(w http.ResponseWriter, data string) {
1724 1732
1725 if rdata.Type == 0 { 1733 if rdata.Type == 0 {
1726 //踢人 需要判断是否是队长 1734 //踢人 需要判断是否是队长
1727 - if uuid!=tinfo.BaseInfo.Captain_id { 1735 + if uuid != tinfo.BaseInfo.Captain_id {
1728 logger.Error("HandleQuitTeam not caption failed=%v", err) 1736 logger.Error("HandleQuitTeam not caption failed=%v", err)
1729 resp.Result.Code = ERROR_NOTCAPTION 1737 resp.Result.Code = ERROR_NOTCAPTION
1730 break 1738 break
1731 } 1739 }
1732 - }else { 1740 + } else {
1733 //主动离开 需要扣除投资额 1741 //主动离开 需要扣除投资额
1734 //todo 扣除投资额 1742 //todo 扣除投资额
1735 } 1743 }
1736 1744
1737 -  
1738 //删除成员信息 1745 //删除成员信息
1739 //tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList,uuid) 1746 //tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList,uuid)
1740 tinfo.DelTeamMember(rdata.User_id) 1747 tinfo.DelTeamMember(rdata.User_id)
1741 1748
1742 //保存队伍数据 1749 //保存队伍数据
1743 - SaveTeamInfo(tinfo.BaseInfo.Id,tinfo)  
1744 - 1750 + SaveTeamInfo(tinfo.BaseInfo.Id, tinfo)
1745 1751
1746 resp.Result.Code = ERROR_OK 1752 resp.Result.Code = ERROR_OK
1747 resp.Result.Data = "" 1753 resp.Result.Data = ""
@@ -1753,7 +1759,6 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { @@ -1753,7 +1759,6 @@ func HandleQuitTeam(w http.ResponseWriter, data string) {
1753 fmt.Fprint(w, string(respstr)) 1759 fmt.Fprint(w, string(respstr))
1754 } 1760 }
1755 1761
1756 -  
1757 func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { 1762 func HandleUpdateTeamBuild(w http.ResponseWriter, data string) {
1758 SetHeader(w) 1763 SetHeader(w)
1759 var resp UpdateTeamBuildResp 1764 var resp UpdateTeamBuildResp
@@ -1768,20 +1773,20 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { @@ -1768,20 +1773,20 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) {
1768 break 1773 break
1769 } 1774 }
1770 1775
1771 - uuid,err := GetTouristUid(rdata.Token)  
1772 - if err != nil || uuid==0{ 1776 + uuid, err := GetTouristUid(rdata.Token)
  1777 + if err != nil || uuid == 0 {
1773 logger.Error("HandleUpdateTeamBuild GetTouristUid failed=%v", err) 1778 logger.Error("HandleUpdateTeamBuild GetTouristUid failed=%v", err)
1774 resp.Result.Code = ERROR_GETUSERIDFAILED 1779 resp.Result.Code = ERROR_GETUSERIDFAILED
1775 break 1780 break
1776 } 1781 }
1777 1782
1778 - teamid,err := GetTeamByUuid(uuid) 1783 + teamid, err := GetTeamByUuid(uuid)
1779 if err != nil { 1784 if err != nil {
1780 logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err) 1785 logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err)
1781 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1786 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1782 break 1787 break
1783 } 1788 }
1784 - tinfo ,err := GetTeamInfo(teamid) 1789 + tinfo, err := GetTeamInfo(teamid)
1785 if err != nil { 1790 if err != nil {
1786 logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err) 1791 logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err)
1787 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1792 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1796,15 +1801,14 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { @@ -1796,15 +1801,14 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) {
1796 break 1801 break
1797 } 1802 }
1798 1803
1799 -  
1800 //处理投资 1804 //处理投资
1801 - tinfo.DoDevote(rdata.Build_type,rdata.Assets,uuid,rdata.Muti) 1805 + tinfo.DoDevote(rdata.Build_type, rdata.Assets, uuid, rdata.Muti)
1802 1806
1803 //保存队伍数据 1807 //保存队伍数据
1804 - SaveTeamInfo(tinfo.BaseInfo.Id,tinfo) 1808 + SaveTeamInfo(tinfo.BaseInfo.Id, tinfo)
1805 1809
1806 - for _,val := range tinfo.BInfo.Devote {  
1807 - resp.Result.Data.Build_list = append(resp.Result.Data.Build_list,val) 1810 + for _, val := range tinfo.BInfo.Devote {
  1811 + resp.Result.Data.Build_list = append(resp.Result.Data.Build_list, val)
1808 } 1812 }
1809 1813
1810 resp.Result.Code = ERROR_OK 1814 resp.Result.Code = ERROR_OK
@@ -1830,20 +1834,20 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) { @@ -1830,20 +1834,20 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) {
1830 break 1834 break
1831 } 1835 }
1832 1836
1833 - uuid,err := GetTouristUid(rdata.Token)  
1834 - if err != nil || uuid==0{ 1837 + uuid, err := GetTouristUid(rdata.Token)
  1838 + if err != nil || uuid == 0 {
1835 logger.Error("HandleAddTeamBuff GetTouristUid failed=%v", err) 1839 logger.Error("HandleAddTeamBuff GetTouristUid failed=%v", err)
1836 resp.Result.Code = ERROR_GETUSERIDFAILED 1840 resp.Result.Code = ERROR_GETUSERIDFAILED
1837 break 1841 break
1838 } 1842 }
1839 1843
1840 - teamid,err := GetTeamByUuid(uuid) 1844 + teamid, err := GetTeamByUuid(uuid)
1841 if err != nil { 1845 if err != nil {
1842 logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err) 1846 logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err)
1843 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1847 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1844 break 1848 break
1845 } 1849 }
1846 - tinfo ,err := GetTeamInfo(teamid) 1850 + tinfo, err := GetTeamInfo(teamid)
1847 if err != nil { 1851 if err != nil {
1848 logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err) 1852 logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err)
1849 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1853 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1859,12 +1863,10 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) { @@ -1859,12 +1863,10 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) {
1859 } 1863 }
1860 1864
1861 //处理buff 1865 //处理buff
1862 - tinfo.DoAddBuffTimee(rdata.Build_type,rdata.Muti,&resp)  
1863 - 1866 + tinfo.DoAddBuffTimee(rdata.Build_type, rdata.Muti, &resp)
1864 1867
1865 //保存队伍数据 1868 //保存队伍数据
1866 - SaveTeamInfo(tinfo.BaseInfo.Id,tinfo)  
1867 - 1869 + SaveTeamInfo(tinfo.BaseInfo.Id, tinfo)
1868 1870
1869 resp.Result.Code = ERROR_OK 1871 resp.Result.Code = ERROR_OK
1870 break 1872 break
@@ -1889,38 +1891,37 @@ func HandleGetTeamBuff(w http.ResponseWriter, data string) { @@ -1889,38 +1891,37 @@ func HandleGetTeamBuff(w http.ResponseWriter, data string) {
1889 break 1891 break
1890 } 1892 }
1891 1893
1892 - uuid,err := GetTouristUid(rdata.Token)  
1893 - if err != nil || uuid==0{ 1894 + uuid, err := GetTouristUid(rdata.Token)
  1895 + if err != nil || uuid == 0 {
1894 logger.Error("HandleGetTeamBuff GetTouristUid failed=%v", err) 1896 logger.Error("HandleGetTeamBuff GetTouristUid failed=%v", err)
1895 resp.Result.Code = ERROR_GETUSERIDFAILED 1897 resp.Result.Code = ERROR_GETUSERIDFAILED
1896 break 1898 break
1897 } 1899 }
1898 1900
1899 - teamid,err := GetTeamByUuid(uuid) 1901 + teamid, err := GetTeamByUuid(uuid)
1900 if err != nil { 1902 if err != nil {
1901 logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err) 1903 logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err)
1902 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1904 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1903 break 1905 break
1904 } 1906 }
1905 - tinfo ,err := GetTeamInfo(teamid) 1907 + tinfo, err := GetTeamInfo(teamid)
1906 if err != nil { 1908 if err != nil {
1907 logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err) 1909 logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err)
1908 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1910 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1909 break 1911 break
1910 } 1912 }
1911 1913
1912 -  
1913 //处理buff 1914 //处理buff
1914 - for _,vak := range tinfo.BInfo.Buff { 1915 + for _, vak := range tinfo.BInfo.Buff {
1915 var tmp AddTeamBuffSpec 1916 var tmp AddTeamBuffSpec
1916 tmp.Build_type = vak.Type 1917 tmp.Build_type = vak.Type
1917 - for _,val1 := range vak.BuffInfo { 1918 + for _, val1 := range vak.BuffInfo {
1918 var tmp1 BuffTimeInfo 1919 var tmp1 BuffTimeInfo
1919 tmp1.Buff_begin_time = val1.BeginTime 1920 tmp1.Buff_begin_time = val1.BeginTime
1920 tmp1.Buff_end_time = val1.EndTime 1921 tmp1.Buff_end_time = val1.EndTime
1921 - tmp.Buff_time = append(tmp.Buff_time,tmp1) 1922 + tmp.Buff_time = append(tmp.Buff_time, tmp1)
1922 } 1923 }
1923 - resp.Result.Data.Build_list = append(resp.Result.Data.Build_list,tmp) 1924 + resp.Result.Data.Build_list = append(resp.Result.Data.Build_list, tmp)
1924 } 1925 }
1925 1926
1926 resp.Result.Code = ERROR_OK 1927 resp.Result.Code = ERROR_OK
@@ -1946,20 +1947,20 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { @@ -1946,20 +1947,20 @@ func HandleGetTeamData(w http.ResponseWriter, data string) {
1946 break 1947 break
1947 } 1948 }
1948 1949
1949 - uuid,err := GetTouristUid(rdata.Token)  
1950 - if err != nil || uuid==0{ 1950 + uuid, err := GetTouristUid(rdata.Token)
  1951 + if err != nil || uuid == 0 {
1951 logger.Error("HandleGetTeamData GetTouristUid failed=%v", err) 1952 logger.Error("HandleGetTeamData GetTouristUid failed=%v", err)
1952 resp.Result.Code = ERROR_GETUSERIDFAILED 1953 resp.Result.Code = ERROR_GETUSERIDFAILED
1953 break 1954 break
1954 } 1955 }
1955 1956
1956 - teamid,err := GetTeamByUuid(uuid) 1957 + teamid, err := GetTeamByUuid(uuid)
1957 if err != nil { 1958 if err != nil {
1958 logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err) 1959 logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err)
1959 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1960 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
1960 break 1961 break
1961 } 1962 }
1962 - tinfo ,err := GetTeamInfo(teamid) 1963 + tinfo, err := GetTeamInfo(teamid)
1963 if err != nil { 1964 if err != nil {
1964 logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err) 1965 logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err)
1965 resp.Result.Code = ERROR_GETTEAMINFO_FAILED 1966 resp.Result.Code = ERROR_GETTEAMINFO_FAILED
@@ -1967,15 +1968,15 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { @@ -1967,15 +1968,15 @@ func HandleGetTeamData(w http.ResponseWriter, data string) {
1967 } 1968 }
1968 1969
1969 resp.Result.Data.Team_data = tinfo.BaseInfo 1970 resp.Result.Data.Team_data = tinfo.BaseInfo
1970 - for _,val := range tinfo.MemInfo.MemList { 1971 + for _, val := range tinfo.MemInfo.MemList {
1971 var tmp GetTeamDataTeamUserList 1972 var tmp GetTeamDataTeamUserList
1972 tmp.Uuid = val 1973 tmp.Uuid = val
1973 - resp.Result.Data.Team_user_list = append(resp.Result.Data.Team_user_list,tmp) 1974 + resp.Result.Data.Team_user_list = append(resp.Result.Data.Team_user_list, tmp)
1974 } 1975 }
1975 - for _,val := range tinfo.BInfo.Devote { 1976 + for _, val := range tinfo.BInfo.Devote {
1976 var tmp TeamDevoteInfo 1977 var tmp TeamDevoteInfo
1977 tmp = val 1978 tmp = val
1978 - resp.Result.Data.Build_list.Build_list = append(resp.Result.Data.Build_list.Build_list,tmp) 1979 + resp.Result.Data.Build_list.Build_list = append(resp.Result.Data.Build_list.Build_list, tmp)
1979 } 1980 }
1980 1981
1981 resp.Result.Code = ERROR_OK 1982 resp.Result.Code = ERROR_OK
@@ -1987,7 +1988,6 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { @@ -1987,7 +1988,6 @@ func HandleGetTeamData(w http.ResponseWriter, data string) {
1987 fmt.Fprint(w, string(respstr)) 1988 fmt.Fprint(w, string(respstr))
1988 } 1989 }
1989 1990
1990 -  
1991 func HandleGetDataByUserId(w http.ResponseWriter, data string) { 1991 func HandleGetDataByUserId(w http.ResponseWriter, data string) {
1992 SetHeader(w) 1992 SetHeader(w)
1993 var resp GetDataByUserIdResp 1993 var resp GetDataByUserIdResp
@@ -2002,26 +2002,26 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { @@ -2002,26 +2002,26 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) {
2002 break 2002 break
2003 } 2003 }
2004 2004
2005 - uuid,err := GetTouristUid(rdata.Token)  
2006 - if err != nil || uuid==0{ 2005 + uuid, err := GetTouristUid(rdata.Token)
  2006 + if err != nil || uuid == 0 {
2007 logger.Error("HandleGetDataByUserId GetTouristUid failed=%v", err) 2007 logger.Error("HandleGetDataByUserId GetTouristUid failed=%v", err)
2008 resp.Result.Code = ERROR_GETUSERIDFAILED 2008 resp.Result.Code = ERROR_GETUSERIDFAILED
2009 break 2009 break
2010 } 2010 }
2011 2011
2012 - basic,err := GetUserBasic(rdata.User_id) 2012 + basic, err := GetUserBasic(rdata.User_id)
2013 if err != nil { 2013 if err != nil {
2014 logger.Error("HandleGetDataByUserId GetUserBasic failed=%v", err) 2014 logger.Error("HandleGetDataByUserId GetUserBasic failed=%v", err)
2015 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED 2015 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED
2016 break 2016 break
2017 } 2017 }
2018 - base,err := GetUserBaseData(rdata.User_id) 2018 + base, err := GetUserBaseData(rdata.User_id)
2019 if err != nil { 2019 if err != nil {
2020 logger.Error("HandleGetDataByUserId GetUserBase failed=%v", err) 2020 logger.Error("HandleGetDataByUserId GetUserBase failed=%v", err)
2021 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED 2021 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED
2022 break 2022 break
2023 } 2023 }
2024 - ext,err := GetUserExt(rdata.User_id) 2024 + ext, err := GetUserExt(rdata.User_id)
2025 if err != nil { 2025 if err != nil {
2026 logger.Error("HandleGetDataByUserId GetUserExt failed=%v", err) 2026 logger.Error("HandleGetDataByUserId GetUserExt failed=%v", err)
2027 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED 2027 resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED
@@ -2031,7 +2031,7 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { @@ -2031,7 +2031,7 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) {
2031 resp.Result.Data.Base_data = base 2031 resp.Result.Data.Base_data = base
2032 resp.Result.Data.User_base_data = *basic 2032 resp.Result.Data.User_base_data = *basic
2033 //resp.Result.Data.Extdata = *ext 2033 //resp.Result.Data.Extdata = *ext
2034 - TransmitUserData(ext,&resp.Result.Data.Extdata) 2034 + TransmitUserData(ext, &resp.Result.Data.Extdata)
2035 resp.Result.Code = ERROR_OK 2035 resp.Result.Code = ERROR_OK
2036 break 2036 break
2037 } 2037 }
@@ -2041,7 +2041,6 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { @@ -2041,7 +2041,6 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) {
2041 fmt.Fprint(w, string(respstr)) 2041 fmt.Fprint(w, string(respstr))
2042 } 2042 }
2043 2043
2044 -  
2045 func HandleGetTeamList(w http.ResponseWriter, data string) { 2044 func HandleGetTeamList(w http.ResponseWriter, data string) {
2046 SetHeader(w) 2045 SetHeader(w)
2047 var resp GetTeamListResp 2046 var resp GetTeamListResp
@@ -2056,14 +2055,14 @@ func HandleGetTeamList(w http.ResponseWriter, data string) { @@ -2056,14 +2055,14 @@ func HandleGetTeamList(w http.ResponseWriter, data string) {
2056 break 2055 break
2057 } 2056 }
2058 2057
2059 - uuid,err := GetTouristUid(rdata.Token)  
2060 - if err != nil || uuid==0{ 2058 + uuid, err := GetTouristUid(rdata.Token)
  2059 + if err != nil || uuid == 0 {
2061 logger.Error("HandleGetTeamList GetTouristUid failed=%v", err) 2060 logger.Error("HandleGetTeamList GetTouristUid failed=%v", err)
2062 resp.Result.Code = ERROR_GETUSERIDFAILED 2061 resp.Result.Code = ERROR_GETUSERIDFAILED
2063 break 2062 break
2064 } 2063 }
2065 2064
2066 - teams,err,sum := GetTeamListByCond(rdata.Store_num,rdata.Page) 2065 + teams, err, sum := GetTeamListByCond(rdata.Store_num, rdata.Page)
2067 if err != nil { 2066 if err != nil {
2068 logger.Error("HandleGetTeamList GetTeamListByCond failed=%v", err) 2067 logger.Error("HandleGetTeamList GetTeamListByCond failed=%v", err)
2069 resp.Result.Code = ERROR_GETTEAMLISTFAILED 2068 resp.Result.Code = ERROR_GETTEAMLISTFAILED
@@ -2071,8 +2070,8 @@ func HandleGetTeamList(w http.ResponseWriter, data string) { @@ -2071,8 +2070,8 @@ func HandleGetTeamList(w http.ResponseWriter, data string) {
2071 } 2070 }
2072 2071
2073 resp.Result.Data.Count = sum 2072 resp.Result.Data.Count = sum
2074 - for _,val := range teams {  
2075 - resp.Result.Data.Items = append(resp.Result.Data.Items,val.BaseInfo.Id) 2073 + for _, val := range teams {
  2074 + resp.Result.Data.Items = append(resp.Result.Data.Items, val.BaseInfo.Id)
2076 } 2075 }
2077 2076
2078 resp.Result.Code = ERROR_OK 2077 resp.Result.Code = ERROR_OK
@@ -2098,14 +2097,14 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { @@ -2098,14 +2097,14 @@ func HandleSearchTeam(w http.ResponseWriter, data string) {
2098 break 2097 break
2099 } 2098 }
2100 2099
2101 - uuid,err := GetTouristUid(rdata.Token)  
2102 - if err != nil || uuid==0{ 2100 + uuid, err := GetTouristUid(rdata.Token)
  2101 + if err != nil || uuid == 0 {
2103 logger.Error("HandleSearchTeam GetTouristUid failed=%v", err) 2102 logger.Error("HandleSearchTeam GetTouristUid failed=%v", err)
2104 resp.Result.Code = ERROR_GETUSERIDFAILED 2103 resp.Result.Code = ERROR_GETUSERIDFAILED
2105 break 2104 break
2106 } 2105 }
2107 2106
2108 - teams,err,sum := GetTeamListByNameCond(rdata.Store_num,rdata.Page,rdata.Name) 2107 + teams, err, sum := GetTeamListByNameCond(rdata.Store_num, rdata.Page, rdata.Name)
2109 if err != nil { 2108 if err != nil {
2110 logger.Error("HandleSearchTeam GetTeamListByCond failed=%v", err) 2109 logger.Error("HandleSearchTeam GetTeamListByCond failed=%v", err)
2111 resp.Result.Code = ERROR_GETTEAMLISTFAILED 2110 resp.Result.Code = ERROR_GETTEAMLISTFAILED
@@ -2113,8 +2112,8 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { @@ -2113,8 +2112,8 @@ func HandleSearchTeam(w http.ResponseWriter, data string) {
2113 } 2112 }
2114 2113
2115 resp.Result.Data.Count = sum 2114 resp.Result.Data.Count = sum
2116 - for _,val := range teams {  
2117 - resp.Result.Data.Items = append(resp.Result.Data.Items,val.BaseInfo.Id) 2115 + for _, val := range teams {
  2116 + resp.Result.Data.Items = append(resp.Result.Data.Items, val.BaseInfo.Id)
2118 } 2117 }
2119 2118
2120 resp.Result.Code = ERROR_OK 2119 resp.Result.Code = ERROR_OK
@@ -2126,7 +2125,6 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { @@ -2126,7 +2125,6 @@ func HandleSearchTeam(w http.ResponseWriter, data string) {
2126 fmt.Fprint(w, string(respstr)) 2125 fmt.Fprint(w, string(respstr))
2127 } 2126 }
2128 2127
2129 -  
2130 func HandleSetFriendRequest(w http.ResponseWriter, data string) { 2128 func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2131 SetHeader(w) 2129 SetHeader(w)
2132 var resp SetFriendResp 2130 var resp SetFriendResp
@@ -2141,15 +2139,15 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { @@ -2141,15 +2139,15 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2141 break 2139 break
2142 } 2140 }
2143 2141
2144 - uuid,err := GetTouristUid(rdata.Token)  
2145 - if err != nil || uuid==0{ 2142 + uuid, err := GetTouristUid(rdata.Token)
  2143 + if err != nil || uuid == 0 {
2146 logger.Error("HandleSetFriendRequest GetTouristUid failed=%v", err) 2144 logger.Error("HandleSetFriendRequest GetTouristUid failed=%v", err)
2147 resp.Result.Code = ERROR_GETUSERIDFAILED 2145 resp.Result.Code = ERROR_GETUSERIDFAILED
2148 break 2146 break
2149 } 2147 }
2150 2148
2151 //先判断是否是好友关系 2149 //先判断是否是好友关系
2152 - list,err := GetUserFriendList(rdata.User_id) 2150 + list, err := GetUserFriendList(rdata.User_id)
2153 if err != nil { 2151 if err != nil {
2154 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) 2152 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err)
2155 resp.Result.Code = ERROR_GETFRIENDLISTAILED 2153 resp.Result.Code = ERROR_GETFRIENDLISTAILED
@@ -2163,7 +2161,7 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { @@ -2163,7 +2161,7 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2163 } 2161 }
2164 2162
2165 //判断自己的好友人数是否已经达到上限 2163 //判断自己的好友人数是否已经达到上限
2166 - ownlist,err := GetUserFriendList(uuid) 2164 + ownlist, err := GetUserFriendList(uuid)
2167 if err != nil { 2165 if err != nil {
2168 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) 2166 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err)
2169 resp.Result.Code = ERROR_GETFRIENDLISTAILED 2167 resp.Result.Code = ERROR_GETFRIENDLISTAILED
@@ -2177,7 +2175,7 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { @@ -2177,7 +2175,7 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2177 } 2175 }
2178 2176
2179 //判断申请列表是否已经有对该玩家的申请 24小时,此处需要判断24小时内的申请次数上限,需要先提出超过24小时的申请 2177 //判断申请列表是否已经有对该玩家的申请 24小时,此处需要判断24小时内的申请次数上限,需要先提出超过24小时的申请
2180 - applylist,err := GetUserApplyList(uuid) 2178 + applylist, err := GetUserApplyList(uuid)
2181 if err != nil { 2179 if err != nil {
2182 logger.Error("HandleSetFriendRequest GetApplyListFailed failed=%v", err) 2180 logger.Error("HandleSetFriendRequest GetApplyListFailed failed=%v", err)
2183 resp.Result.Code = ERROR_FRIENDGETAPPLISTFAILED 2181 resp.Result.Code = ERROR_FRIENDGETAPPLISTFAILED
@@ -2190,14 +2188,14 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { @@ -2190,14 +2188,14 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2190 break 2188 break
2191 } 2189 }
2192 2190
2193 - if len(applylist.Apply_info) >=FRIEND_APPLY_LIMIT { 2191 + if len(applylist.Apply_info) >= FRIEND_APPLY_LIMIT {
2194 logger.Error("HandleSetFriendRequest Apply limit failed=%v", err) 2192 logger.Error("HandleSetFriendRequest Apply limit failed=%v", err)
2195 resp.Result.Code = ERROR_FRIENDAPPLYLIMIT 2193 resp.Result.Code = ERROR_FRIENDAPPLYLIMIT
2196 break 2194 break
2197 } 2195 }
2198 2196
2199 //加入对方列表,如果已经在对方待批准列表则返回错误 2197 //加入对方列表,如果已经在对方待批准列表则返回错误
2200 - approvelist,err := GetUserApproveList(rdata.User_id) 2198 + approvelist, err := GetUserApproveList(rdata.User_id)
2201 if err != nil { 2199 if err != nil {
2202 logger.Error("HandleSetFriendRequest GetApproveListFailed failed=%v", err) 2200 logger.Error("HandleSetFriendRequest GetApproveListFailed failed=%v", err)
2203 resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED 2201 resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED
@@ -2210,17 +2208,17 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { @@ -2210,17 +2208,17 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) {
2210 break 2208 break
2211 } 2209 }
2212 2210
2213 - if len(approvelist.Approve_info) >=FRIEND_APPROVE_LIMIT { 2211 + if len(approvelist.Approve_info) >= FRIEND_APPROVE_LIMIT {
2214 logger.Error("HandleSetFriendRequest Apply limit failed=%v", err) 2212 logger.Error("HandleSetFriendRequest Apply limit failed=%v", err)
2215 resp.Result.Code = ERROR_FRIENDAPPROVELIMIT 2213 resp.Result.Code = ERROR_FRIENDAPPROVELIMIT
2216 break 2214 break
2217 } 2215 }
2218 2216
2219 //添加到对方的待批准记录 2217 //添加到对方的待批准记录
2220 - SaveUserApplyList(uuid,rdata.User_id) 2218 + SaveUserApplyList(uuid, rdata.User_id)
2221 2219
2222 //添加到自己的申请记录 2220 //添加到自己的申请记录
2223 - SaveUserApproveList(rdata.User_id,uuid) 2221 + SaveUserApproveList(rdata.User_id, uuid)
2224 2222
2225 //清空好友推荐缓存 2223 //清空好友推荐缓存
2226 DelCacheRecommandFriendList(uuid) 2224 DelCacheRecommandFriendList(uuid)
@@ -2248,20 +2246,20 @@ func HandleGetFriendList(w http.ResponseWriter, data string) { @@ -2248,20 +2246,20 @@ func HandleGetFriendList(w http.ResponseWriter, data string) {
2248 break 2246 break
2249 } 2247 }
2250 2248
2251 - uuid,err := GetTouristUid(rdata.Token)  
2252 - if err != nil || uuid==0{ 2249 + uuid, err := GetTouristUid(rdata.Token)
  2250 + if err != nil || uuid == 0 {
2253 logger.Error("HandleGetFriendList GetTouristUid failed=%v", err) 2251 logger.Error("HandleGetFriendList GetTouristUid failed=%v", err)
2254 resp.Result.Code = ERROR_GETUSERIDFAILED 2252 resp.Result.Code = ERROR_GETUSERIDFAILED
2255 break 2253 break
2256 } 2254 }
2257 2255
2258 - friendlist,err := GetUserFriendList(uuid) 2256 + friendlist, err := GetUserFriendList(uuid)
2259 if err != nil { 2257 if err != nil {
2260 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) 2258 logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err)
2261 resp.Result.Code = ERROR_GETFRIENDLISTAILED 2259 resp.Result.Code = ERROR_GETFRIENDLISTAILED
2262 break 2260 break
2263 } 2261 }
2264 - resp.Result.Data.Friend_list = append(resp.Result.Data.Friend_list,friendlist.Friends...) 2262 + resp.Result.Data.Friend_list = append(resp.Result.Data.Friend_list, friendlist.Friends...)
2265 2263
2266 resp.Result.Code = ERROR_OK 2264 resp.Result.Code = ERROR_OK
2267 break 2265 break
@@ -2272,7 +2270,6 @@ func HandleGetFriendList(w http.ResponseWriter, data string) { @@ -2272,7 +2270,6 @@ func HandleGetFriendList(w http.ResponseWriter, data string) {
2272 fmt.Fprint(w, string(respstr)) 2270 fmt.Fprint(w, string(respstr))
2273 } 2271 }
2274 2272
2275 -  
2276 func HandleGetAuditList(w http.ResponseWriter, data string) { 2273 func HandleGetAuditList(w http.ResponseWriter, data string) {
2277 SetHeader(w) 2274 SetHeader(w)
2278 var resp GetAuditListResp 2275 var resp GetAuditListResp
@@ -2287,20 +2284,20 @@ func HandleGetAuditList(w http.ResponseWriter, data string) { @@ -2287,20 +2284,20 @@ func HandleGetAuditList(w http.ResponseWriter, data string) {
2287 break 2284 break
2288 } 2285 }
2289 2286
2290 - uuid,err := GetTouristUid(rdata.Token)  
2291 - if err != nil || uuid==0{ 2287 + uuid, err := GetTouristUid(rdata.Token)
  2288 + if err != nil || uuid == 0 {
2292 logger.Error("HandleGetAuditList GetTouristUid failed=%v", err) 2289 logger.Error("HandleGetAuditList GetTouristUid failed=%v", err)
2293 resp.Result.Code = ERROR_GETUSERIDFAILED 2290 resp.Result.Code = ERROR_GETUSERIDFAILED
2294 break 2291 break
2295 } 2292 }
2296 2293
2297 - approvelist,err := GetUserApproveList(uuid) 2294 + approvelist, err := GetUserApproveList(uuid)
2298 if err != nil { 2295 if err != nil {
2299 logger.Error("HandleGetAuditList Getapprovelistfailedt failed=%v", err) 2296 logger.Error("HandleGetAuditList Getapprovelistfailedt failed=%v", err)
2300 resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED 2297 resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED
2301 break 2298 break
2302 } 2299 }
2303 - resp.Result.Data.Approve_list = append(resp.Result.Data.Approve_list,approvelist.Approve_info...) 2300 + resp.Result.Data.Approve_list = append(resp.Result.Data.Approve_list, approvelist.Approve_info...)
2304 2301
2305 resp.Result.Code = ERROR_OK 2302 resp.Result.Code = ERROR_OK
2306 break 2303 break
@@ -2311,7 +2308,6 @@ func HandleGetAuditList(w http.ResponseWriter, data string) { @@ -2311,7 +2308,6 @@ func HandleGetAuditList(w http.ResponseWriter, data string) {
2311 fmt.Fprint(w, string(respstr)) 2308 fmt.Fprint(w, string(respstr))
2312 } 2309 }
2313 2310
2314 -  
2315 func HandleGetRecommendList(w http.ResponseWriter, data string) { 2311 func HandleGetRecommendList(w http.ResponseWriter, data string) {
2316 SetHeader(w) 2312 SetHeader(w)
2317 var resp GetRecommendListResp 2313 var resp GetRecommendListResp
@@ -2326,15 +2322,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { @@ -2326,15 +2322,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) {
2326 break 2322 break
2327 } 2323 }
2328 2324
2329 - uuid,err := GetTouristUid(rdata.Token)  
2330 - if err != nil || uuid==0{ 2325 + uuid, err := GetTouristUid(rdata.Token)
  2326 + if err != nil || uuid == 0 {
2331 logger.Error("HandleGetRecommendList GetTouristUid failed=%v", err) 2327 logger.Error("HandleGetRecommendList GetTouristUid failed=%v", err)
2332 resp.Result.Code = ERROR_GETUSERIDFAILED 2328 resp.Result.Code = ERROR_GETUSERIDFAILED
2333 break 2329 break
2334 } 2330 }
2335 2331
2336 //需要判断自己的好友位置是否已满 2332 //需要判断自己的好友位置是否已满
2337 - friendlist,err := GetUserFriendList(uuid) 2333 + friendlist, err := GetUserFriendList(uuid)
2338 if err != nil { 2334 if err != nil {
2339 logger.Error("HandleGetRecommendList GetFriendList failed=%v", err) 2335 logger.Error("HandleGetRecommendList GetFriendList failed=%v", err)
2340 resp.Result.Code = ERROR_GETFRIENDLISTAILED 2336 resp.Result.Code = ERROR_GETFRIENDLISTAILED
@@ -2346,15 +2342,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { @@ -2346,15 +2342,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) {
2346 break 2342 break
2347 } 2343 }
2348 2344
2349 - rlist,err := friendlist.GetRecommandFriendList(uuid,FRIEND_RECOMMAND_NUM) 2345 + rlist, err := friendlist.GetRecommandFriendList(uuid, FRIEND_RECOMMAND_NUM)
2350 if err != nil { 2346 if err != nil {
2351 logger.Error("HandleGetRecommendList GetRecommandFriendList failed=%v", err) 2347 logger.Error("HandleGetRecommendList GetRecommandFriendList failed=%v", err)
2352 resp.Result.Code = ERROR_FRIENDGETRECOMMADNFAILED 2348 resp.Result.Code = ERROR_FRIENDGETRECOMMADNFAILED
2353 break 2349 break
2354 } 2350 }
2355 2351
2356 - for _,val := range rlist.Recommend_list {  
2357 - resp.Result.Data.Recommend_list = append(resp.Result.Data.Recommend_list,val) 2352 + for _, val := range rlist.Recommend_list {
  2353 + resp.Result.Data.Recommend_list = append(resp.Result.Data.Recommend_list, val)
2358 } 2354 }
2359 2355
2360 resp.Result.Code = ERROR_OK 2356 resp.Result.Code = ERROR_OK
@@ -2366,7 +2362,6 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { @@ -2366,7 +2362,6 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) {
2366 fmt.Fprint(w, string(respstr)) 2362 fmt.Fprint(w, string(respstr))
2367 } 2363 }
2368 2364
2369 -  
2370 func HandleHandleFriendRequest(w http.ResponseWriter, data string) { 2365 func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2371 SetHeader(w) 2366 SetHeader(w)
2372 var resp HandleFriendRequestResp 2367 var resp HandleFriendRequestResp
@@ -2381,14 +2376,14 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { @@ -2381,14 +2376,14 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2381 break 2376 break
2382 } 2377 }
2383 2378
2384 - uuid,err := GetTouristUid(rdata.Token)  
2385 - if err != nil || uuid==0{ 2379 + uuid, err := GetTouristUid(rdata.Token)
  2380 + if err != nil || uuid == 0 {
2386 logger.Error("HandleHandleFriendRequest GetTouristUid failed=%v", err) 2381 logger.Error("HandleHandleFriendRequest GetTouristUid failed=%v", err)
2387 resp.Result.Code = ERROR_GETUSERIDFAILED 2382 resp.Result.Code = ERROR_GETUSERIDFAILED
2388 break 2383 break
2389 } 2384 }
2390 2385
2391 - approvelist,err := GetUserApproveList(uuid) 2386 + approvelist, err := GetUserApproveList(uuid)
2392 if !approvelist.InApproveList(rdata.User_id) { 2387 if !approvelist.InApproveList(rdata.User_id) {
2393 logger.Error("HandleHandleFriendRequest NOTINAPPROVELIST failed=%v", err) 2388 logger.Error("HandleHandleFriendRequest NOTINAPPROVELIST failed=%v", err)
2394 resp.Result.Code = ERROR_NOTINAPPROVELIST 2389 resp.Result.Code = ERROR_NOTINAPPROVELIST
@@ -2396,7 +2391,7 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { @@ -2396,7 +2391,7 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2396 } 2391 }
2397 2392
2398 //从待批准列表删除 2393 //从待批准列表删除
2399 - err = DelFromApproveList(uuid,rdata.User_id) 2394 + err = DelFromApproveList(uuid, rdata.User_id)
2400 if err != nil { 2395 if err != nil {
2401 logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) 2396 logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err)
2402 resp.Result.Code = ERROR_FRIENDAPPROVEFAILED 2397 resp.Result.Code = ERROR_FRIENDAPPROVEFAILED
@@ -2405,7 +2400,7 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { @@ -2405,7 +2400,7 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2405 2400
2406 if rdata.Type == 0 { 2401 if rdata.Type == 0 {
2407 //如果同意将其加入好友列表 status 1表示删除 0表示未删除 2402 //如果同意将其加入好友列表 status 1表示删除 0表示未删除
2408 - err = SaveUserFriendList(uuid,rdata.User_id,0) 2403 + err = SaveUserFriendList(uuid, rdata.User_id, 0)
2409 if err != nil { 2404 if err != nil {
2410 logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) 2405 logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err)
2411 resp.Result.Code = ERROR_FRIENDAPPROVEFAILED 2406 resp.Result.Code = ERROR_FRIENDAPPROVEFAILED
@@ -2413,7 +2408,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { @@ -2413,7 +2408,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2413 } 2408 }
2414 } 2409 }
2415 2410
2416 -  
2417 resp.Result.Code = ERROR_OK 2411 resp.Result.Code = ERROR_OK
2418 break 2412 break
2419 } 2413 }
@@ -2423,7 +2417,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { @@ -2423,7 +2417,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) {
2423 fmt.Fprint(w, string(respstr)) 2417 fmt.Fprint(w, string(respstr))
2424 } 2418 }
2425 2419
2426 -  
2427 func HandleDelFriend(w http.ResponseWriter, data string) { 2420 func HandleDelFriend(w http.ResponseWriter, data string) {
2428 SetHeader(w) 2421 SetHeader(w)
2429 var resp DelFriendResp 2422 var resp DelFriendResp
@@ -2438,14 +2431,14 @@ func HandleDelFriend(w http.ResponseWriter, data string) { @@ -2438,14 +2431,14 @@ func HandleDelFriend(w http.ResponseWriter, data string) {
2438 break 2431 break
2439 } 2432 }
2440 2433
2441 - uuid,err := GetTouristUid(rdata.Token)  
2442 - if err != nil || uuid==0{ 2434 + uuid, err := GetTouristUid(rdata.Token)
  2435 + if err != nil || uuid == 0 {
2443 logger.Error("HandleDelFriend GetTouristUid failed=%v", err) 2436 logger.Error("HandleDelFriend GetTouristUid failed=%v", err)
2444 resp.Result.Code = ERROR_GETUSERIDFAILED 2437 resp.Result.Code = ERROR_GETUSERIDFAILED
2445 break 2438 break
2446 } 2439 }
2447 2440
2448 - friendlist,err := GetUserFriendList(uuid) 2441 + friendlist, err := GetUserFriendList(uuid)
2449 if err != nil { 2442 if err != nil {
2450 logger.Error("HandleDelFriend GetFriendList failed=%v", err) 2443 logger.Error("HandleDelFriend GetFriendList failed=%v", err)
2451 resp.Result.Code = ERROR_GETFRIENDLISTAILED 2444 resp.Result.Code = ERROR_GETFRIENDLISTAILED
@@ -2457,14 +2450,13 @@ func HandleDelFriend(w http.ResponseWriter, data string) { @@ -2457,14 +2450,13 @@ func HandleDelFriend(w http.ResponseWriter, data string) {
2457 break 2450 break
2458 } 2451 }
2459 2452
2460 - err = SaveUserFriendList(uuid,rdata.User_id,1) 2453 + err = SaveUserFriendList(uuid, rdata.User_id, 1)
2461 if err != nil { 2454 if err != nil {
2462 logger.Error("HandleSetFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) 2455 logger.Error("HandleSetFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err)
2463 resp.Result.Code = ERROR_FRIENDDELFRIENDFAILED 2456 resp.Result.Code = ERROR_FRIENDDELFRIENDFAILED
2464 break 2457 break
2465 } 2458 }
2466 2459
2467 -  
2468 resp.Result.Code = ERROR_OK 2460 resp.Result.Code = ERROR_OK
2469 break 2461 break
2470 } 2462 }
@@ -2488,8 +2480,8 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) { @@ -2488,8 +2480,8 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) {
2488 break 2480 break
2489 } 2481 }
2490 2482
2491 - uuid,err := GetTouristUid(rdata.Token)  
2492 - if err != nil || uuid==0{ 2483 + uuid, err := GetTouristUid(rdata.Token)
  2484 + if err != nil || uuid == 0 {
2493 logger.Error("HandleQueryPlayerData GetTouristUid failed=%v", err) 2485 logger.Error("HandleQueryPlayerData GetTouristUid failed=%v", err)
2494 resp.Result.Code = ERROR_GETUSERIDFAILED 2486 resp.Result.Code = ERROR_GETUSERIDFAILED
2495 break 2487 break
@@ -2511,4 +2503,4 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) { @@ -2511,4 +2503,4 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) {
2511 //回包 2503 //回包
2512 respstr, _ := json.Marshal(&resp) 2504 respstr, _ := json.Marshal(&resp)
2513 fmt.Fprint(w, string(respstr)) 2505 fmt.Fprint(w, string(respstr))
2514 -}  
2515 \ No newline at end of file 2506 \ No newline at end of file
  2507 +}
src/common/redis/def.go
@@ -28,4 +28,5 @@ const ( @@ -28,4 +28,5 @@ const (
28 USER_CHAT_TEAM_INFO_KEY = "CATCAFE_USER_CHAT_TEAM_INFO_KEY" // 加teamid 存储的是队伍聊天的信息 list结构 最新的消息在最头部 28 USER_CHAT_TEAM_INFO_KEY = "CATCAFE_USER_CHAT_TEAM_INFO_KEY" // 加teamid 存储的是队伍聊天的信息 list结构 最新的消息在最头部
29 USER_CHAT_PRIVATE_LASTGET_KEY = "CATCAFE_USER_CHAT_PRIVATE_LASTGET_KEY" // hset key加自己的uuid field为目标的uuid value为时间戳 29 USER_CHAT_PRIVATE_LASTGET_KEY = "CATCAFE_USER_CHAT_PRIVATE_LASTGET_KEY" // hset key加自己的uuid field为目标的uuid value为时间戳
30 USER_CHAT_PRIVATE_INFO_KEY = "CATCAFE_USER_CHAT_PRIVATE_INFO_KEY" //list key需要加上自己的:uuid再加上目标:uuid 存储的是和自己相关的所有聊天信息 30 USER_CHAT_PRIVATE_INFO_KEY = "CATCAFE_USER_CHAT_PRIVATE_INFO_KEY" //list key需要加上自己的:uuid再加上目标:uuid 存储的是和自己相关的所有聊天信息
  31 + USER_CHAT_EMOJUNLOCK_KEY = "CATCAFE_USER_CHAT_EMOJUNLOCK_KEY" //hset 记录的是玩家表情页签解锁情况 []int 0表示未解锁 1表示解锁
31 ) 32 )