|
|
@@ -47,8 +47,10 @@ func (s *ServiceIpLog) GetIpLogList(api log.IpLogRequest, info request.PageInfo,
|
|
|
var OrderStr string
|
|
|
// 设置有效排序key 防止sql注入
|
|
|
// 感谢 Tom4t0 提交漏洞信息
|
|
|
- orderMap := make(map[string]bool, 1)
|
|
|
+ orderMap := make(map[string]bool, 3)
|
|
|
orderMap["game_id"] = true
|
|
|
+ orderMap["count_distinct_ip"] = true
|
|
|
+ orderMap["count_total"] = true
|
|
|
if orderMap[order] {
|
|
|
if desc {
|
|
|
OrderStr = order + " desc"
|
|
|
@@ -70,4 +72,14 @@ func (s *ServiceIpLog) GetIpLogList(api log.IpLogRequest, info request.PageInfo,
|
|
|
apiList[i].CreateDate = apiList[i].CreateDate[:10]
|
|
|
}
|
|
|
return apiList, total, err
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+func (s *ServiceIpLog) GetIp(iplog log.IpLogResponse) (list interface{}, total int64, err error) {
|
|
|
+ var ipList []log.QueryIpList
|
|
|
+ iplog.CreateDate = time.Now().Format("2006-01-02")
|
|
|
+ db := global.GVA_DB.Model(&log.IpLog{}).Distinct("ip").Where("game_id = ? and pc_code = ? and create_date = ?", iplog.GameId, iplog.PcCode, iplog.CreateDate)
|
|
|
+ //db.Group("ip").Count(&total)
|
|
|
+ err = db.Find(&ipList).Count(&total).Error
|
|
|
+ return ipList, total, err
|
|
|
+}
|
|
|
+
|