Commit 6a23c091459824607a15145bbfcd3f764b270551
1 parent
58f41a86
Exists in
master
and in
4 other branches
修改提现相关的内容
Showing
3 changed files
with
55 additions
and
0 deletions
Show diff stats
src/HttpServer/logic/errordef.go
... | ... | @@ -13,4 +13,7 @@ const ( |
13 | 13 | ERROR_GETCASH_FAILED =8 //从后台提现失败了 |
14 | 14 | ERROR_GETCASH_GOLDNOTENOUGH_FAILED =9 //提现金币不足 |
15 | 15 | ERROR_ADDWITHDRAW_LISTFAILED =10 //添加提现记录失败 |
16 | + ERROR_WITHDRAWLVLIMIT =11 //提现等级不够 | |
17 | + ERROR_WITHDRAWONLYONE =12 //新人专享只能提取一次 | |
18 | + ERROR_PRENOTFINISH =13 //前置档位未提现 | |
16 | 19 | ) |
17 | 20 | \ No newline at end of file | ... | ... |
src/HttpServer/logic/function.go
... | ... | @@ -190,6 +190,16 @@ func GetWithDrawList(uuid int) (*WithDrawList,error) { |
190 | 190 | return list,nil |
191 | 191 | } |
192 | 192 | |
193 | +func (uinfo *UserData)GetWithDrawData(money float32) (int,*WithDrawDesc){ | |
194 | + //处理提现状态 | |
195 | + for k,val := range uinfo.WithDraw.Cashdata { | |
196 | + if val.Cnum == money{ | |
197 | + return k,&val | |
198 | + } | |
199 | + } | |
200 | + return -1,nil | |
201 | +} | |
202 | + | |
193 | 203 | //添加提现记录 |
194 | 204 | func AddWithDrawList(uuid int,data *WithDrawRecord) error { |
195 | 205 | exist,err := redishandler.GetRedisClient().HExists(redis.USER_WITHDRAW_RECORDLIST,strconv.Itoa(uuid)) | ... | ... |
src/HttpServer/logic/logic.go
... | ... | @@ -130,7 +130,43 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { |
130 | 130 | break |
131 | 131 | } |
132 | 132 | |
133 | + index,info := uinfo.GetWithDrawData(rdata.Money) | |
134 | + if index == -1 || info == nil { | |
135 | + logger.Error("AddWithDrawList failed err=%v", err) | |
136 | + resp.Message = "网络错误" | |
137 | + resp.Code = ERROR_SRV_ERROR | |
138 | + break | |
139 | + } | |
140 | + | |
141 | + if uinfo.Lv < info.Limitlv { | |
142 | + logger.Error("AddWithDrawList failed err=%v", err) | |
143 | + resp.Message = "提现等级不够" | |
144 | + resp.Code = ERROR_WITHDRAWLVLIMIT | |
145 | + break | |
146 | + } | |
147 | + | |
148 | + if info.Isnew == 0 { | |
149 | + logger.Error("AddWithDrawList failed err=%v", err) | |
150 | + resp.Message = "新人专享只能提取一次" | |
151 | + resp.Code = ERROR_WITHDRAWONLYONE | |
152 | + break | |
153 | + } | |
133 | 154 | |
155 | + if info.Preisfind == 0 { | |
156 | + logger.Error("AddWithDrawList failed err=%v", err) | |
157 | + resp.Message = "新人专享只能提取一次" | |
158 | + resp.Code = ERROR_PRENOTFINISH | |
159 | + break | |
160 | + } | |
161 | + | |
162 | + //判断一下前置条件的下一档 | |
163 | + if index == len(uinfo.WithDraw.Cashdata) - 1 { | |
164 | + //最后一档了不用处理 | |
165 | + }else { | |
166 | + if index < len(uinfo.WithDraw.Cashdata) - 1{ | |
167 | + uinfo.WithDraw.Cashdata[index+1].Preisfind = 1 | |
168 | + } | |
169 | + } | |
134 | 170 | |
135 | 171 | //需要保存一下提现记录 |
136 | 172 | data := new(WithDrawRecord) |
... | ... | @@ -144,6 +180,12 @@ func HandlerGetcash(w http.ResponseWriter, data string, uuid int) { |
144 | 180 | break |
145 | 181 | } |
146 | 182 | |
183 | + | |
184 | + | |
185 | + if info.Isnew == 1 { | |
186 | + uinfo.WithDraw.Cashdata[index].Isnew = 0 | |
187 | + } | |
188 | + | |
147 | 189 | uinfo.RealGold -= drawnum * 100 |
148 | 190 | |
149 | 191 | resp.Data.Walletgold = uinfo.RealGold | ... | ... |