You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
728 B
28 lines
728 B
package service |
|
|
|
import ( |
|
"context" |
|
"time" |
|
|
|
"go-common/app/interface/main/growup/model" |
|
"go-common/library/ecode" |
|
"go-common/library/log" |
|
) |
|
|
|
// avStat get stat from hbase. |
|
func (s *Service) avStat(c context.Context, mid int64, ip string) (up *model.UpBaseStat, err error) { |
|
hbaseDate := time.Now().AddDate(0, 0, -1).Add(-12 * time.Hour).Format("20060102") |
|
up, err = s.dao.UpStat(c, mid, hbaseDate) |
|
if err != nil || up == nil { |
|
log.Error("s.data.UpStat error(%v) mid(%d) up(%v) ip(%s)", err, mid, up, ip) |
|
err = ecode.CreativeDataErr |
|
return |
|
} |
|
pfl, err := s.dao.ProfileWithStat(c, mid) |
|
if err != nil { |
|
return |
|
} |
|
up.Fans = int64(pfl.Follower) |
|
log.Info("s.data.UpStat hbaseDate(%+v) mid(%d)", up, mid) |
|
return |
|
}
|
|
|