Преглед изворни кода

Merge remote-tracking branch 'origin/master'

wangbin пре 3 година
родитељ
комит
001e447552
2 измењених фајлова са 2 додато и 1 уклоњено
  1. 1 0
      model/log/log_ip.go
  2. 1 1
      service/log/log_ip.go

+ 1 - 0
model/log/log_ip.go

@@ -34,6 +34,7 @@ type IpLogResponse struct {
 
 type QueryIpList struct {
 	Ip     		string  `json:"ip"`	//模拟器ip
+	Count		int 	`json:"count"`
 }
 
 

+ 1 - 1
service/log/log_ip.go

@@ -77,7 +77,7 @@ func (s *ServiceIpLog) GetIpLogList(api log.IpLogRequest, info request.PageInfo,
 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 := global.GVA_DB.Model(&log.IpLog{}).Select("ip, COUNT(1) as count").Where("game_id = ? and pc_code = ? and create_date = ?", iplog.GameId, iplog.PcCode, iplog.CreateDate).Group("ip")
 	//db.Group("ip").Count(&total)
 	err = db.Find(&ipList).Count(&total).Error
 	return ipList, total, err