ice_reward.go
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package sdkdb
import (
"strconv"
"github.com/astaxie/beego/orm"
)
type IceReward struct {
Id string `orm:pk` //奖励id
Title string //奖励标题
Content string //奖励消息内容
TrigType int64 //触发类型 0,开启应用
ActType int64 //活动类型,0,时间段,1,永久有效
StartTime int64 //开始时间
EndTime int64 //结束时间
UserFilter string
VersionFilter int64
PlatFilter string
GTID string
TopType string
ValidTime int64
GameId string
GTName string
}
func IceRewardInit() {
// 注册模型
orm.RegisterModel(new(IceReward))
}
func IceRewardQueryIDWithRank(gtid string, gid string, toptype string) (iceRewards []IceReward, err error) {
o := orm.NewOrm()
var datalist []orm.Params
_, err = o.Raw("SELECT a.*,b.gtname as GTNAME FROM ice_reward a,ice_gametopset b where a.gtid=? and a.gameid=? and a.gtid = b.gtid and a.gameid = b.gid and a.ISDEL=0 and b.isdel='0'", gtid, gid).Values(&datalist)
/*if datalist != nil {
iceReward = new(IceReward)
iceReward.Id = datalist[0]["ID"].(string)
iceReward.Title = datalist[0]["TITLE"].(string)
iceReward.Content = datalist[0]["CONTENT"].(string)
trigType, _ := strconv.Atoi(datalist[0]["TRIGTYPE"].(string))
iceReward.TrigType = int64(trigType)
actType, _ := strconv.Atoi(datalist[0]["ACTTYPE"].(string))
iceReward.ActType = int64(actType)
startTime, _ := strconv.Atoi(datalist[0]["STARTTIME"].(string))
iceReward.StartTime = int64(startTime)
endTime, _ := strconv.Atoi(datalist[0]["ENDTIME"].(string))
iceReward.EndTime = int64(endTime)
iceReward.UserFilter = datalist[0]["USERFILTER"].(string)
versionFilter, _ := strconv.Atoi(datalist[0]["VERSIONFILTER"].(string))
iceReward.VersionFilter = int64(versionFilter)
iceReward.PlatFilter = datalist[0]["PLATFILTER"].(string)
iceReward.GTID = datalist[0]["GTID"].(string)
iceReward.TopType = datalist[0]["TOPTYPE"].(string)
validTime, _ := strconv.Atoi(datalist[0]["VALIDTIME"].(string))
iceReward.ValidTime = int64(validTime)
iceReward.GameId = datalist[0]["GAMEID"].(string)
} */
// update time 2017年9月4日12:30:32 update by 徐振浩
//update start
//获取奖励具体内容
iceReward := make([]IceReward, len(datalist))
if datalist != nil {
for k, v := range datalist {
iceReward[k].Id = v["ID"].(string)
iceReward[k].Title = v["TITLE"].(string)
iceReward[k].Content = v["CONTENT"].(string)
iceReward[k].GTName = v["GTNAME"].(string)
trigType, _ := strconv.Atoi(v["TRIGTYPE"].(string))
iceReward[k].TrigType = int64(trigType)
actType, _ := strconv.Atoi(v["ACTTYPE"].(string))
iceReward[k].ActType = int64(actType)
startTime, _ := strconv.Atoi(v["STARTTIME"].(string))
iceReward[k].StartTime = int64(startTime)
endTime, _ := strconv.Atoi(v["ENDTIME"].(string))
iceReward[k].EndTime = int64(endTime)
iceReward[k].UserFilter = v["USERFILTER"].(string)
versionFilter, _ := strconv.Atoi(v["VERSIONFILTER"].(string))
iceReward[k].VersionFilter = int64(versionFilter)
iceReward[k].PlatFilter = v["PLATFILTER"].(string)
iceReward[k].GTID = v["GTID"].(string)
iceReward[k].TopType = v["TOPTYPE"].(string)
validTime, _ := strconv.Atoi(v["VALIDTIME"].(string))
iceReward[k].ValidTime = int64(validTime)
iceReward[k].GameId = v["GAMEID"].(string)
}
}
//update end
return iceReward, err
}