|
|
@@ -2,10 +2,6 @@ |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"errors" |
|
|
|
"fmt" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -16,25 +12,3 @@ func NewEggEnergyUserActivityDb(engine *xorm.Engine) dao.EggEnergyUserActivityDa |
|
|
|
type EggEnergyUserActivityDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyUserActivityDb) UserDailyActivityAnalysisCountByUidAndTime(startDate string, endDate string, uid ...int64) (int64, error) { |
|
|
|
var m model.EggEnergyUserActivity |
|
|
|
|
|
|
|
var session *xorm.Session |
|
|
|
query1 := fmt.Sprintf("uid = ?") |
|
|
|
query2 := fmt.Sprintf("uid in ?") |
|
|
|
if len(uid) == 1 { |
|
|
|
session = e.Db.Where(query1, uid) |
|
|
|
} else if len(uid) > 1 { |
|
|
|
session = e.Db.Where(query2, uid) |
|
|
|
} |
|
|
|
if session == nil { |
|
|
|
return 0, zhios_order_relate_logx.Error(errors.New("传入参数有误")) |
|
|
|
} |
|
|
|
|
|
|
|
count, err := session.And("date > ?", startDate).And("date < ?", endDate).Count(&m) |
|
|
|
if err != nil { |
|
|
|
return 0, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return count, nil |
|
|
|
} |