ad_event_record.go
1.55 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
package apis
import (
"log"
"net/http"
. "client/icesimba.ad/models"
"github.com/gin-gonic/gin"
)
func PostAdEventApi(c *gin.Context) {
var (
code string
msg string
)
adId := c.Request.FormValue("ad_id")
gameId := c.Request.FormValue("game_id")
eventCode := c.Request.FormValue("event_code")
positionId := c.Request.FormValue("position_id")
positionVersion := c.Request.FormValue("versionCode")
iceVersion := c.Request.FormValue("iceVersion")
channel := c.Request.FormValue("channel")
platform := c.Request.FormValue("platform")
model := c.Request.FormValue("model")
deviceId := c.Request.FormValue("deviceId")
ip := c.Request.RemoteAddr
if gameId == "" || eventCode == "" {
code = "106100"
msg = "missing parameter"
} else {
if eventCode == "icead_active" {
err := PostAdEventActiveRecord(
adId,
positionId,
gameId,
positionVersion,
iceVersion,
channel,
platform,
model,
deviceId,
ip,
eventCode,
)
if err != nil {
code = "106101"
msg = "create ad event record fail"
}
log.Println(err)
} else {
err := PostAdEventRecord(
adId,
positionId,
gameId,
positionVersion,
iceVersion,
channel,
platform,
model,
deviceId,
ip,
eventCode,
)
if err != nil {
code = "106101"
msg = "create ad event record fail"
}
log.Println(err)
}
}
if code == "0" {
c.JSON(http.StatusOK, gin.H{
"code": code,
"obj": nil,
})
} else {
c.JSON(http.StatusOK, gin.H{
"code": code,
"msg": msg,
})
}
log.Println(msg)
}