| 123456789101112131415161718192021222324252627282930313233343536 |
- package dot
- import (
- "net/http"
- "strings"
- "bet24.com/log"
- dotservice "bet24.com/servers/micros/dotservice/proto"
- "github.com/gin-gonic/gin"
- )
- func AddDot(c *gin.Context) {
- var dotScope dotservice.DotScope
- if err := c.ShouldBind(&dotScope); err != nil {
- log.Error("dot.addDot get params fail %v", err)
- c.String(http.StatusOK, "dot.addDot get params fail %v", err)
- return
- }
- // !!! 必须检查是否是 登录 或者 启动场景 不应该是其它场景。否则容易 被刷其它场景
- if dotScope.Scene != dotservice.Scene_Login {
- c.String(http.StatusBadRequest, "failed!")
- return
- }
- if 1 > dotScope.Action || 2 < dotScope.Action {
- c.String(http.StatusBadRequest, "failed!")
- return
- }
- IpAddress := strings.Split(c.Request.RemoteAddr, ":")[0]
- dotScope.IpAddress = IpAddress
- log.Error("dot.addDot get params: %v", dotScope)
- go dotservice.AddDot(0, dotScope)
- c.String(http.StatusOK, "success")
- }
|