Commit 8c80e014ac78564ff021606b9d45da98ea6e569c
1 parent
f032452a
Exists in
master
增加聊天相关接口
Showing
5 changed files
with
822 additions
and
746 deletions
Show diff stats
src/HttpServer/logic/datadef.go
| ... | ... | @@ -2,15 +2,15 @@ package logic |
| 2 | 2 | |
| 3 | 3 | //微信url定义 |
| 4 | 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 | 6 | URL_WEIXINGETACCESS_TOKEN = "https://api.weixin.qq.com/cgi-bin/token" |
| 7 | 7 | ) |
| 8 | 8 | |
| 9 | 9 | //登录类型枚举 |
| 10 | 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 | 20 | } |
| 21 | 21 | |
| 22 | 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 | 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 | 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 | 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 | 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 | 76 | type UserLoginData struct { |
| 78 | 77 | Dasedata UserBaseData `json:"UserBaseData"` |
| 79 | - Extdata UserExtData `json:"user_ext_data"` | |
| 78 | + Extdata UserExtData `json:"user_ext_data"` | |
| 80 | 79 | } |
| 81 | 80 | |
| 82 | 81 | type UserLoginResult struct { |
| 83 | - Code int `json:"code"` | |
| 82 | + Code int `json:"code"` | |
| 84 | 83 | Data UserLoginData `json:"data"` |
| 85 | 84 | } |
| 86 | 85 | |
| 87 | - | |
| 88 | - | |
| 89 | 86 | type UserLoginResp struct { |
| 90 | - Status string `json:"status"` | |
| 87 | + Status string `json:"status"` | |
| 91 | 88 | Result UserLoginResult `json:"result"` |
| 92 | - | |
| 93 | 89 | } |
| 94 | 90 | |
| 95 | - | |
| 96 | -type QueryInviteReq struct{ | |
| 91 | +type QueryInviteReq struct { | |
| 97 | 92 | Uuid int `json:"uuid"` |
| 98 | 93 | } |
| 99 | 94 | |
| 100 | 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 | 102 | type QueryInviteDesc struct { |
| ... | ... | @@ -109,16 +104,43 @@ type QueryInviteDesc struct { |
| 109 | 104 | } |
| 110 | 105 | |
| 111 | 106 | type QueryInviteResult struct { |
| 112 | - Code int `json:"code"` | |
| 107 | + Code int `json:"code"` | |
| 113 | 108 | Data QueryInviteDesc `json:"data"` |
| 114 | 109 | } |
| 115 | 110 | |
| 116 | 111 | type QueryInviteResp struct { |
| 117 | - Status string `json:"status"` | |
| 112 | + Status string `json:"status"` | |
| 118 | 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 | 144 | Uuid int `json:"uuid"` |
| 123 | 145 | } |
| 124 | 146 | |
| ... | ... | @@ -127,152 +149,144 @@ type QueryNewMessageDesc struct { |
| 127 | 149 | } |
| 128 | 150 | |
| 129 | 151 | type QueryNewMessageResult struct { |
| 130 | - Code int `json:"code"` | |
| 152 | + Code int `json:"code"` | |
| 131 | 153 | Data QueryNewMessageDesc `json:"data"` |
| 132 | 154 | } |
| 133 | 155 | |
| 134 | 156 | type QueryNewMessageResp struct { |
| 135 | - Status string `json:"status"` | |
| 157 | + Status string `json:"status"` | |
| 136 | 158 | Result QueryNewMessageResult `json:"result"` |
| 137 | 159 | } |
| 138 | 160 | |
| 139 | - | |
| 140 | -type InviteWorkReq struct{ | |
| 161 | +type InviteWorkReq struct { | |
| 141 | 162 | Uuid int `json:"uuid"` |
| 142 | 163 | } |
| 143 | 164 | |
| 144 | 165 | //邀请打工数据结构 |
| 145 | 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 | 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 | 180 | type InviteWorksDesc struct { |
| 160 | - Invite_data []InviteWorkDesc `json:"invite_data"` | |
| 181 | + Invite_data []InviteWorkDesc `json:"invite_data"` | |
| 161 | 182 | Offlinelist []InviteWorkOffDesc `json:"offlinelist"` |
| 162 | 183 | } |
| 163 | 184 | |
| 164 | 185 | type InviteWorkResult struct { |
| 165 | - Code int `json:"code"` | |
| 186 | + Code int `json:"code"` | |
| 166 | 187 | Data InviteWorksDesc `json:"data"` |
| 167 | 188 | } |
| 168 | 189 | |
| 169 | 190 | type InviteWorkResp struct { |
| 170 | - Status string `json:"status"` | |
| 191 | + Status string `json:"status"` | |
| 171 | 192 | Result InviteWorkResult `json:"result"` |
| 172 | 193 | } |
| 173 | 194 | |
| 174 | 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 | 202 | type InitIndexResult struct { |
| 182 | - Code int `json:"code"` | |
| 203 | + Code int `json:"code"` | |
| 183 | 204 | Data InitIndexDesc `json:"data"` |
| 184 | 205 | } |
| 185 | 206 | |
| 186 | 207 | type InitIndexResp struct { |
| 187 | - Status string `json:"status"` | |
| 208 | + Status string `json:"status"` | |
| 188 | 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 | 214 | Value string `json:"value"` |
| 195 | 215 | } |
| 196 | 216 | |
| 197 | - | |
| 198 | 217 | type SaveDataBackupResp struct { |
| 199 | - Status string `json:"status"` | |
| 218 | + Status string `json:"status"` | |
| 200 | 219 | Result CommonResult `json:"result"` |
| 201 | 220 | } |
| 202 | 221 | |
| 203 | - | |
| 204 | -type FetchInviteReq struct{ | |
| 222 | +type FetchInviteReq struct { | |
| 205 | 223 | Selfuuid int `json:"selfuuid"` |
| 206 | - Fuuid int `json:"fuuid"` | |
| 224 | + Fuuid int `json:"fuuid"` | |
| 207 | 225 | } |
| 208 | 226 | |
| 209 | - | |
| 210 | 227 | type FetchInviteResp struct { |
| 211 | - Status string `json:"status"` | |
| 228 | + Status string `json:"status"` | |
| 212 | 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 | 234 | Inviteuuid int `json:"inviteuuid"` |
| 218 | 235 | Invitetype int `json:"invitetype"` |
| 219 | 236 | } |
| 220 | 237 | |
| 221 | - | |
| 222 | 238 | type EnterInviteResp struct { |
| 223 | - Status string `json:"status"` | |
| 239 | + Status string `json:"status"` | |
| 224 | 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 | 245 | Password string `json:"password"` |
| 231 | 246 | } |
| 232 | 247 | |
| 233 | 248 | type RegeisteraResp struct { |
| 234 | - Status string `json:"status"` | |
| 249 | + Status string `json:"status"` | |
| 235 | 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 | 255 | Password string `json:"password"` |
| 241 | 256 | } |
| 242 | 257 | |
| 243 | 258 | type AccounLoginResp struct { |
| 244 | - Status string `json:"status"` | |
| 259 | + Status string `json:"status"` | |
| 245 | 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 | 272 | type SaveUserDataResp struct { |
| 259 | - Status string `json:"status"` | |
| 273 | + Status string `json:"status"` | |
| 260 | 274 | Result UserLoginResult `json:"result"` |
| 261 | 275 | } |
| 262 | 276 | |
| 263 | 277 | type CommonResult struct { |
| 264 | - Code int `json:"code"` | |
| 278 | + Code int `json:"code"` | |
| 265 | 279 | Data string `json:"data"` |
| 266 | 280 | } |
| 267 | 281 | |
| 268 | -type SaveDataReq struct{ | |
| 282 | +type SaveDataReq struct { | |
| 269 | 283 | Token string `json:"token"` |
| 270 | 284 | Field string `json:"field"` |
| 271 | 285 | Value string `json:"value"` |
| 272 | 286 | } |
| 273 | 287 | |
| 274 | 288 | type SaveDataResp struct { |
| 275 | - Status string `json:"status"` | |
| 289 | + Status string `json:"status"` | |
| 276 | 290 | Result CommonResult `json:"result"` |
| 277 | 291 | } |
| 278 | 292 | |
| ... | ... | @@ -281,32 +295,32 @@ type GetDataDesc struct { |
| 281 | 295 | } |
| 282 | 296 | |
| 283 | 297 | type GetDataResult struct { |
| 284 | - Code int `json:"code"` | |
| 298 | + Code int `json:"code"` | |
| 285 | 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 | 304 | Field string `json:"field"` |
| 291 | 305 | } |
| 292 | 306 | |
| 293 | 307 | type GetDataResp struct { |
| 294 | - Status string `json:"status"` | |
| 308 | + Status string `json:"status"` | |
| 295 | 309 | Result GetDataResult `json:"result"` |
| 296 | 310 | } |
| 297 | 311 | |
| 298 | 312 | type GetDataSaveDesc struct { |
| 299 | - Data_uid string `json:"data_uid"` | |
| 313 | + Data_uid string `json:"data_uid"` | |
| 300 | 314 | Data_value string `json:"data_value"` |
| 301 | 315 | } |
| 302 | 316 | |
| 303 | -type TextCheckReq struct{ | |
| 317 | +type TextCheckReq struct { | |
| 304 | 318 | Token string `json:"token"` |
| 305 | - Text string `json:"text"` | |
| 319 | + Text string `json:"text"` | |
| 306 | 320 | } |
| 307 | 321 | |
| 308 | 322 | type TextCheckResp struct { |
| 309 | - Status string `json:"status"` | |
| 323 | + Status string `json:"status"` | |
| 310 | 324 | Result CommonResult `json:"result"` |
| 311 | 325 | } |
| 312 | 326 | |
| ... | ... | @@ -316,71 +330,70 @@ type MsgCheckDesc struct { |
| 316 | 330 | |
| 317 | 331 | type MsgCheckResp struct { |
| 318 | 332 | Errcode string `json:"errcode"` |
| 319 | - Errmsg string `json:"errmsg"` | |
| 333 | + Errmsg string `json:"errmsg"` | |
| 320 | 334 | } |
| 321 | 335 | |
| 322 | 336 | type GetAccessTokenResp struct { |
| 323 | 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 | 348 | //队伍列表人员id |
| 336 | 349 | type TeamMemInfo struct { |
| 337 | - MemList []int | |
| 350 | + MemList []int | |
| 338 | 351 | } |
| 339 | 352 | |
| 340 | 353 | //玩家投资信心 |
| 341 | 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 | 360 | //玩家buff |
| 348 | 361 | type TeamBuffInfo struct { |
| 349 | - BeginTime int | |
| 350 | - EndTime int | |
| 362 | + BeginTime int | |
| 363 | + EndTime int | |
| 351 | 364 | } |
| 352 | 365 | |
| 353 | 366 | // |
| 354 | 367 | type TeamAllBuff struct { |
| 355 | - Type int | |
| 368 | + Type int | |
| 356 | 369 | BuffInfo []TeamBuffInfo |
| 357 | 370 | } |
| 358 | 371 | |
| 359 | 372 | //队伍建筑信息 |
| 360 | 373 | type TeamBuildingInfo struct { |
| 361 | 374 | Devote []TeamDevoteInfo |
| 362 | - Buff []TeamAllBuff | |
| 375 | + Buff []TeamAllBuff | |
| 363 | 376 | } |
| 364 | 377 | |
| 365 | 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 | 393 | type TeamInfo struct { |
| 381 | 394 | BaseInfo CreateTeamInfo |
| 382 | - MemInfo TeamMemInfo | |
| 383 | - BInfo TeamBuildingInfo | |
| 395 | + MemInfo TeamMemInfo | |
| 396 | + BInfo TeamBuildingInfo | |
| 384 | 397 | } |
| 385 | 398 | |
| 386 | 399 | type CreateTeamDesc struct { |
| ... | ... | @@ -388,53 +401,51 @@ type CreateTeamDesc struct { |
| 388 | 401 | } |
| 389 | 402 | |
| 390 | 403 | type CreateTeamData struct { |
| 391 | - Code int `json:"code"` | |
| 404 | + Code int `json:"code"` | |
| 392 | 405 | Data CreateTeamDesc `json:"data"` |
| 393 | 406 | } |
| 394 | 407 | |
| 395 | 408 | type CreateTeamResp struct { |
| 396 | - Status string `json:"status"` | |
| 409 | + Status string `json:"status"` | |
| 397 | 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 | 418 | type JoinTeamResp struct { |
| 407 | - Status string `json:"status"` | |
| 419 | + Status string `json:"status"` | |
| 408 | 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 | 428 | type JoinTeamByInviteResp struct { |
| 418 | - Status string `json:"status"` | |
| 429 | + Status string `json:"status"` | |
| 419 | 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 | 439 | type QuitTeamResp struct { |
| 429 | - Status string `json:"status"` | |
| 440 | + Status string `json:"status"` | |
| 430 | 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 | 451 | type QuitTeamDesc struct { |
| ... | ... | @@ -442,30 +453,28 @@ type QuitTeamDesc struct { |
| 442 | 453 | } |
| 443 | 454 | |
| 444 | 455 | type QuitTeamResult struct { |
| 445 | - Code int `json:"code"` | |
| 456 | + Code int `json:"code"` | |
| 446 | 457 | Data QuitTeamDesc `json:"data"` |
| 447 | 458 | } |
| 448 | 459 | |
| 449 | 460 | type UpdateTeamBuildResp struct { |
| 450 | - Status string `json:"status"` | |
| 461 | + Status string `json:"status"` | |
| 451 | 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 | 471 | type BuffTimeInfo struct { |
| 463 | 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 | 476 | type AddTeamBuffSpec struct { |
| 468 | - Build_type int `json:"build_type"` | |
| 477 | + Build_type int `json:"build_type"` | |
| 469 | 478 | Buff_time []BuffTimeInfo `json:"buff_time"` |
| 470 | 479 | } |
| 471 | 480 | |
| ... | ... | @@ -474,25 +483,25 @@ type AddTeamBuffDesc struct { |
| 474 | 483 | } |
| 475 | 484 | |
| 476 | 485 | type AddTeamBuffResult struct { |
| 477 | - Code int `json:"code"` | |
| 486 | + Code int `json:"code"` | |
| 478 | 487 | Data AddTeamBuffDesc `json:"data"` |
| 479 | 488 | } |
| 480 | 489 | |
| 481 | 490 | type AddTeamBuffResp struct { |
| 482 | - Status string `json:"status"` | |
| 491 | + Status string `json:"status"` | |
| 483 | 492 | Result AddTeamBuffResult `json:"result"` |
| 484 | 493 | } |
| 485 | 494 | |
| 486 | -type GetTeamBuffReq struct{ | |
| 495 | +type GetTeamBuffReq struct { | |
| 487 | 496 | Token string `json:"token"` |
| 488 | 497 | } |
| 489 | 498 | |
| 490 | 499 | type GetTeamBuffResp struct { |
| 491 | - Status string `json:"status"` | |
| 500 | + Status string `json:"status"` | |
| 492 | 501 | Result AddTeamBuffResult `json:"result"` |
| 493 | 502 | } |
| 494 | 503 | |
| 495 | -type GetTeamDataReq struct{ | |
| 504 | +type GetTeamDataReq struct { | |
| 496 | 505 | Token string `json:"token"` |
| 497 | 506 | } |
| 498 | 507 | |
| ... | ... | @@ -501,80 +510,78 @@ type GetTeamDataTeamUserList struct { |
| 501 | 510 | } |
| 502 | 511 | |
| 503 | 512 | type GetTeamDataDesc struct { |
| 504 | - Team_data CreateTeamInfo `json:"team_data"` | |
| 513 | + Team_data CreateTeamInfo `json:"team_data"` | |
| 505 | 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 | 518 | type GetTeamDataResult struct { |
| 510 | - Code int `json:"code"` | |
| 519 | + Code int `json:"code"` | |
| 511 | 520 | Data GetTeamDataDesc `json:"data"` |
| 512 | 521 | } |
| 513 | 522 | |
| 514 | 523 | type GetTeamDataResp struct { |
| 515 | - Status string `json:"status"` | |
| 524 | + Status string `json:"status"` | |
| 516 | 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 | 534 | type GetDataByUserIdDesc struct { |
| 526 | - Base_data string `json:"base_data"` | |
| 535 | + Base_data string `json:"base_data"` | |
| 527 | 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 | 540 | type GetDataByUserIdResult struct { |
| 532 | - Code int `json:"code"` | |
| 541 | + Code int `json:"code"` | |
| 533 | 542 | Data GetDataByUserIdDesc `json:"data"` |
| 534 | 543 | } |
| 535 | 544 | |
| 536 | 545 | type GetDataByUserIdResp struct { |
| 537 | - Status string `json:"status"` | |
| 546 | + Status string `json:"status"` | |
| 538 | 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 | 556 | type GetTeamListDesc struct { |
| 549 | 557 | Items []int `json:"items"` |
| 550 | - Count int `json:"count"` | |
| 558 | + Count int `json:"count"` | |
| 551 | 559 | } |
| 552 | 560 | |
| 553 | 561 | type GetTeamListResult struct { |
| 554 | - Code int `json:"code"` | |
| 562 | + Code int `json:"code"` | |
| 555 | 563 | Data GetTeamListDesc `json:"data"` |
| 556 | 564 | } |
| 557 | 565 | |
| 558 | - | |
| 559 | 566 | type GetTeamListResp struct { |
| 560 | - Status string `json:"status"` | |
| 567 | + Status string `json:"status"` | |
| 561 | 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 | 578 | type SearchTeamResp struct { |
| 572 | - Status string `json:"status"` | |
| 579 | + Status string `json:"status"` | |
| 573 | 580 | Result GetTeamListResult `json:"result"` |
| 574 | 581 | } |
| 575 | 582 | |
| 576 | 583 | type FriendInfo struct { |
| 577 | - Uuid int `json:"uuid"` | |
| 584 | + Uuid int `json:"uuid"` | |
| 578 | 585 | Status int `json:"status"` |
| 579 | 586 | } |
| 580 | 587 | |
| ... | ... | @@ -583,7 +590,7 @@ type FriendList struct { |
| 583 | 590 | } |
| 584 | 591 | |
| 585 | 592 | type ApplyInfo struct { |
| 586 | - Uuid int `json:"uuid"` | |
| 593 | + Uuid int `json:"uuid"` | |
| 587 | 594 | Apply_time int `json:"apply_time"` |
| 588 | 595 | } |
| 589 | 596 | type ApplyList struct { |
| ... | ... | @@ -594,18 +601,17 @@ type ApproveList struct { |
| 594 | 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 | 609 | type SetFriendResp struct { |
| 604 | - Status string `json:"status"` | |
| 610 | + Status string `json:"status"` | |
| 605 | 611 | Result CommonResult `json:"result"` |
| 606 | 612 | } |
| 607 | 613 | |
| 608 | -type GetFriendListReq struct{ | |
| 614 | +type GetFriendListReq struct { | |
| 609 | 615 | Token string `json:"token"` |
| 610 | 616 | } |
| 611 | 617 | |
| ... | ... | @@ -614,17 +620,16 @@ type GetFriendListDesc struct { |
| 614 | 620 | } |
| 615 | 621 | |
| 616 | 622 | type GetFriendListResult struct { |
| 617 | - Code int `json:"code"` | |
| 623 | + Code int `json:"code"` | |
| 618 | 624 | Data GetFriendListDesc `json:"data"` |
| 619 | 625 | } |
| 620 | 626 | |
| 621 | 627 | type GetFriendListResp struct { |
| 622 | - Status string `json:"status"` | |
| 628 | + Status string `json:"status"` | |
| 623 | 629 | Result GetFriendListResult `json:"result"` |
| 624 | 630 | } |
| 625 | 631 | |
| 626 | - | |
| 627 | -type GetAuditListReq struct{ | |
| 632 | +type GetAuditListReq struct { | |
| 628 | 633 | Token string `json:"token"` |
| 629 | 634 | } |
| 630 | 635 | |
| ... | ... | @@ -633,35 +638,34 @@ type GetAuditListDesc struct { |
| 633 | 638 | } |
| 634 | 639 | |
| 635 | 640 | type GetAuditListResult struct { |
| 636 | - Code int `json:"code"` | |
| 641 | + Code int `json:"code"` | |
| 637 | 642 | Data GetAuditListDesc `json:"data"` |
| 638 | 643 | } |
| 639 | 644 | |
| 640 | 645 | type GetAuditListResp struct { |
| 641 | - Status string `json:"status"` | |
| 646 | + Status string `json:"status"` | |
| 642 | 647 | Result GetAuditListResult `json:"result"` |
| 643 | 648 | } |
| 644 | 649 | |
| 645 | - | |
| 646 | -type GetRecommendListReq struct{ | |
| 650 | +type GetRecommendListReq struct { | |
| 647 | 651 | Token string `json:"token"` |
| 648 | 652 | } |
| 649 | 653 | |
| 650 | 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 | 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 | 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 | 671 | type GetRecommendListDesc struct { |
| ... | ... | @@ -669,42 +673,39 @@ type GetRecommendListDesc struct { |
| 669 | 673 | } |
| 670 | 674 | |
| 671 | 675 | type GetRecommendListResult struct { |
| 672 | - Code int `json:"code"` | |
| 676 | + Code int `json:"code"` | |
| 673 | 677 | Data GetRecommendListDesc `json:"data"` |
| 674 | 678 | } |
| 675 | 679 | |
| 676 | 680 | type GetRecommendListResp struct { |
| 677 | - Status string `json:"status"` | |
| 681 | + Status string `json:"status"` | |
| 678 | 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 | 691 | type HandleFriendRequestResp struct { |
| 690 | - Status string `json:"status"` | |
| 692 | + Status string `json:"status"` | |
| 691 | 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 | 701 | type DelFriendResp struct { |
| 701 | - Status string `json:"status"` | |
| 702 | + Status string `json:"status"` | |
| 702 | 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 | 711 | type QueryPlayerDataDesc struct { |
| ... | ... | @@ -712,64 +713,58 @@ type QueryPlayerDataDesc struct { |
| 712 | 713 | } |
| 713 | 714 | |
| 714 | 715 | type QueryPlayerDataResult struct { |
| 715 | - Code int `json:"code"` | |
| 716 | + Code int `json:"code"` | |
| 716 | 717 | Data QueryPlayerDataDesc `json:"data"` |
| 717 | 718 | } |
| 718 | 719 | |
| 719 | 720 | type QueryPlayerDataResp struct { |
| 720 | - Status string `json:"status"` | |
| 721 | + Status string `json:"status"` | |
| 721 | 722 | Result QueryPlayerDataResult `json:"result"` |
| 722 | 723 | } |
| 723 | 724 | |
| 724 | 725 | //********************************************************************************************************** |
| 725 | 726 | |
| 726 | - | |
| 727 | - | |
| 728 | - | |
| 729 | 727 | //玩家数据 |
| 730 | 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 | 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 | 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 | 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 | 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 | 903 | lastteamsec := 0 |
| 892 | 904 | lastchatteamsec := 0 |
| 893 | 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 | 932 | redishandler.GetRedisClient().HSet(redis.USER_CHAT_ISNEW, strconv.Itoa(uuid), "1") |
| 921 | 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 | 1020 | var talklistuid []int | ... | ... |
src/HttpServer/logic/httpserver.go
| ... | ... | @@ -27,8 +27,9 @@ func StartHttpServe() { |
| 27 | 27 | type TestTes struct { |
| 28 | 28 | TestInt int |
| 29 | 29 | } |
| 30 | + | |
| 30 | 31 | //just for test |
| 31 | -func (d *TestTes)Testsendhttp() { | |
| 32 | +func (d *TestTes) Testsendhttp() { | |
| 32 | 33 | d.TestInt = 99 |
| 33 | 34 | } |
| 34 | 35 | |
| ... | ... | @@ -43,62 +44,72 @@ func startServerHttpServe() { |
| 43 | 44 | //recover() //可以打印panic的错误信息 |
| 44 | 45 | //fmt.Println(recover()) |
| 45 | 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 | 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 | 99 | err := http.ListenAndServe(conf.GetServerHttpAddrConf(), nil) |
| 99 | 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 | 114 | func queryNewMessage(w http.ResponseWriter, r *http.Request) { |
| 104 | 115 | |
| ... | ... | @@ -108,7 +119,7 @@ func queryNewMessage(w http.ResponseWriter, r *http.Request) { |
| 108 | 119 | s := string(result) |
| 109 | 120 | //logger.Info("queryNewMessage , body:%v", s) |
| 110 | 121 | |
| 111 | - HandlequeryNewMessage(w,s) | |
| 122 | + HandlequeryNewMessage(w, s) | |
| 112 | 123 | } |
| 113 | 124 | |
| 114 | 125 | func NewSaveData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -119,10 +130,9 @@ func NewSaveData(w http.ResponseWriter, r *http.Request) { |
| 119 | 130 | s := string(result) |
| 120 | 131 | logger.Info("NewSaveData , body:%v", s) |
| 121 | 132 | |
| 122 | - HandleNewSaveData(w,s) | |
| 133 | + HandleNewSaveData(w, s) | |
| 123 | 134 | } |
| 124 | 135 | |
| 125 | - | |
| 126 | 136 | func NewGetData(w http.ResponseWriter, r *http.Request) { |
| 127 | 137 | |
| 128 | 138 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -131,7 +141,7 @@ func NewGetData(w http.ResponseWriter, r *http.Request) { |
| 131 | 141 | s := string(result) |
| 132 | 142 | //logger.Info("NewGetData , body:%v", s) |
| 133 | 143 | |
| 134 | - HandleNewGetData(w,s) | |
| 144 | + HandleNewGetData(w, s) | |
| 135 | 145 | } |
| 136 | 146 | |
| 137 | 147 | func InitIndex(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -142,10 +152,9 @@ func InitIndex(w http.ResponseWriter, r *http.Request) { |
| 142 | 152 | s := string(result) |
| 143 | 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 | 158 | func checkFileIsExist(filename string) bool { |
| 150 | 159 | var exist = true |
| 151 | 160 | if _, err := os.Stat(filename); os.IsNotExist(err) { |
| ... | ... | @@ -163,7 +172,6 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { |
| 163 | 172 | a.a = 1*/ |
| 164 | 173 | logger.Info("QueryAllAccount ") |
| 165 | 174 | |
| 166 | - | |
| 167 | 175 | //先打开文件 |
| 168 | 176 | filename := "./data.txt" |
| 169 | 177 | var f *os.File |
| ... | ... | @@ -172,8 +180,8 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { |
| 172 | 180 | if checkFileIsExist(filename) { //如果文件存在 |
| 173 | 181 | f, err1 = os.OpenFile(filename, os.O_APPEND|os.O_WRONLY, os.ModeAppend) //打开文件 |
| 174 | 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 | 185 | os.Remove(filename) |
| 178 | 186 | } |
| 179 | 187 | } |
| ... | ... | @@ -186,47 +194,46 @@ func QueryAllAccount(w http.ResponseWriter, r *http.Request) { |
| 186 | 194 | f.Read(fileHeader) |
| 187 | 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 | 198 | w.Header().Set("Content-Type", http.DetectContentType(fileHeader)) |
| 191 | 199 | w.Header().Set("Content-Length", strconv.FormatInt(fileStat.Size(), 10)) |
| 192 | 200 | |
| 193 | 201 | f.Seek(0, 0) |
| 194 | 202 | io.Copy(w, f) |
| 195 | 203 | //io.Copy(f,r.Body) |
| 196 | - fmt.Fprint(w,"success") | |
| 204 | + fmt.Fprint(w, "success") | |
| 197 | 205 | } |
| 198 | 206 | |
| 199 | - | |
| 200 | 207 | func AddGoldAndLove(w http.ResponseWriter, r *http.Request) { |
| 201 | 208 | |
| 202 | 209 | query := r.URL.Query() |
| 203 | 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 | 217 | if suuid == "" { |
| 211 | 218 | fmt.Fprint(w, "uuid is nil,please check") |
| 212 | 219 | return |
| 213 | 220 | } |
| 214 | - var wilteist []int | |
| 221 | + var wilteist []int | |
| 215 | 222 | rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" |
| 216 | - vv,err := redishandler.GetRedisClient().HGetAllKeys(rkey) | |
| 223 | + vv, err := redishandler.GetRedisClient().HGetAllKeys(rkey) | |
| 217 | 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 | 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 | 235 | isinwhitelist := false |
| 229 | - for _,val := range wilteist { | |
| 236 | + for _, val := range wilteist { | |
| 230 | 237 | if val == uuid { |
| 231 | 238 | isinwhitelist = true |
| 232 | 239 | break |
| ... | ... | @@ -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 | 251 | if err != nil { |
| 245 | - fmt.Fprint(w, "加金币失败了,错误码%v",err) | |
| 252 | + fmt.Fprint(w, "加金币失败了,错误码%v", err) | |
| 246 | 253 | } |
| 247 | 254 | |
| 248 | 255 | //清楚redis |
| 249 | 256 | rediskey1 := "cat:cafe:userext:where:user_id:" + suuid |
| 250 | 257 | err = redishandler.GetRedisClient().Delete(rediskey1) |
| 251 | 258 | if err != nil { |
| 252 | - fmt.Fprint(w, "加金币失败了,错误码%v",err) | |
| 259 | + fmt.Fprint(w, "加金币失败了,错误码%v", err) | |
| 253 | 260 | } |
| 254 | 261 | |
| 255 | 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 | 267 | func AddWhiteList(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -268,12 +275,12 @@ func AddWhiteList(w http.ResponseWriter, r *http.Request) { |
| 268 | 275 | } |
| 269 | 276 | //uuidnum,_ := strconv.Atoi(uuid) |
| 270 | 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 | 293 | fmt.Fprint(w, "uuid is nil,please check") |
| 287 | 294 | return |
| 288 | 295 | } |
| 289 | - uuidnum,_ := strconv.Atoi(uuid) | |
| 296 | + uuidnum, _ := strconv.Atoi(uuid) | |
| 290 | 297 | /*coin,err := mysql.TestClearData(uuidnum) |
| 291 | 298 | if err != nil { |
| 292 | 299 | logger.Error("ClearData err=%v",err) |
| ... | ... | @@ -295,22 +302,22 @@ func ClearData(w http.ResponseWriter, r *http.Request) { |
| 295 | 302 | fmt.Fprint(w, "ClearData coin=%v",coin)*/ |
| 296 | 303 | |
| 297 | 304 | //首先检查白名单 |
| 298 | - var wilteist []int | |
| 305 | + var wilteist []int | |
| 299 | 306 | rkey := "CATCAFE_REDIS_CAN_RESETDATA_LIST" |
| 300 | - vv,err := redishandler.GetRedisClient().HGetAllKeys(rkey) | |
| 307 | + vv, err := redishandler.GetRedisClient().HGetAllKeys(rkey) | |
| 301 | 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 | 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 | 319 | isinwhitelist := false |
| 313 | - for _,val := range wilteist { | |
| 320 | + for _, val := range wilteist { | |
| 314 | 321 | if val == uuidnum { |
| 315 | 322 | isinwhitelist = true |
| 316 | 323 | break |
| ... | ... | @@ -325,39 +332,36 @@ func ClearData(w http.ResponseWriter, r *http.Request) { |
| 325 | 332 | |
| 326 | 333 | err = mysql.DoClearData(uuidnum) |
| 327 | 334 | if err != nil { |
| 328 | - fmt.Fprint(w, "清除数据失败了,错误码%v",err) | |
| 335 | + fmt.Fprint(w, "清除数据失败了,错误码%v", err) | |
| 329 | 336 | } |
| 330 | 337 | |
| 331 | 338 | //下面清楚redis |
| 332 | 339 | rediskey := "cat:cafe:data:where:data_uid:" + uuid |
| 333 | - exist,_ := redishandler.GetRedisClient().Exists(rediskey) | |
| 340 | + exist, _ := redishandler.GetRedisClient().Exists(rediskey) | |
| 334 | 341 | if exist { |
| 335 | 342 | //存在,即删除 |
| 336 | 343 | err = redishandler.GetRedisClient().Delete(rediskey) |
| 337 | 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 | 349 | rediskey1 := "cat:cafe:data_new:where:data_uid:" + uuid |
| 344 | - exist,_ = redishandler.GetRedisClient().Exists(rediskey1) | |
| 350 | + exist, _ = redishandler.GetRedisClient().Exists(rediskey1) | |
| 345 | 351 | if exist { |
| 346 | 352 | //存在,即删除 |
| 347 | 353 | err = redishandler.GetRedisClient().Delete(rediskey1) |
| 348 | 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 | 360 | //将id从白名单删除 |
| 356 | - redishandler.GetRedisClient().HDel(rkey,uuid) | |
| 361 | + redishandler.GetRedisClient().HDel(rkey, uuid) | |
| 357 | 362 | //HandleRegeister(w,s) |
| 358 | 363 | } |
| 359 | 364 | |
| 360 | - | |
| 361 | 365 | func SaveDataBackup(w http.ResponseWriter, r *http.Request) { |
| 362 | 366 | |
| 363 | 367 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -366,7 +370,7 @@ func SaveDataBackup(w http.ResponseWriter, r *http.Request) { |
| 366 | 370 | s := string(result) |
| 367 | 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 | 382 | s := string(result) |
| 379 | 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 | 394 | s := string(result) |
| 391 | 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 | 401 | func FetchInviteReward(w http.ResponseWriter, r *http.Request) { |
| 399 | 402 | |
| 400 | 403 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -403,7 +406,7 @@ func FetchInviteReward(w http.ResponseWriter, r *http.Request) { |
| 403 | 406 | s := string(result) |
| 404 | 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 | 418 | s := string(result) |
| 416 | 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 | 430 | s := string(result) |
| 428 | 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 | 442 | s := string(result) |
| 440 | 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 | 448 | func Wechatlogin(w http.ResponseWriter, r *http.Request) { |
| 447 | 449 | |
| 448 | 450 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -451,10 +453,9 @@ func Wechatlogin(w http.ResponseWriter, r *http.Request) { |
| 451 | 453 | s := string(result) |
| 452 | 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 | 459 | func QueryPlayerData(w http.ResponseWriter, r *http.Request) { |
| 459 | 460 | |
| 460 | 461 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -463,10 +464,9 @@ func QueryPlayerData(w http.ResponseWriter, r *http.Request) { |
| 463 | 464 | s := string(result) |
| 464 | 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 | 470 | func DelFriend(w http.ResponseWriter, r *http.Request) { |
| 471 | 471 | |
| 472 | 472 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -475,10 +475,9 @@ func DelFriend(w http.ResponseWriter, r *http.Request) { |
| 475 | 475 | s := string(result) |
| 476 | 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 | 481 | func HandleFriendRequest(w http.ResponseWriter, r *http.Request) { |
| 483 | 482 | |
| 484 | 483 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -487,10 +486,9 @@ func HandleFriendRequest(w http.ResponseWriter, r *http.Request) { |
| 487 | 486 | s := string(result) |
| 488 | 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 | 492 | func GetRecommendList(w http.ResponseWriter, r *http.Request) { |
| 495 | 493 | |
| 496 | 494 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -499,7 +497,7 @@ func GetRecommendList(w http.ResponseWriter, r *http.Request) { |
| 499 | 497 | s := string(result) |
| 500 | 498 | logger.Info("GetRecommendList , body:%v,uuid=%v", s) |
| 501 | 499 | |
| 502 | - HandleGetRecommendList(w,s) | |
| 500 | + HandleGetRecommendList(w, s) | |
| 503 | 501 | } |
| 504 | 502 | |
| 505 | 503 | func GetAuditList(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -510,10 +508,9 @@ func GetAuditList(w http.ResponseWriter, r *http.Request) { |
| 510 | 508 | s := string(result) |
| 511 | 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 | 514 | func GetFriendList(w http.ResponseWriter, r *http.Request) { |
| 518 | 515 | |
| 519 | 516 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -522,7 +519,7 @@ func GetFriendList(w http.ResponseWriter, r *http.Request) { |
| 522 | 519 | s := string(result) |
| 523 | 520 | logger.Info("GetFriendList , body:%v,uuid=%v", s) |
| 524 | 521 | |
| 525 | - HandleGetFriendList(w,s) | |
| 522 | + HandleGetFriendList(w, s) | |
| 526 | 523 | } |
| 527 | 524 | |
| 528 | 525 | func SetFriendRequest(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -533,7 +530,7 @@ func SetFriendRequest(w http.ResponseWriter, r *http.Request) { |
| 533 | 530 | s := string(result) |
| 534 | 531 | logger.Info("SetFriendRequest , body:%v,uuid=%v", s) |
| 535 | 532 | |
| 536 | - HandleSetFriendRequest(w,s) | |
| 533 | + HandleSetFriendRequest(w, s) | |
| 537 | 534 | } |
| 538 | 535 | |
| 539 | 536 | func SearchTeam(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -544,7 +541,7 @@ func SearchTeam(w http.ResponseWriter, r *http.Request) { |
| 544 | 541 | s := string(result) |
| 545 | 542 | logger.Info("SearchTeam , body:%v,uuid=%v", s) |
| 546 | 543 | |
| 547 | - HandleSearchTeam(w,s) | |
| 544 | + HandleSearchTeam(w, s) | |
| 548 | 545 | } |
| 549 | 546 | |
| 550 | 547 | func GetTeamList(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -555,7 +552,7 @@ func GetTeamList(w http.ResponseWriter, r *http.Request) { |
| 555 | 552 | s := string(result) |
| 556 | 553 | logger.Info("GetTeamList , body:%v,uuid=%v", s) |
| 557 | 554 | |
| 558 | - HandleGetTeamList(w,s) | |
| 555 | + HandleGetTeamList(w, s) | |
| 559 | 556 | } |
| 560 | 557 | |
| 561 | 558 | func GetDataByUserId(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -566,7 +563,7 @@ func GetDataByUserId(w http.ResponseWriter, r *http.Request) { |
| 566 | 563 | s := string(result) |
| 567 | 564 | logger.Info("GetDataByUserId , body:%v,uuid=%v", s) |
| 568 | 565 | |
| 569 | - HandleGetDataByUserId(w,s) | |
| 566 | + HandleGetDataByUserId(w, s) | |
| 570 | 567 | } |
| 571 | 568 | |
| 572 | 569 | func GetTeamData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -577,7 +574,7 @@ func GetTeamData(w http.ResponseWriter, r *http.Request) { |
| 577 | 574 | s := string(result) |
| 578 | 575 | logger.Info("GetTeamData , body:%v,uuid=%v", s) |
| 579 | 576 | |
| 580 | - HandleGetTeamData(w,s) | |
| 577 | + HandleGetTeamData(w, s) | |
| 581 | 578 | } |
| 582 | 579 | |
| 583 | 580 | func GetTeamBuff(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -588,10 +585,9 @@ func GetTeamBuff(w http.ResponseWriter, r *http.Request) { |
| 588 | 585 | s := string(result) |
| 589 | 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 | 591 | func AddTeamBuff(w http.ResponseWriter, r *http.Request) { |
| 596 | 592 | |
| 597 | 593 | result, _ := ioutil.ReadAll(r.Body) |
| ... | ... | @@ -600,7 +596,7 @@ func AddTeamBuff(w http.ResponseWriter, r *http.Request) { |
| 600 | 596 | s := string(result) |
| 601 | 597 | logger.Info("AddTeamBuff , body:%v,uuid=%v", s) |
| 602 | 598 | |
| 603 | - HandleAddTeamBuff(w,s) | |
| 599 | + HandleAddTeamBuff(w, s) | |
| 604 | 600 | } |
| 605 | 601 | |
| 606 | 602 | func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -611,7 +607,7 @@ func UpdateTeamBuild(w http.ResponseWriter, r *http.Request) { |
| 611 | 607 | s := string(result) |
| 612 | 608 | logger.Info("UpdateTeamBuild , body:%v,uuid=%v", s) |
| 613 | 609 | |
| 614 | - HandleUpdateTeamBuild(w,s) | |
| 610 | + HandleUpdateTeamBuild(w, s) | |
| 615 | 611 | } |
| 616 | 612 | |
| 617 | 613 | func QuitTeam(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -622,7 +618,7 @@ func QuitTeam(w http.ResponseWriter, r *http.Request) { |
| 622 | 618 | s := string(result) |
| 623 | 619 | logger.Info("QuitTeam , body:%v,uuid=%v", s) |
| 624 | 620 | |
| 625 | - HandleQuitTeam(w,s) | |
| 621 | + HandleQuitTeam(w, s) | |
| 626 | 622 | } |
| 627 | 623 | |
| 628 | 624 | func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -633,7 +629,7 @@ func JoinTeamByInvite(w http.ResponseWriter, r *http.Request) { |
| 633 | 629 | s := string(result) |
| 634 | 630 | logger.Info("JoinTeamByInvite , body:%v,uuid=%v", s) |
| 635 | 631 | |
| 636 | - HandleJoinTeamByInvite(w,s) | |
| 632 | + HandleJoinTeamByInvite(w, s) | |
| 637 | 633 | } |
| 638 | 634 | |
| 639 | 635 | func JoinTeam(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -644,7 +640,7 @@ func JoinTeam(w http.ResponseWriter, r *http.Request) { |
| 644 | 640 | s := string(result) |
| 645 | 641 | logger.Info("JoinTeam , body:%v,uuid=%v", s) |
| 646 | 642 | |
| 647 | - HandleJoinTeam(w,s) | |
| 643 | + HandleJoinTeam(w, s) | |
| 648 | 644 | } |
| 649 | 645 | |
| 650 | 646 | func UpdateTeamData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -655,7 +651,7 @@ func UpdateTeamData(w http.ResponseWriter, r *http.Request) { |
| 655 | 651 | s := string(result) |
| 656 | 652 | logger.Info("UpdateTeamData , body:%v,uuid=%v", s) |
| 657 | 653 | |
| 658 | - HandleUpdateTeamData(w,s) | |
| 654 | + HandleUpdateTeamData(w, s) | |
| 659 | 655 | } |
| 660 | 656 | |
| 661 | 657 | func CreateTeam(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -666,7 +662,7 @@ func CreateTeam(w http.ResponseWriter, r *http.Request) { |
| 666 | 662 | s := string(result) |
| 667 | 663 | logger.Info("CreateTeam , body:%v,uuid=%v", s) |
| 668 | 664 | |
| 669 | - HandleCreateTeam(w,s) | |
| 665 | + HandleCreateTeam(w, s) | |
| 670 | 666 | } |
| 671 | 667 | |
| 672 | 668 | func TextCheck(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -677,7 +673,7 @@ func TextCheck(w http.ResponseWriter, r *http.Request) { |
| 677 | 673 | s := string(result) |
| 678 | 674 | logger.Info("TextCheck , body:%v,uuid=%v", s) |
| 679 | 675 | |
| 680 | - HandleTextCheck(w,s) | |
| 676 | + HandleTextCheck(w, s) | |
| 681 | 677 | } |
| 682 | 678 | |
| 683 | 679 | func SaveUserData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -688,7 +684,7 @@ func SaveUserData(w http.ResponseWriter, r *http.Request) { |
| 688 | 684 | s := string(result) |
| 689 | 685 | logger.Info("saveUserData , body:%v,uuid=%v", s) |
| 690 | 686 | |
| 691 | - HandleSaveUserData(w,s) | |
| 687 | + HandleSaveUserData(w, s) | |
| 692 | 688 | } |
| 693 | 689 | |
| 694 | 690 | func SaveData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -699,7 +695,7 @@ func SaveData(w http.ResponseWriter, r *http.Request) { |
| 699 | 695 | s := string(result) |
| 700 | 696 | logger.Info("saveData , body:%v,uuid=%v", s) |
| 701 | 697 | |
| 702 | - HandlesaveData(w,s) | |
| 698 | + HandlesaveData(w, s) | |
| 703 | 699 | } |
| 704 | 700 | |
| 705 | 701 | func GetData(w http.ResponseWriter, r *http.Request) { |
| ... | ... | @@ -710,10 +706,9 @@ func GetData(w http.ResponseWriter, r *http.Request) { |
| 710 | 706 | s := string(result) |
| 711 | 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 | 712 | func UserLogin(w http.ResponseWriter, r *http.Request) { |
| 718 | 713 | //logger.Info("%%%%%%%%%%%%%%%%path=%v", *r.URL) |
| 719 | 714 | //for k, v := range r.Header { |
| ... | ... | @@ -737,7 +732,5 @@ func UserLogin(w http.ResponseWriter, r *http.Request) { |
| 737 | 732 | s := string(result) |
| 738 | 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 | 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 | 30 | var extdata UserExtData |
| 32 | 31 | extdata.User_id = uuid |
| 33 | 32 | extdata.Lv = 1 |
| ... | ... | @@ -45,7 +44,7 @@ func InitUserExt(req *UserLoginReq,resp *UserLoginResp,uuid int) { |
| 45 | 44 | extdata.User_scene = req.Scene |
| 46 | 45 | resp.Result.Data.Extdata = extdata |
| 47 | 46 | //保存 |
| 48 | - udata :=new(UserData) | |
| 47 | + udata := new(UserData) | |
| 49 | 48 | udata.Scene = extdata.User_scene |
| 50 | 49 | udata.Hot = extdata.Hot |
| 51 | 50 | udata.Exp = extdata.Exp |
| ... | ... | @@ -71,7 +70,7 @@ func InitAccountLogin(account string) { |
| 71 | 70 | //首先生成token |
| 72 | 71 | newToken := ksuid.New().String() |
| 73 | 72 | //保存token与account的关系 |
| 74 | - SaveAccountToken(account,newToken) | |
| 73 | + SaveAccountToken(account, newToken) | |
| 75 | 74 | //首先生成user_base_data |
| 76 | 75 | var basedata UserBaseData |
| 77 | 76 | basedata.User_id = GetNewUUid() |
| ... | ... | @@ -83,9 +82,9 @@ func InitAccountLogin(account string) { |
| 83 | 82 | basedata.User_token = newToken |
| 84 | 83 | //保存base data |
| 85 | 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 | 88 | //然后生成user_ext_data |
| 90 | 89 | var extdata UserExtData |
| 91 | 90 | extdata.User_id = basedata.User_id |
| ... | ... | @@ -102,7 +101,7 @@ func InitAccountLogin(account string) { |
| 102 | 101 | extdata.User_is_black = 0 |
| 103 | 102 | extdata.User_reg_time = int(time.Now().Unix()) |
| 104 | 103 | extdata.User_scene = 0 |
| 105 | - udata :=new(UserData) | |
| 104 | + udata := new(UserData) | |
| 106 | 105 | udata.Scene = extdata.User_scene |
| 107 | 106 | udata.Hot = extdata.Hot |
| 108 | 107 | udata.Exp = extdata.Exp |
| ... | ... | @@ -124,7 +123,7 @@ func InitAccountLogin(account string) { |
| 124 | 123 | SaveUserExt(udata) |
| 125 | 124 | } |
| 126 | 125 | |
| 127 | -func InitTourist(req *UserLoginReq,resp *UserLoginResp) { | |
| 126 | +func InitTourist(req *UserLoginReq, resp *UserLoginResp) { | |
| 128 | 127 | //首先生成user_base_data |
| 129 | 128 | var basedata UserBaseData |
| 130 | 129 | basedata.User_id = GetNewUUid() |
| ... | ... | @@ -137,16 +136,16 @@ func InitTourist(req *UserLoginReq,resp *UserLoginResp) { |
| 137 | 136 | resp.Result.Data.Dasedata = basedata |
| 138 | 137 | //保存base data |
| 139 | 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 | 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 | 149 | //首先生成user_base_data |
| 151 | 150 | var basedata UserBaseData |
| 152 | 151 | basedata.User_id = GetNewUUid() |
| ... | ... | @@ -159,9 +158,9 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) { |
| 159 | 158 | resp.Result.Data.Dasedata = basedata |
| 160 | 159 | //保存base data |
| 161 | 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 | 164 | //然后生成user_ext_data |
| 166 | 165 | var extdata UserExtData |
| 167 | 166 | extdata.User_id = basedata.User_id |
| ... | ... | @@ -180,7 +179,7 @@ func InitWeChatUser(req *WechatLoginReq,resp *UserLoginResp,uinfo *WxUserInfo) { |
| 180 | 179 | extdata.User_scene = 0 |
| 181 | 180 | resp.Result.Data.Extdata = extdata |
| 182 | 181 | //保存 |
| 183 | - udata :=new(UserData) | |
| 182 | + udata := new(UserData) | |
| 184 | 183 | udata.Scene = extdata.User_scene |
| 185 | 184 | udata.Hot = extdata.Hot |
| 186 | 185 | udata.Exp = extdata.Exp |
| ... | ... | @@ -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 | 217 | out.LoveExp = in.Loevexp |
| 219 | 218 | out.User_id = in.Userid |
| 220 | 219 | out.ShopNum = in.Shopnum |
| ... | ... | @@ -232,7 +231,6 @@ func TransmitUserData(in *UserData ,out *UserExtData) { |
| 232 | 231 | out.Invite_uid = in.InviteUid |
| 233 | 232 | } |
| 234 | 233 | |
| 235 | - | |
| 236 | 234 | func HandleQueryInvite(w http.ResponseWriter, data string) { |
| 237 | 235 | |
| 238 | 236 | SetHeader(w) |
| ... | ... | @@ -247,7 +245,7 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { |
| 247 | 245 | break |
| 248 | 246 | } |
| 249 | 247 | |
| 250 | - inlist,err := mysql.QueryInvite(rdata.Uuid) | |
| 248 | + inlist, err := mysql.QueryInvite(rdata.Uuid) | |
| 251 | 249 | if err != nil { |
| 252 | 250 | logger.Error("HandleQueryInvite QueryInvite failed=%v", err) |
| 253 | 251 | resp.Result.Code = ERROR_JSONUNMASHFAILED |
| ... | ... | @@ -255,13 +253,13 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { |
| 255 | 253 | break |
| 256 | 254 | } |
| 257 | 255 | |
| 258 | - for _,val := range inlist { | |
| 256 | + for _, val := range inlist { | |
| 259 | 257 | var tmp QueryInviteData |
| 260 | 258 | tmp.Uuid = val.Uuid |
| 261 | 259 | tmp.Nickname = val.NickName |
| 262 | 260 | tmp.Isfetched = val.IsFecthed |
| 263 | 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 | 265 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -273,6 +271,51 @@ func HandleQueryInvite(w http.ResponseWriter, data string) { |
| 273 | 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 | 320 | func HandlequeryNewMessage(w http.ResponseWriter, data string) { |
| 278 | 321 | |
| ... | ... | @@ -289,7 +332,7 @@ func HandlequeryNewMessage(w http.ResponseWriter, data string) { |
| 289 | 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 | 336 | if err != nil { |
| 294 | 337 | logger.Error("HandlequeryNewMessage save failed=%v", err) |
| 295 | 338 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -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 | 350 | if err != nil { |
| 308 | 351 | logger.Error("HandlequeryNewMessage CheckHasNewMessage failed=%v", err) |
| 309 | 352 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -337,23 +380,22 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 337 | 380 | break |
| 338 | 381 | } |
| 339 | 382 | |
| 340 | - | |
| 341 | 383 | // |
| 342 | 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 | 386 | if err != nil { |
| 345 | 387 | //如果没有 直接保存即可 |
| 346 | 388 | var tmp1 GetDataSaveDesc |
| 347 | 389 | tmp1.Data_uid = strconv.Itoa(rdata.Uuid) |
| 348 | 390 | tmp1.Data_value = rdata.Value |
| 349 | - savestr,err:= json.Marshal(&tmp1) | |
| 391 | + savestr, err := json.Marshal(&tmp1) | |
| 350 | 392 | if err != nil { |
| 351 | 393 | logger.Error("HandleNewSaveData failed7,err=%v", err) |
| 352 | 394 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 353 | 395 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 354 | 396 | break |
| 355 | 397 | } |
| 356 | - err = redishandler.GetRedisClient().SetString(rkey,string(savestr)) | |
| 398 | + err = redishandler.GetRedisClient().SetString(rkey, string(savestr)) | |
| 357 | 399 | if err != nil { |
| 358 | 400 | logger.Error("HandleNewSaveData failed7,err=%v", err) |
| 359 | 401 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -378,7 +420,7 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 378 | 420 | |
| 379 | 421 | //break*/ |
| 380 | 422 | } |
| 381 | - val,_ = redishandler.GetRedisClient().GetString(rkey) | |
| 423 | + val, _ = redishandler.GetRedisClient().GetString(rkey) | |
| 382 | 424 | var final GetDataSaveDesc |
| 383 | 425 | err = json.Unmarshal([]byte(val), &final) |
| 384 | 426 | if err != nil { |
| ... | ... | @@ -388,7 +430,6 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 388 | 430 | } |
| 389 | 431 | val = final.Data_value |
| 390 | 432 | |
| 391 | - | |
| 392 | 433 | //解析val json |
| 393 | 434 | m1 := make(map[string]interface{}) |
| 394 | 435 | err = json.Unmarshal([]byte(val), &m1) |
| ... | ... | @@ -410,31 +451,31 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 410 | 451 | //比较猫数据 |
| 411 | 452 | catmap1 := m1["catData"].(map[string]interface{}) |
| 412 | 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 | 456 | if len(catmap2) < len(catmap1) { |
| 416 | 457 | logger.Error("HandleNewSaveData failed1,err=%v", err) |
| 417 | 458 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 418 | 459 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 419 | 460 | break |
| 420 | 461 | } |
| 421 | - for k,vak := range catmap2 { | |
| 462 | + for k, vak := range catmap2 { | |
| 422 | 463 | if catmap1[k] != nil { |
| 423 | 464 | //需要比较等级 |
| 424 | 465 | c2 := vak.(map[string]interface{}) |
| 425 | 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 | 469 | if c2["level"].(float64) < c1["level"].(float64) { |
| 429 | 470 | logger.Error("HandleNewSaveData failed2,err=%v", err) |
| 430 | 471 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 431 | 472 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 432 | 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 | 479 | //logger.Error("HandleNewSaveData failed10,k=%v",k) |
| 439 | 480 | } |
| 440 | 481 | } |
| ... | ... | @@ -442,15 +483,15 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 442 | 483 | //比较roomData |
| 443 | 484 | roommap1 := m1["roomData"].(map[string]interface{}) |
| 444 | 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 | 488 | if len(roommap2) < len(roommap1) { |
| 448 | 489 | logger.Error("HandleNewSaveData failed3,err=%v", err) |
| 449 | 490 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 450 | 491 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 451 | 492 | break |
| 452 | 493 | } |
| 453 | - for k,val := range roommap2 { | |
| 494 | + for k, val := range roommap2 { | |
| 454 | 495 | if roommap1[k] != nil { |
| 455 | 496 | r2 := val.(map[string]interface{}) |
| 456 | 497 | r1 := roommap1[k].(map[string]interface{}) |
| ... | ... | @@ -465,8 +506,8 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 465 | 506 | }*/ |
| 466 | 507 | |
| 467 | 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 | 511 | if len(rrr2) < len(rrr1) { |
| 471 | 512 | logger.Error("HandleNewSaveData failed5,err=%v", err) |
| 472 | 513 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -474,24 +515,24 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 474 | 515 | break |
| 475 | 516 | } |
| 476 | 517 | |
| 477 | - for k,_ := range rrr2 { | |
| 518 | + for k, _ := range rrr2 { | |
| 478 | 519 | if rrr1[k] != nil { |
| 479 | 520 | ddtr2 := rrr2[k].(map[string]interface{}) |
| 480 | 521 | ddtr1 := rrr1[k].(map[string]interface{}) |
| 481 | - if ddtr2["state"]!= nil && ddtr1["state"]!= nil { | |
| 522 | + if ddtr2["state"] != nil && ddtr1["state"] != nil { | |
| 482 | 523 | if ddtr2["state"].(float64) < ddtr1["state"].(float64) { |
| 483 | 524 | logger.Error("HandleNewSaveData failed15,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) |
| 484 | 525 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 485 | 526 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 486 | 527 | break |
| 487 | - }else { | |
| 528 | + } else { | |
| 488 | 529 | //logger.Error("HandleNewSaveData failed17,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) |
| 489 | 530 | } |
| 490 | - }else { | |
| 531 | + } else { | |
| 491 | 532 | logger.Error("HandleNewSaveData failed18,d2=%v,d1=%v", ddtr2["state"].(float64), ddtr1["state"].(float64)) |
| 492 | 533 | } |
| 493 | 534 | |
| 494 | - }else { | |
| 535 | + } else { | |
| 495 | 536 | //logger.Error("HandleNewSaveData failed16,k", k) |
| 496 | 537 | } |
| 497 | 538 | } |
| ... | ... | @@ -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 | 557 | if ok1 && ok2 { |
| 517 | 558 | if !issign2 && issign1 { |
| 518 | 559 | //无需验证 |
| ... | ... | @@ -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 | 571 | if ok1 && ok2 && ok3 && ok4 { |
| 531 | 572 | if signLoopId2 < signLoopId1 { |
| 532 | 573 | logger.Error("HandleNewSaveData failed31,err=%v", err) |
| ... | ... | @@ -550,14 +591,14 @@ func HandleNewSaveData(w http.ResponseWriter, data string) { |
| 550 | 591 | var tmp GetDataSaveDesc |
| 551 | 592 | tmp.Data_uid = strconv.Itoa(rdata.Uuid) |
| 552 | 593 | tmp.Data_value = rdata.Value |
| 553 | - savestr,err:= json.Marshal(&tmp) | |
| 594 | + savestr, err := json.Marshal(&tmp) | |
| 554 | 595 | if err != nil { |
| 555 | 596 | logger.Error("HandleNewSaveData failed7,err=%v", err) |
| 556 | 597 | resp.Result.Code = ERROR_SRVDB_FAILED |
| 557 | 598 | resp.Result.Data = "ERROR_SRVDB_FAILED" |
| 558 | 599 | break |
| 559 | 600 | } |
| 560 | - err = redishandler.GetRedisClient().SetString(rkey,string(savestr)) | |
| 601 | + err = redishandler.GetRedisClient().SetString(rkey, string(savestr)) | |
| 561 | 602 | if err != nil { |
| 562 | 603 | logger.Error("HandleNewSaveData failed7,err=%v", err) |
| 563 | 604 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -588,7 +629,7 @@ func HandleSaveDataBackup(w http.ResponseWriter, data string) { |
| 588 | 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 | 633 | if err != nil { |
| 593 | 634 | logger.Error("HandleQueryInviteWork save failed=%v", err) |
| 594 | 635 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -622,19 +663,19 @@ func HandleNewGetData(w http.ResponseWriter, data string) { |
| 622 | 663 | //先去取出新的数据 |
| 623 | 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 | 680 | var final GetDataSaveDesc |
| 640 | 681 | err = json.Unmarshal([]byte(val), &final) |
| ... | ... | @@ -648,19 +689,18 @@ func HandleNewGetData(w http.ResponseWriter, data string) { |
| 648 | 689 | |
| 649 | 690 | //如果是从老的数据过来的 存入新的数据key |
| 650 | 691 | if isfind { |
| 651 | - err = redishandler.GetRedisClient().SetString(rkey,val) | |
| 692 | + err = redishandler.GetRedisClient().SetString(rkey, val) | |
| 652 | 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 | 698 | break |
| 659 | 699 | } |
| 660 | 700 | |
| 661 | 701 | //回包 |
| 662 | 702 | respstr, _ := json.Marshal(&resp) |
| 663 | - logger.Info("HandleNewGetData new is=%v",string(respstr)) | |
| 703 | + logger.Info("HandleNewGetData new is=%v", string(respstr)) | |
| 664 | 704 | fmt.Fprint(w, string(respstr)) |
| 665 | 705 | } |
| 666 | 706 | |
| ... | ... | @@ -686,7 +726,6 @@ func HandleInitIndex(w http.ResponseWriter, data string) { |
| 686 | 726 | fmt.Fprint(w, string(respstr)) |
| 687 | 727 | } |
| 688 | 728 | |
| 689 | - | |
| 690 | 729 | func HandleQueryInviteWork(w http.ResponseWriter, data string) { |
| 691 | 730 | |
| 692 | 731 | SetHeader(w) |
| ... | ... | @@ -702,18 +741,18 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) { |
| 702 | 741 | break |
| 703 | 742 | } |
| 704 | 743 | |
| 705 | - dalist,offlist,_ := GetdagongList(rdata.Uuid) | |
| 744 | + dalist, offlist, _ := GetdagongList(rdata.Uuid) | |
| 706 | 745 | if dalist == nil { |
| 707 | 746 | resp.Result.Code = ERROR_OK |
| 708 | 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 | 758 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -725,8 +764,6 @@ func HandleQueryInviteWork(w http.ResponseWriter, data string) { |
| 725 | 764 | fmt.Fprint(w, string(respstr)) |
| 726 | 765 | } |
| 727 | 766 | |
| 728 | - | |
| 729 | - | |
| 730 | 767 | func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 731 | 768 | |
| 732 | 769 | SetHeader(w) |
| ... | ... | @@ -749,7 +786,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 749 | 786 | //邀请新用户 |
| 750 | 787 | //首先要判断一下这个玩家是否已经被邀请过了 |
| 751 | 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 | 790 | if err != nil { |
| 754 | 791 | logger.Error("HandleEnterInvite redis failed=%v", err) |
| 755 | 792 | resp.Result.Code = ERROR_JSONUNMASHFAILED |
| ... | ... | @@ -764,17 +801,16 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 764 | 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 | 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 | 812 | //invitelist,err := GetdagongList(rdata.Inviteuuid) |
| 777 | - invitelist,reallist,err :=GetRealDagonglist(rdata.Inviteuuid) | |
| 813 | + invitelist, reallist, err := GetRealDagonglist(rdata.Inviteuuid) | |
| 778 | 814 | if err != nil { |
| 779 | 815 | /*logger.Error("HandleEnterInvite GetdagongList failed") |
| 780 | 816 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -783,7 +819,7 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 783 | 819 | } |
| 784 | 820 | |
| 785 | 821 | if reallist != nil { |
| 786 | - if len(*reallist) > 2 { | |
| 822 | + if len(*reallist) > 2 { | |
| 787 | 823 | logger.Error("HandleEnterInvite dagong num is full") |
| 788 | 824 | resp.Result.Code = ERROR_DAGONG_FULL |
| 789 | 825 | //resp.Message = "dagong full" |
| ... | ... | @@ -799,26 +835,24 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 799 | 835 | } |
| 800 | 836 | |
| 801 | 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 | 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 | 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 | 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 | 856 | if err != nil { |
| 823 | 857 | logger.Error("HandleEnterInvite ERROR_SRVDB_FAILED") |
| 824 | 858 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -827,7 +861,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 827 | 861 | } |
| 828 | 862 | } |
| 829 | 863 | |
| 830 | - | |
| 831 | 864 | resp.Result.Code = ERROR_OK |
| 832 | 865 | break |
| 833 | 866 | } |
| ... | ... | @@ -837,7 +870,6 @@ func HandleEnterInvite(w http.ResponseWriter, data string) { |
| 837 | 870 | fmt.Fprint(w, string(respstr)) |
| 838 | 871 | } |
| 839 | 872 | |
| 840 | - | |
| 841 | 873 | func HandleFetchInviteReward(w http.ResponseWriter, data string) { |
| 842 | 874 | |
| 843 | 875 | SetHeader(w) |
| ... | ... | @@ -854,7 +886,7 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) { |
| 854 | 886 | } |
| 855 | 887 | |
| 856 | 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 | 890 | if err != nil { |
| 859 | 891 | logger.Error("HandleFetchInviteReward redis failed=%v", err) |
| 860 | 892 | resp.Result.Code = ERROR_JSONUNMASHFAILED |
| ... | ... | @@ -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 | 907 | resp.Result.Code = ERROR_OK |
| 876 | 908 | break |
| ... | ... | @@ -881,7 +913,6 @@ func HandleFetchInviteReward(w http.ResponseWriter, data string) { |
| 881 | 913 | fmt.Fprint(w, string(respstr)) |
| 882 | 914 | } |
| 883 | 915 | |
| 884 | - | |
| 885 | 916 | func HandleRegeister(w http.ResponseWriter, data string) { |
| 886 | 917 | |
| 887 | 918 | SetHeader(w) |
| ... | ... | @@ -900,7 +931,7 @@ func HandleRegeister(w http.ResponseWriter, data string) { |
| 900 | 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 | 935 | if err != nil { |
| 905 | 936 | logger.Error("HandleRegeister redis failed failed=%v", err) |
| 906 | 937 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -913,7 +944,7 @@ func HandleRegeister(w http.ResponseWriter, data string) { |
| 913 | 944 | break |
| 914 | 945 | } |
| 915 | 946 | |
| 916 | - err = SaveAccount(rdata.Account,rdata.Password) | |
| 947 | + err = SaveAccount(rdata.Account, rdata.Password) | |
| 917 | 948 | if err != nil { |
| 918 | 949 | logger.Error("HandleRegeister redis failed failed=%v", err) |
| 919 | 950 | resp.Result.Code = ERROR_SRVDB_FAILED |
| ... | ... | @@ -932,7 +963,6 @@ func HandleRegeister(w http.ResponseWriter, data string) { |
| 932 | 963 | fmt.Fprint(w, string(respstr)) |
| 933 | 964 | } |
| 934 | 965 | |
| 935 | - | |
| 936 | 966 | func HandleAccounLogin(w http.ResponseWriter, data string) { |
| 937 | 967 | |
| 938 | 968 | SetHeader(w) |
| ... | ... | @@ -948,7 +978,7 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { |
| 948 | 978 | break |
| 949 | 979 | } |
| 950 | 980 | |
| 951 | - err := CheckAccout(rdata.Account,rdata.Password) | |
| 981 | + err := CheckAccout(rdata.Account, rdata.Password) | |
| 952 | 982 | |
| 953 | 983 | if err != nil { |
| 954 | 984 | logger.Error("HandleRegeister pwssword failed failed=%v", err) |
| ... | ... | @@ -959,14 +989,14 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { |
| 959 | 989 | //查询数据 |
| 960 | 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 | 994 | logger.Error("HandleAccounLogin getuuid failed=%v", err) |
| 965 | 995 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 966 | 996 | break |
| 967 | 997 | } |
| 968 | 998 | |
| 969 | - basic,err := GetUserBasic(uuid) | |
| 999 | + basic, err := GetUserBasic(uuid) | |
| 970 | 1000 | if err != nil { |
| 971 | 1001 | logger.Error("HandleAccounLogin getbasic failed=%v", err) |
| 972 | 1002 | resp.Result.Code = ERROR_GETUSERBASICFAILED |
| ... | ... | @@ -974,21 +1004,20 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { |
| 974 | 1004 | } |
| 975 | 1005 | resp.Result.Data.Dasedata = *basic |
| 976 | 1006 | |
| 977 | - ext,err := GetUserExt(uuid) | |
| 1007 | + ext, err := GetUserExt(uuid) | |
| 978 | 1008 | if err != nil { |
| 979 | 1009 | logger.Error("HandleAccounLogin getext failed=%v", err) |
| 980 | 1010 | resp.Result.Code = ERROR_GETUSEREXTFAILED |
| 981 | 1011 | break |
| 982 | 1012 | } |
| 983 | - TransmitUserData(ext,&resp.Result.Data.Extdata) | |
| 1013 | + TransmitUserData(ext, &resp.Result.Data.Extdata) | |
| 984 | 1014 | |
| 985 | 1015 | //需要处理登录数据 |
| 986 | 1016 | HandleLoginTime(ext) |
| 987 | 1017 | |
| 988 | - m_userInfo.Set(uint32(ext.Userid),ext) | |
| 1018 | + m_userInfo.Set(uint32(ext.Userid), ext) | |
| 989 | 1019 | SaveUserExt(ext) |
| 990 | 1020 | |
| 991 | - | |
| 992 | 1021 | resp.Result.Code = ERROR_OK |
| 993 | 1022 | break |
| 994 | 1023 | } |
| ... | ... | @@ -998,7 +1027,6 @@ func HandleAccounLogin(w http.ResponseWriter, data string) { |
| 998 | 1027 | fmt.Fprint(w, string(respstr)) |
| 999 | 1028 | } |
| 1000 | 1029 | |
| 1001 | - | |
| 1002 | 1030 | //处理微信登录 |
| 1003 | 1031 | func HandleWechatlogin(w http.ResponseWriter, data string) { |
| 1004 | 1032 | |
| ... | ... | @@ -1022,15 +1050,15 @@ func HandleWechatlogin(w http.ResponseWriter, data string) { |
| 1022 | 1050 | resp.Result.Code = ERROR_WECHATLOGINFAILED |
| 1023 | 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 | 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 | 1062 | if err != nil { |
| 1035 | 1063 | logger.Error("HandleWechatlogin getbasic failed=%v", err) |
| 1036 | 1064 | resp.Result.Code = ERROR_GETUSERBASICFAILED |
| ... | ... | @@ -1038,25 +1066,22 @@ func HandleWechatlogin(w http.ResponseWriter, data string) { |
| 1038 | 1066 | } |
| 1039 | 1067 | resp.Result.Data.Dasedata = *basic |
| 1040 | 1068 | |
| 1041 | - ext,err := GetUserExt(uuid) | |
| 1069 | + ext, err := GetUserExt(uuid) | |
| 1042 | 1070 | if err != nil { |
| 1043 | 1071 | logger.Error("HandleWechatlogin getext failed=%v", err) |
| 1044 | 1072 | resp.Result.Code = ERROR_GETUSEREXTFAILED |
| 1045 | 1073 | break |
| 1046 | 1074 | } |
| 1047 | - TransmitUserData(ext,&resp.Result.Data.Extdata) | |
| 1075 | + TransmitUserData(ext, &resp.Result.Data.Extdata) | |
| 1048 | 1076 | //resp.Result.Data.Extdata = *ext |
| 1049 | 1077 | |
| 1050 | 1078 | //需要处理登录数据 |
| 1051 | 1079 | HandleLoginTime(ext) |
| 1052 | 1080 | |
| 1053 | - m_userInfo.Set(uint32(ext.Userid),ext) | |
| 1081 | + m_userInfo.Set(uint32(ext.Userid), ext) | |
| 1054 | 1082 | SaveUserExt(ext) |
| 1055 | 1083 | } |
| 1056 | 1084 | |
| 1057 | - | |
| 1058 | - | |
| 1059 | - | |
| 1060 | 1085 | resp.Result.Code = ERROR_OK |
| 1061 | 1086 | break |
| 1062 | 1087 | } |
| ... | ... | @@ -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 | 1098 | for { |
| 1074 | 1099 | //首先判断是否存在这个游客账号 |
| 1075 | - uuid,err := GetTouristUid(req.Token) | |
| 1100 | + uuid, err := GetTouristUid(req.Token) | |
| 1076 | 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 | 1107 | if err != nil { |
| 1083 | 1108 | logger.Error("HandleTouristLogin getbasic failed=%v", err) |
| 1084 | 1109 | resp.Result.Code = ERROR_GETUSERBASICFAILED |
| ... | ... | @@ -1086,16 +1111,16 @@ func HandleTouristLogin(w http.ResponseWriter, req *UserLoginReq,resp *UserLogin |
| 1086 | 1111 | } |
| 1087 | 1112 | resp.Result.Data.Dasedata = *basic |
| 1088 | 1113 | |
| 1089 | - ext,err := GetUserExt(uuid) | |
| 1114 | + ext, err := GetUserExt(uuid) | |
| 1090 | 1115 | if err != nil { |
| 1091 | 1116 | logger.Error("HandleTouristLogin getext failed=%v", err) |
| 1092 | 1117 | resp.Result.Code = ERROR_GETUSEREXTFAILED |
| 1093 | 1118 | break |
| 1094 | 1119 | } |
| 1095 | 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 | 1124 | SaveUserExt(ext) |
| 1100 | 1125 | } |
| 1101 | 1126 | |
| ... | ... | @@ -1121,12 +1146,7 @@ func HandleUserLogin(w http.ResponseWriter, data string) { |
| 1121 | 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 | 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 | 1174 | logger.Error("HandleSaveUserData json unmarshal failed=%v", err) |
| 1155 | 1175 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1156 | 1176 | break |
| ... | ... | @@ -1171,7 +1191,7 @@ func HandleSaveUserData(w http.ResponseWriter, data string) { |
| 1171 | 1191 | uinfo.Shopnum = rdata.Shopnum |
| 1172 | 1192 | SaveUserExt(uinfo) |
| 1173 | 1193 | |
| 1174 | - basic,err := GetUserBasic(uuid) | |
| 1194 | + basic, err := GetUserBasic(uuid) | |
| 1175 | 1195 | if err != nil { |
| 1176 | 1196 | logger.Error("HandleTouristLogin getbasic failed=%v", err) |
| 1177 | 1197 | resp.Result.Code = ERROR_GETUSERBASICFAILED |
| ... | ... | @@ -1179,14 +1199,14 @@ func HandleSaveUserData(w http.ResponseWriter, data string) { |
| 1179 | 1199 | } |
| 1180 | 1200 | resp.Result.Data.Dasedata = *basic |
| 1181 | 1201 | |
| 1182 | - ext,err := GetUserExt(uuid) | |
| 1202 | + ext, err := GetUserExt(uuid) | |
| 1183 | 1203 | if err != nil { |
| 1184 | 1204 | logger.Error("HandleTouristLogin getext failed=%v", err) |
| 1185 | 1205 | resp.Result.Code = ERROR_GETUSEREXTFAILED |
| 1186 | 1206 | break |
| 1187 | 1207 | } |
| 1188 | 1208 | //resp.Result.Data.Extdata = *ext |
| 1189 | - TransmitUserData(ext,&resp.Result.Data.Extdata) | |
| 1209 | + TransmitUserData(ext, &resp.Result.Data.Extdata) | |
| 1190 | 1210 | |
| 1191 | 1211 | resp.Result.Code = ERROR_OK |
| 1192 | 1212 | break |
| ... | ... | @@ -1211,15 +1231,14 @@ func HandlesaveData(w http.ResponseWriter, data string) { |
| 1211 | 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 | 1236 | logger.Error("HandlesaveData GetTouristUid failed=%v", err) |
| 1217 | 1237 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1218 | 1238 | break |
| 1219 | 1239 | } |
| 1220 | 1240 | |
| 1221 | - | |
| 1222 | - err = SaveUserBaseData(uuid,rdata.Value) | |
| 1241 | + err = SaveUserBaseData(uuid, rdata.Value) | |
| 1223 | 1242 | |
| 1224 | 1243 | if err != nil { |
| 1225 | 1244 | logger.Error("HandlesaveData save failed=%v", err) |
| ... | ... | @@ -1276,18 +1295,18 @@ func HandlegetData(w http.ResponseWriter, data string) { |
| 1276 | 1295 | fmt.Fprint(w, string(respstr))*/ |
| 1277 | 1296 | } |
| 1278 | 1297 | |
| 1279 | -func GetAccessToken() string{ | |
| 1298 | +func GetAccessToken() string { | |
| 1280 | 1299 | //首先从缓存取kwiffwiffiaowosfwkfko |
| 1281 | - exist,err := redishandler.GetRedisClient().Exists(redis.MSG_CKECK_ACCESSTOKEN) | |
| 1300 | + exist, err := redishandler.GetRedisClient().Exists(redis.MSG_CKECK_ACCESSTOKEN) | |
| 1282 | 1301 | if err != nil { |
| 1283 | - logger.Error("GetAccessToken err=%v",err) | |
| 1302 | + logger.Error("GetAccessToken err=%v", err) | |
| 1284 | 1303 | return "" |
| 1285 | 1304 | } |
| 1286 | 1305 | |
| 1287 | 1306 | if exist { |
| 1288 | - key,err := redishandler.GetRedisClient().GetString(redis.MSG_CKECK_ACCESSTOKEN) | |
| 1307 | + key, err := redishandler.GetRedisClient().GetString(redis.MSG_CKECK_ACCESSTOKEN) | |
| 1289 | 1308 | if err != nil { |
| 1290 | - logger.Error("GetAccessToken err=%v",err) | |
| 1309 | + logger.Error("GetAccessToken err=%v", err) | |
| 1291 | 1310 | return "" |
| 1292 | 1311 | } |
| 1293 | 1312 | |
| ... | ... | @@ -1296,9 +1315,9 @@ func GetAccessToken() string{ |
| 1296 | 1315 | |
| 1297 | 1316 | //去微信获取 |
| 1298 | 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 | 1319 | if err != nil { |
| 1301 | - logger.Error("GetAccessToken http failed err=%v",err) | |
| 1320 | + logger.Error("GetAccessToken http failed err=%v", err) | |
| 1302 | 1321 | return "" |
| 1303 | 1322 | } |
| 1304 | 1323 | |
| ... | ... | @@ -1309,8 +1328,8 @@ func GetAccessToken() string{ |
| 1309 | 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 | 1334 | return msgresp.Access_token |
| 1316 | 1335 | } |
| ... | ... | @@ -1329,14 +1348,13 @@ func HandleTextCheck(w http.ResponseWriter, data string) { |
| 1329 | 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 | 1353 | logger.Error("HandleTextCheck GetTouristUid failed=%v", err) |
| 1335 | 1354 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1336 | 1355 | break |
| 1337 | 1356 | } |
| 1338 | 1357 | |
| 1339 | - | |
| 1340 | 1358 | //首先获取 |
| 1341 | 1359 | msgtoken := GetAccessToken() |
| 1342 | 1360 | msgurl := URL_WEIXINMSG_CHECK + "?access_token=" + msgtoken |
| ... | ... | @@ -1352,7 +1370,7 @@ func HandleTextCheck(w http.ResponseWriter, data string) { |
| 1352 | 1370 | body := bytes.NewBuffer(bys) |
| 1353 | 1371 | res, err := http.Post(msgurl, "application/json;charset=utf-8", body) |
| 1354 | 1372 | if err != nil { |
| 1355 | - logger.Error(" HandleTextCheck ERROR_HTTPPOSTFAILED err=%v", err) | |
| 1373 | + logger.Error(" HandleTextCheck ERROR_HTTPPOSTFAILED err=%v", err) | |
| 1356 | 1374 | resp.Result.Code = ERROR_HTTPPOSTFAILED |
| 1357 | 1375 | return |
| 1358 | 1376 | } |
| ... | ... | @@ -1363,8 +1381,8 @@ func HandleTextCheck(w http.ResponseWriter, data string) { |
| 1363 | 1381 | var msgresp MsgCheckResp |
| 1364 | 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 | 1386 | resp.Result.Data = msgresp.Errmsg |
| 1369 | 1387 | |
| 1370 | 1388 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -1390,14 +1408,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { |
| 1390 | 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 | 1413 | logger.Error("HandleCreateTeam GetTouristUid failed=%v", err) |
| 1396 | 1414 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1397 | 1415 | break |
| 1398 | 1416 | } |
| 1399 | 1417 | |
| 1400 | - | |
| 1401 | 1418 | //首先判断一下当前队伍名称是否已经存在 |
| 1402 | 1419 | isexist := GetUserTeamNameIsExist(rdata.Name) |
| 1403 | 1420 | if isexist { |
| ... | ... | @@ -1423,7 +1440,7 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { |
| 1423 | 1440 | |
| 1424 | 1441 | //初始化队伍数据 |
| 1425 | 1442 | var bteaminfo TeamInfo |
| 1426 | - bteaminfo.MemInfo.MemList = append(bteaminfo.MemInfo.MemList,uuid) | |
| 1443 | + bteaminfo.MemInfo.MemList = append(bteaminfo.MemInfo.MemList, uuid) | |
| 1427 | 1444 | var teaminfo CreateTeamInfo |
| 1428 | 1445 | teaminfo.Name = rdata.Name |
| 1429 | 1446 | teaminfo.Status = 0 |
| ... | ... | @@ -1439,13 +1456,13 @@ func HandleCreateTeam(w http.ResponseWriter, data string) { |
| 1439 | 1456 | resp.Result.Data.Team_data = teaminfo |
| 1440 | 1457 | bteaminfo.BaseInfo = teaminfo |
| 1441 | 1458 | //保存队伍数据 |
| 1442 | - SaveTeamInfo(teaminfo.Id,&bteaminfo) | |
| 1459 | + SaveTeamInfo(teaminfo.Id, &bteaminfo) | |
| 1443 | 1460 | |
| 1444 | 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 | 1467 | resp.Result.Code = ERROR_OK |
| 1451 | 1468 | break |
| ... | ... | @@ -1470,14 +1487,13 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { |
| 1470 | 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 | 1492 | logger.Error("HandleUpdateTeamData GetTouristUid failed=%v", err) |
| 1476 | 1493 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1477 | 1494 | break |
| 1478 | 1495 | } |
| 1479 | 1496 | |
| 1480 | - | |
| 1481 | 1497 | //首先判断一下当前队伍名称是否已经存在 |
| 1482 | 1498 | isexist := GetUserTeamNameIsExist(rdata.Name) |
| 1483 | 1499 | if isexist { |
| ... | ... | @@ -1487,14 +1503,14 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { |
| 1487 | 1503 | } |
| 1488 | 1504 | |
| 1489 | 1505 | //首先查询teamid |
| 1490 | - teamid,err := GetTeamByUuid(uuid) | |
| 1506 | + teamid, err := GetTeamByUuid(uuid) | |
| 1491 | 1507 | if err != nil { |
| 1492 | 1508 | logger.Error("HandleUpdateTeamData getteamid failed=%v", err) |
| 1493 | 1509 | resp.Result.Code = ERROR_QUERYTEAMID_FAILED |
| 1494 | 1510 | break |
| 1495 | 1511 | } |
| 1496 | 1512 | //查询队伍数据 |
| 1497 | - teaminfo,err := GetTeamInfo(teamid) | |
| 1513 | + teaminfo, err := GetTeamInfo(teamid) | |
| 1498 | 1514 | if err != nil { |
| 1499 | 1515 | logger.Error("HandleUpdateTeamData getteaminfo failed=%v", err) |
| 1500 | 1516 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1519,11 +1535,11 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { |
| 1519 | 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 | 1540 | DelUserTeamName(orinname) |
| 1525 | 1541 | //保存队伍名称 |
| 1526 | - SetUserTeamName(rdata.Name,teaminfo.BaseInfo.Id) | |
| 1542 | + SetUserTeamName(rdata.Name, teaminfo.BaseInfo.Id) | |
| 1527 | 1543 | |
| 1528 | 1544 | resp.Result.Code = ERROR_OK |
| 1529 | 1545 | break |
| ... | ... | @@ -1534,7 +1550,6 @@ func HandleUpdateTeamData(w http.ResponseWriter, data string) { |
| 1534 | 1550 | fmt.Fprint(w, string(respstr)) |
| 1535 | 1551 | } |
| 1536 | 1552 | |
| 1537 | - | |
| 1538 | 1553 | func HandleJoinTeam(w http.ResponseWriter, data string) { |
| 1539 | 1554 | SetHeader(w) |
| 1540 | 1555 | var resp JoinTeamResp |
| ... | ... | @@ -1542,22 +1557,22 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { |
| 1542 | 1557 | resp.Result.Code = ERROR_OK |
| 1543 | 1558 | var rdata JoinTeamReq |
| 1544 | 1559 | err := json.Unmarshal([]byte(data), &rdata) |
| 1545 | - for { | |
| 1546 | - if err != nil { | |
| 1560 | + for { | |
| 1561 | + if err != nil { | |
| 1547 | 1562 | logger.Error("HandleJoinTeam json unmarshal failed=%v", err) |
| 1548 | 1563 | resp.Result.Code = ERROR_JSONUNMASHFAILED |
| 1549 | 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 | 1569 | logger.Error("HandleJoinTeam GetTouristUid failed=%v", err) |
| 1555 | 1570 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1556 | 1571 | break |
| 1557 | 1572 | } |
| 1558 | 1573 | |
| 1559 | 1574 | //获取店铺数据 |
| 1560 | - tinfo,err := GetTeamInfo(rdata.Team_id) | |
| 1575 | + tinfo, err := GetTeamInfo(rdata.Team_id) | |
| 1561 | 1576 | if err != nil { |
| 1562 | 1577 | logger.Error("HandleJoinTeam GetTeamInfoFailed failed=%v", err) |
| 1563 | 1578 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1595,13 +1610,12 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { |
| 1595 | 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 | 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 | 1620 | resp.Result.Code = ERROR_OK |
| 1607 | 1621 | resp.Result.Data = "" |
| ... | ... | @@ -1613,7 +1627,6 @@ func HandleJoinTeam(w http.ResponseWriter, data string) { |
| 1613 | 1627 | fmt.Fprint(w, string(respstr)) |
| 1614 | 1628 | } |
| 1615 | 1629 | |
| 1616 | - | |
| 1617 | 1630 | func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { |
| 1618 | 1631 | SetHeader(w) |
| 1619 | 1632 | var resp JoinTeamByInviteResp |
| ... | ... | @@ -1628,29 +1641,27 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { |
| 1628 | 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 | 1646 | logger.Error("HandleJoinTeamByInvite GetTouristUid failed=%v", err) |
| 1634 | 1647 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1635 | 1648 | break |
| 1636 | 1649 | } |
| 1637 | 1650 | |
| 1638 | - | |
| 1639 | 1651 | //获取店铺数据 |
| 1640 | - teamid,err := GetTeamByUuid(rdata.Inviter_id) | |
| 1652 | + teamid, err := GetTeamByUuid(rdata.Inviter_id) | |
| 1641 | 1653 | if err != nil { |
| 1642 | 1654 | logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err) |
| 1643 | 1655 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1644 | 1656 | break |
| 1645 | 1657 | } |
| 1646 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1658 | + tinfo, err := GetTeamInfo(teamid) | |
| 1647 | 1659 | if err != nil { |
| 1648 | 1660 | logger.Error("HandleJoinTeamByInvite GetTeamInfoFailed failed=%v", err) |
| 1649 | 1661 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1650 | 1662 | break |
| 1651 | 1663 | } |
| 1652 | 1664 | |
| 1653 | - | |
| 1654 | 1665 | //判断一下是否已经在队伍中 |
| 1655 | 1666 | inteam := tinfo.IsInTeam(uuid) |
| 1656 | 1667 | |
| ... | ... | @@ -1660,14 +1671,12 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { |
| 1660 | 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 | 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 | 1681 | resp.Result.Code = ERROR_OK |
| 1673 | 1682 | resp.Result.Data = "" |
| ... | ... | @@ -1679,7 +1688,6 @@ func HandleJoinTeamByInvite(w http.ResponseWriter, data string) { |
| 1679 | 1688 | fmt.Fprint(w, string(respstr)) |
| 1680 | 1689 | } |
| 1681 | 1690 | |
| 1682 | - | |
| 1683 | 1691 | func HandleQuitTeam(w http.ResponseWriter, data string) { |
| 1684 | 1692 | SetHeader(w) |
| 1685 | 1693 | var resp QuitTeamResp |
| ... | ... | @@ -1694,20 +1702,20 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { |
| 1694 | 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 | 1707 | logger.Error("HandleQuitTeam GetTouristUid failed=%v", err) |
| 1700 | 1708 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1701 | 1709 | break |
| 1702 | 1710 | } |
| 1703 | 1711 | |
| 1704 | - teamid,err := GetTeamByUuid(uuid) | |
| 1712 | + teamid, err := GetTeamByUuid(uuid) | |
| 1705 | 1713 | if err != nil { |
| 1706 | 1714 | logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err) |
| 1707 | 1715 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1708 | 1716 | break |
| 1709 | 1717 | } |
| 1710 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1718 | + tinfo, err := GetTeamInfo(teamid) | |
| 1711 | 1719 | if err != nil { |
| 1712 | 1720 | logger.Error("HandleQuitTeam GetTeamInfoFailed failed=%v", err) |
| 1713 | 1721 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1724,24 +1732,22 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { |
| 1724 | 1732 | |
| 1725 | 1733 | if rdata.Type == 0 { |
| 1726 | 1734 | //踢人 需要判断是否是队长 |
| 1727 | - if uuid!=tinfo.BaseInfo.Captain_id { | |
| 1735 | + if uuid != tinfo.BaseInfo.Captain_id { | |
| 1728 | 1736 | logger.Error("HandleQuitTeam not caption failed=%v", err) |
| 1729 | 1737 | resp.Result.Code = ERROR_NOTCAPTION |
| 1730 | 1738 | break |
| 1731 | 1739 | } |
| 1732 | - }else { | |
| 1740 | + } else { | |
| 1733 | 1741 | //主动离开 需要扣除投资额 |
| 1734 | 1742 | //todo 扣除投资额 |
| 1735 | 1743 | } |
| 1736 | 1744 | |
| 1737 | - | |
| 1738 | 1745 | //删除成员信息 |
| 1739 | 1746 | //tinfo.MemInfo.MemList = append(tinfo.MemInfo.MemList,uuid) |
| 1740 | 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 | 1752 | resp.Result.Code = ERROR_OK |
| 1747 | 1753 | resp.Result.Data = "" |
| ... | ... | @@ -1753,7 +1759,6 @@ func HandleQuitTeam(w http.ResponseWriter, data string) { |
| 1753 | 1759 | fmt.Fprint(w, string(respstr)) |
| 1754 | 1760 | } |
| 1755 | 1761 | |
| 1756 | - | |
| 1757 | 1762 | func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { |
| 1758 | 1763 | SetHeader(w) |
| 1759 | 1764 | var resp UpdateTeamBuildResp |
| ... | ... | @@ -1768,20 +1773,20 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { |
| 1768 | 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 | 1778 | logger.Error("HandleUpdateTeamBuild GetTouristUid failed=%v", err) |
| 1774 | 1779 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1775 | 1780 | break |
| 1776 | 1781 | } |
| 1777 | 1782 | |
| 1778 | - teamid,err := GetTeamByUuid(uuid) | |
| 1783 | + teamid, err := GetTeamByUuid(uuid) | |
| 1779 | 1784 | if err != nil { |
| 1780 | 1785 | logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err) |
| 1781 | 1786 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1782 | 1787 | break |
| 1783 | 1788 | } |
| 1784 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1789 | + tinfo, err := GetTeamInfo(teamid) | |
| 1785 | 1790 | if err != nil { |
| 1786 | 1791 | logger.Error("HandleUpdateTeamBuild GetTeamInfoFailed failed=%v", err) |
| 1787 | 1792 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1796,15 +1801,14 @@ func HandleUpdateTeamBuild(w http.ResponseWriter, data string) { |
| 1796 | 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 | 1814 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -1830,20 +1834,20 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) { |
| 1830 | 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 | 1839 | logger.Error("HandleAddTeamBuff GetTouristUid failed=%v", err) |
| 1836 | 1840 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1837 | 1841 | break |
| 1838 | 1842 | } |
| 1839 | 1843 | |
| 1840 | - teamid,err := GetTeamByUuid(uuid) | |
| 1844 | + teamid, err := GetTeamByUuid(uuid) | |
| 1841 | 1845 | if err != nil { |
| 1842 | 1846 | logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err) |
| 1843 | 1847 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1844 | 1848 | break |
| 1845 | 1849 | } |
| 1846 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1850 | + tinfo, err := GetTeamInfo(teamid) | |
| 1847 | 1851 | if err != nil { |
| 1848 | 1852 | logger.Error("HandleAddTeamBuff GetTeamInfoFailed failed=%v", err) |
| 1849 | 1853 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1859,12 +1863,10 @@ func HandleAddTeamBuff(w http.ResponseWriter, data string) { |
| 1859 | 1863 | } |
| 1860 | 1864 | |
| 1861 | 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 | 1871 | resp.Result.Code = ERROR_OK |
| 1870 | 1872 | break |
| ... | ... | @@ -1889,38 +1891,37 @@ func HandleGetTeamBuff(w http.ResponseWriter, data string) { |
| 1889 | 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 | 1896 | logger.Error("HandleGetTeamBuff GetTouristUid failed=%v", err) |
| 1895 | 1897 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1896 | 1898 | break |
| 1897 | 1899 | } |
| 1898 | 1900 | |
| 1899 | - teamid,err := GetTeamByUuid(uuid) | |
| 1901 | + teamid, err := GetTeamByUuid(uuid) | |
| 1900 | 1902 | if err != nil { |
| 1901 | 1903 | logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err) |
| 1902 | 1904 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1903 | 1905 | break |
| 1904 | 1906 | } |
| 1905 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1907 | + tinfo, err := GetTeamInfo(teamid) | |
| 1906 | 1908 | if err != nil { |
| 1907 | 1909 | logger.Error("HandleGetTeamBuff GetTeamInfoFailed failed=%v", err) |
| 1908 | 1910 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1909 | 1911 | break |
| 1910 | 1912 | } |
| 1911 | 1913 | |
| 1912 | - | |
| 1913 | 1914 | //处理buff |
| 1914 | - for _,vak := range tinfo.BInfo.Buff { | |
| 1915 | + for _, vak := range tinfo.BInfo.Buff { | |
| 1915 | 1916 | var tmp AddTeamBuffSpec |
| 1916 | 1917 | tmp.Build_type = vak.Type |
| 1917 | - for _,val1 := range vak.BuffInfo { | |
| 1918 | + for _, val1 := range vak.BuffInfo { | |
| 1918 | 1919 | var tmp1 BuffTimeInfo |
| 1919 | 1920 | tmp1.Buff_begin_time = val1.BeginTime |
| 1920 | 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 | 1927 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -1946,20 +1947,20 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { |
| 1946 | 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 | 1952 | logger.Error("HandleGetTeamData GetTouristUid failed=%v", err) |
| 1952 | 1953 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 1953 | 1954 | break |
| 1954 | 1955 | } |
| 1955 | 1956 | |
| 1956 | - teamid,err := GetTeamByUuid(uuid) | |
| 1957 | + teamid, err := GetTeamByUuid(uuid) | |
| 1957 | 1958 | if err != nil { |
| 1958 | 1959 | logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err) |
| 1959 | 1960 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| 1960 | 1961 | break |
| 1961 | 1962 | } |
| 1962 | - tinfo ,err := GetTeamInfo(teamid) | |
| 1963 | + tinfo, err := GetTeamInfo(teamid) | |
| 1963 | 1964 | if err != nil { |
| 1964 | 1965 | logger.Error("HandleGetTeamData GetTeamInfoFailed failed=%v", err) |
| 1965 | 1966 | resp.Result.Code = ERROR_GETTEAMINFO_FAILED |
| ... | ... | @@ -1967,15 +1968,15 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { |
| 1967 | 1968 | } |
| 1968 | 1969 | |
| 1969 | 1970 | resp.Result.Data.Team_data = tinfo.BaseInfo |
| 1970 | - for _,val := range tinfo.MemInfo.MemList { | |
| 1971 | + for _, val := range tinfo.MemInfo.MemList { | |
| 1971 | 1972 | var tmp GetTeamDataTeamUserList |
| 1972 | 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 | 1977 | var tmp TeamDevoteInfo |
| 1977 | 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 | 1982 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -1987,7 +1988,6 @@ func HandleGetTeamData(w http.ResponseWriter, data string) { |
| 1987 | 1988 | fmt.Fprint(w, string(respstr)) |
| 1988 | 1989 | } |
| 1989 | 1990 | |
| 1990 | - | |
| 1991 | 1991 | func HandleGetDataByUserId(w http.ResponseWriter, data string) { |
| 1992 | 1992 | SetHeader(w) |
| 1993 | 1993 | var resp GetDataByUserIdResp |
| ... | ... | @@ -2002,26 +2002,26 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { |
| 2002 | 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 | 2007 | logger.Error("HandleGetDataByUserId GetTouristUid failed=%v", err) |
| 2008 | 2008 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2009 | 2009 | break |
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | - basic,err := GetUserBasic(rdata.User_id) | |
| 2012 | + basic, err := GetUserBasic(rdata.User_id) | |
| 2013 | 2013 | if err != nil { |
| 2014 | 2014 | logger.Error("HandleGetDataByUserId GetUserBasic failed=%v", err) |
| 2015 | 2015 | resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED |
| 2016 | 2016 | break |
| 2017 | 2017 | } |
| 2018 | - base,err := GetUserBaseData(rdata.User_id) | |
| 2018 | + base, err := GetUserBaseData(rdata.User_id) | |
| 2019 | 2019 | if err != nil { |
| 2020 | 2020 | logger.Error("HandleGetDataByUserId GetUserBase failed=%v", err) |
| 2021 | 2021 | resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED |
| 2022 | 2022 | break |
| 2023 | 2023 | } |
| 2024 | - ext,err := GetUserExt(rdata.User_id) | |
| 2024 | + ext, err := GetUserExt(rdata.User_id) | |
| 2025 | 2025 | if err != nil { |
| 2026 | 2026 | logger.Error("HandleGetDataByUserId GetUserExt failed=%v", err) |
| 2027 | 2027 | resp.Result.Code = ERROR_GETUSERINFOBYIDFAILED |
| ... | ... | @@ -2031,7 +2031,7 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { |
| 2031 | 2031 | resp.Result.Data.Base_data = base |
| 2032 | 2032 | resp.Result.Data.User_base_data = *basic |
| 2033 | 2033 | //resp.Result.Data.Extdata = *ext |
| 2034 | - TransmitUserData(ext,&resp.Result.Data.Extdata) | |
| 2034 | + TransmitUserData(ext, &resp.Result.Data.Extdata) | |
| 2035 | 2035 | resp.Result.Code = ERROR_OK |
| 2036 | 2036 | break |
| 2037 | 2037 | } |
| ... | ... | @@ -2041,7 +2041,6 @@ func HandleGetDataByUserId(w http.ResponseWriter, data string) { |
| 2041 | 2041 | fmt.Fprint(w, string(respstr)) |
| 2042 | 2042 | } |
| 2043 | 2043 | |
| 2044 | - | |
| 2045 | 2044 | func HandleGetTeamList(w http.ResponseWriter, data string) { |
| 2046 | 2045 | SetHeader(w) |
| 2047 | 2046 | var resp GetTeamListResp |
| ... | ... | @@ -2056,14 +2055,14 @@ func HandleGetTeamList(w http.ResponseWriter, data string) { |
| 2056 | 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 | 2060 | logger.Error("HandleGetTeamList GetTouristUid failed=%v", err) |
| 2062 | 2061 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2063 | 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 | 2066 | if err != nil { |
| 2068 | 2067 | logger.Error("HandleGetTeamList GetTeamListByCond failed=%v", err) |
| 2069 | 2068 | resp.Result.Code = ERROR_GETTEAMLISTFAILED |
| ... | ... | @@ -2071,8 +2070,8 @@ func HandleGetTeamList(w http.ResponseWriter, data string) { |
| 2071 | 2070 | } |
| 2072 | 2071 | |
| 2073 | 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 | 2077 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -2098,14 +2097,14 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { |
| 2098 | 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 | 2102 | logger.Error("HandleSearchTeam GetTouristUid failed=%v", err) |
| 2104 | 2103 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2105 | 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 | 2108 | if err != nil { |
| 2110 | 2109 | logger.Error("HandleSearchTeam GetTeamListByCond failed=%v", err) |
| 2111 | 2110 | resp.Result.Code = ERROR_GETTEAMLISTFAILED |
| ... | ... | @@ -2113,8 +2112,8 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { |
| 2113 | 2112 | } |
| 2114 | 2113 | |
| 2115 | 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 | 2119 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -2126,7 +2125,6 @@ func HandleSearchTeam(w http.ResponseWriter, data string) { |
| 2126 | 2125 | fmt.Fprint(w, string(respstr)) |
| 2127 | 2126 | } |
| 2128 | 2127 | |
| 2129 | - | |
| 2130 | 2128 | func HandleSetFriendRequest(w http.ResponseWriter, data string) { |
| 2131 | 2129 | SetHeader(w) |
| 2132 | 2130 | var resp SetFriendResp |
| ... | ... | @@ -2141,15 +2139,15 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { |
| 2141 | 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 | 2144 | logger.Error("HandleSetFriendRequest GetTouristUid failed=%v", err) |
| 2147 | 2145 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2148 | 2146 | break |
| 2149 | 2147 | } |
| 2150 | 2148 | |
| 2151 | 2149 | //先判断是否是好友关系 |
| 2152 | - list,err := GetUserFriendList(rdata.User_id) | |
| 2150 | + list, err := GetUserFriendList(rdata.User_id) | |
| 2153 | 2151 | if err != nil { |
| 2154 | 2152 | logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) |
| 2155 | 2153 | resp.Result.Code = ERROR_GETFRIENDLISTAILED |
| ... | ... | @@ -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 | 2165 | if err != nil { |
| 2168 | 2166 | logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) |
| 2169 | 2167 | resp.Result.Code = ERROR_GETFRIENDLISTAILED |
| ... | ... | @@ -2177,7 +2175,7 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { |
| 2177 | 2175 | } |
| 2178 | 2176 | |
| 2179 | 2177 | //判断申请列表是否已经有对该玩家的申请 24小时,此处需要判断24小时内的申请次数上限,需要先提出超过24小时的申请 |
| 2180 | - applylist,err := GetUserApplyList(uuid) | |
| 2178 | + applylist, err := GetUserApplyList(uuid) | |
| 2181 | 2179 | if err != nil { |
| 2182 | 2180 | logger.Error("HandleSetFriendRequest GetApplyListFailed failed=%v", err) |
| 2183 | 2181 | resp.Result.Code = ERROR_FRIENDGETAPPLISTFAILED |
| ... | ... | @@ -2190,14 +2188,14 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { |
| 2190 | 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 | 2192 | logger.Error("HandleSetFriendRequest Apply limit failed=%v", err) |
| 2195 | 2193 | resp.Result.Code = ERROR_FRIENDAPPLYLIMIT |
| 2196 | 2194 | break |
| 2197 | 2195 | } |
| 2198 | 2196 | |
| 2199 | 2197 | //加入对方列表,如果已经在对方待批准列表则返回错误 |
| 2200 | - approvelist,err := GetUserApproveList(rdata.User_id) | |
| 2198 | + approvelist, err := GetUserApproveList(rdata.User_id) | |
| 2201 | 2199 | if err != nil { |
| 2202 | 2200 | logger.Error("HandleSetFriendRequest GetApproveListFailed failed=%v", err) |
| 2203 | 2201 | resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED |
| ... | ... | @@ -2210,17 +2208,17 @@ func HandleSetFriendRequest(w http.ResponseWriter, data string) { |
| 2210 | 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 | 2212 | logger.Error("HandleSetFriendRequest Apply limit failed=%v", err) |
| 2215 | 2213 | resp.Result.Code = ERROR_FRIENDAPPROVELIMIT |
| 2216 | 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 | 2224 | DelCacheRecommandFriendList(uuid) |
| ... | ... | @@ -2248,20 +2246,20 @@ func HandleGetFriendList(w http.ResponseWriter, data string) { |
| 2248 | 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 | 2251 | logger.Error("HandleGetFriendList GetTouristUid failed=%v", err) |
| 2254 | 2252 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2255 | 2253 | break |
| 2256 | 2254 | } |
| 2257 | 2255 | |
| 2258 | - friendlist,err := GetUserFriendList(uuid) | |
| 2256 | + friendlist, err := GetUserFriendList(uuid) | |
| 2259 | 2257 | if err != nil { |
| 2260 | 2258 | logger.Error("HandleSetFriendRequest GetFriendList failed=%v", err) |
| 2261 | 2259 | resp.Result.Code = ERROR_GETFRIENDLISTAILED |
| 2262 | 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 | 2264 | resp.Result.Code = ERROR_OK |
| 2267 | 2265 | break |
| ... | ... | @@ -2272,7 +2270,6 @@ func HandleGetFriendList(w http.ResponseWriter, data string) { |
| 2272 | 2270 | fmt.Fprint(w, string(respstr)) |
| 2273 | 2271 | } |
| 2274 | 2272 | |
| 2275 | - | |
| 2276 | 2273 | func HandleGetAuditList(w http.ResponseWriter, data string) { |
| 2277 | 2274 | SetHeader(w) |
| 2278 | 2275 | var resp GetAuditListResp |
| ... | ... | @@ -2287,20 +2284,20 @@ func HandleGetAuditList(w http.ResponseWriter, data string) { |
| 2287 | 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 | 2289 | logger.Error("HandleGetAuditList GetTouristUid failed=%v", err) |
| 2293 | 2290 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2294 | 2291 | break |
| 2295 | 2292 | } |
| 2296 | 2293 | |
| 2297 | - approvelist,err := GetUserApproveList(uuid) | |
| 2294 | + approvelist, err := GetUserApproveList(uuid) | |
| 2298 | 2295 | if err != nil { |
| 2299 | 2296 | logger.Error("HandleGetAuditList Getapprovelistfailedt failed=%v", err) |
| 2300 | 2297 | resp.Result.Code = RROR_FRIENDGETAPPROVELISTFAILED |
| 2301 | 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 | 2302 | resp.Result.Code = ERROR_OK |
| 2306 | 2303 | break |
| ... | ... | @@ -2311,7 +2308,6 @@ func HandleGetAuditList(w http.ResponseWriter, data string) { |
| 2311 | 2308 | fmt.Fprint(w, string(respstr)) |
| 2312 | 2309 | } |
| 2313 | 2310 | |
| 2314 | - | |
| 2315 | 2311 | func HandleGetRecommendList(w http.ResponseWriter, data string) { |
| 2316 | 2312 | SetHeader(w) |
| 2317 | 2313 | var resp GetRecommendListResp |
| ... | ... | @@ -2326,15 +2322,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { |
| 2326 | 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 | 2327 | logger.Error("HandleGetRecommendList GetTouristUid failed=%v", err) |
| 2332 | 2328 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2333 | 2329 | break |
| 2334 | 2330 | } |
| 2335 | 2331 | |
| 2336 | 2332 | //需要判断自己的好友位置是否已满 |
| 2337 | - friendlist,err := GetUserFriendList(uuid) | |
| 2333 | + friendlist, err := GetUserFriendList(uuid) | |
| 2338 | 2334 | if err != nil { |
| 2339 | 2335 | logger.Error("HandleGetRecommendList GetFriendList failed=%v", err) |
| 2340 | 2336 | resp.Result.Code = ERROR_GETFRIENDLISTAILED |
| ... | ... | @@ -2346,15 +2342,15 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { |
| 2346 | 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 | 2346 | if err != nil { |
| 2351 | 2347 | logger.Error("HandleGetRecommendList GetRecommandFriendList failed=%v", err) |
| 2352 | 2348 | resp.Result.Code = ERROR_FRIENDGETRECOMMADNFAILED |
| 2353 | 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 | 2356 | resp.Result.Code = ERROR_OK |
| ... | ... | @@ -2366,7 +2362,6 @@ func HandleGetRecommendList(w http.ResponseWriter, data string) { |
| 2366 | 2362 | fmt.Fprint(w, string(respstr)) |
| 2367 | 2363 | } |
| 2368 | 2364 | |
| 2369 | - | |
| 2370 | 2365 | func HandleHandleFriendRequest(w http.ResponseWriter, data string) { |
| 2371 | 2366 | SetHeader(w) |
| 2372 | 2367 | var resp HandleFriendRequestResp |
| ... | ... | @@ -2381,14 +2376,14 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { |
| 2381 | 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 | 2381 | logger.Error("HandleHandleFriendRequest GetTouristUid failed=%v", err) |
| 2387 | 2382 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2388 | 2383 | break |
| 2389 | 2384 | } |
| 2390 | 2385 | |
| 2391 | - approvelist,err := GetUserApproveList(uuid) | |
| 2386 | + approvelist, err := GetUserApproveList(uuid) | |
| 2392 | 2387 | if !approvelist.InApproveList(rdata.User_id) { |
| 2393 | 2388 | logger.Error("HandleHandleFriendRequest NOTINAPPROVELIST failed=%v", err) |
| 2394 | 2389 | resp.Result.Code = ERROR_NOTINAPPROVELIST |
| ... | ... | @@ -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 | 2395 | if err != nil { |
| 2401 | 2396 | logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) |
| 2402 | 2397 | resp.Result.Code = ERROR_FRIENDAPPROVEFAILED |
| ... | ... | @@ -2405,7 +2400,7 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { |
| 2405 | 2400 | |
| 2406 | 2401 | if rdata.Type == 0 { |
| 2407 | 2402 | //如果同意将其加入好友列表 status 1表示删除 0表示未删除 |
| 2408 | - err = SaveUserFriendList(uuid,rdata.User_id,0) | |
| 2403 | + err = SaveUserFriendList(uuid, rdata.User_id, 0) | |
| 2409 | 2404 | if err != nil { |
| 2410 | 2405 | logger.Error("HandleHandleFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) |
| 2411 | 2406 | resp.Result.Code = ERROR_FRIENDAPPROVEFAILED |
| ... | ... | @@ -2413,7 +2408,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { |
| 2413 | 2408 | } |
| 2414 | 2409 | } |
| 2415 | 2410 | |
| 2416 | - | |
| 2417 | 2411 | resp.Result.Code = ERROR_OK |
| 2418 | 2412 | break |
| 2419 | 2413 | } |
| ... | ... | @@ -2423,7 +2417,6 @@ func HandleHandleFriendRequest(w http.ResponseWriter, data string) { |
| 2423 | 2417 | fmt.Fprint(w, string(respstr)) |
| 2424 | 2418 | } |
| 2425 | 2419 | |
| 2426 | - | |
| 2427 | 2420 | func HandleDelFriend(w http.ResponseWriter, data string) { |
| 2428 | 2421 | SetHeader(w) |
| 2429 | 2422 | var resp DelFriendResp |
| ... | ... | @@ -2438,14 +2431,14 @@ func HandleDelFriend(w http.ResponseWriter, data string) { |
| 2438 | 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 | 2436 | logger.Error("HandleDelFriend GetTouristUid failed=%v", err) |
| 2444 | 2437 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2445 | 2438 | break |
| 2446 | 2439 | } |
| 2447 | 2440 | |
| 2448 | - friendlist,err := GetUserFriendList(uuid) | |
| 2441 | + friendlist, err := GetUserFriendList(uuid) | |
| 2449 | 2442 | if err != nil { |
| 2450 | 2443 | logger.Error("HandleDelFriend GetFriendList failed=%v", err) |
| 2451 | 2444 | resp.Result.Code = ERROR_GETFRIENDLISTAILED |
| ... | ... | @@ -2457,14 +2450,13 @@ func HandleDelFriend(w http.ResponseWriter, data string) { |
| 2457 | 2450 | break |
| 2458 | 2451 | } |
| 2459 | 2452 | |
| 2460 | - err = SaveUserFriendList(uuid,rdata.User_id,1) | |
| 2453 | + err = SaveUserFriendList(uuid, rdata.User_id, 1) | |
| 2461 | 2454 | if err != nil { |
| 2462 | 2455 | logger.Error("HandleSetFriendRequest ERROR_FRIENDAPPROVEFAILED failed=%v", err) |
| 2463 | 2456 | resp.Result.Code = ERROR_FRIENDDELFRIENDFAILED |
| 2464 | 2457 | break |
| 2465 | 2458 | } |
| 2466 | 2459 | |
| 2467 | - | |
| 2468 | 2460 | resp.Result.Code = ERROR_OK |
| 2469 | 2461 | break |
| 2470 | 2462 | } |
| ... | ... | @@ -2488,8 +2480,8 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) { |
| 2488 | 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 | 2485 | logger.Error("HandleQueryPlayerData GetTouristUid failed=%v", err) |
| 2494 | 2486 | resp.Result.Code = ERROR_GETUSERIDFAILED |
| 2495 | 2487 | break |
| ... | ... | @@ -2511,4 +2503,4 @@ func HandleQueryPlayerData(w http.ResponseWriter, data string) { |
| 2511 | 2503 | //回包 |
| 2512 | 2504 | respstr, _ := json.Marshal(&resp) |
| 2513 | 2505 | fmt.Fprint(w, string(respstr)) |
| 2514 | -} | |
| 2515 | 2506 | \ No newline at end of file |
| 2507 | +} | ... | ... |
src/common/redis/def.go
| ... | ... | @@ -28,4 +28,5 @@ const ( |
| 28 | 28 | USER_CHAT_TEAM_INFO_KEY = "CATCAFE_USER_CHAT_TEAM_INFO_KEY" // 加teamid 存储的是队伍聊天的信息 list结构 最新的消息在最头部 |
| 29 | 29 | USER_CHAT_PRIVATE_LASTGET_KEY = "CATCAFE_USER_CHAT_PRIVATE_LASTGET_KEY" // hset key加自己的uuid field为目标的uuid value为时间戳 |
| 30 | 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 | ) | ... | ... |