fix
This commit is contained in:
parent
dd6ac9c8bb
commit
f03228764d
@ -146,13 +146,14 @@ func (this *GiftCodeApi) List(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (this *GiftCodeApi) DownloadFile(c *gin.Context) {
|
||||
gameid := q5.SafeToInt32(c.DefaultQuery("gameid", ""))
|
||||
batchid := q5.SafeToInt32(c.DefaultQuery("batchid", ""))
|
||||
if batchid < 1 {
|
||||
f5.RspErr2(c, 1, "batchid error")
|
||||
if gameid < 1 || batchid < 1 {
|
||||
f5.RspErr2(c, 1, "gameid or batchid error")
|
||||
return
|
||||
}
|
||||
|
||||
sql := fmt.Sprintf("SELECT * FROM t_activation_code WHERE 1=1 AND batch_id = %d", batchid)
|
||||
sql := fmt.Sprintf("SELECT * FROM t_gift_code WHERE 1=1 AND gameid = %d AND batch_id = %d", gameid, batchid)
|
||||
f5.GetGoStyleDb().RawQuery(
|
||||
constant.ACCOUNT_DB,
|
||||
sql,
|
||||
@ -163,15 +164,8 @@ func (this *GiftCodeApi) DownloadFile(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
data := []struct {
|
||||
BatchId int32 `json:"batch_id"`
|
||||
Code string `json:"activation_code"`
|
||||
}{}
|
||||
for ds.Next() {
|
||||
p := q5.NewSliceElement(&data)
|
||||
p.BatchId = q5.SafeToInt32(ds.GetByName("batch_id"))
|
||||
p.Code = ds.GetByName("activation_code")
|
||||
}
|
||||
data := []*system.GiftCode{}
|
||||
f5.UnmarshalModelList(ds, &data)
|
||||
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"code": 0,
|
||||
|
Loading…
x
Reference in New Issue
Block a user