Merge branch 'r/paopao-ce-plus' into r/paopao-ce-xtra

r/paopao-ce-xtra
Michael Li 2 years ago
commit 29fdc5efb8
No known key found for this signature in database

@ -388,6 +388,11 @@ func (s *commentManageSrv) ThumbsDownReply(userId int64, tweetId, commentId, rep
})
}
func (s *commentManageSrv) HighlightComment(userId, commentId int64) (int8, error) {
// TODO
return 0, cs.ErrNotImplemented
}
func newCommentService(db *sqlx.DB) core.CommentService {
return &commentSrv{
sqlxSrv: newSqlxSrv(db),

@ -18,7 +18,15 @@ type tweetMetricSrvA struct {
q *cc.TweetMetrics
}
func (s *tweetMetricSrvA) UpdateRankScore(metric *cs.TweetMetric) error {
type commentMetricSrvA struct {
*sqlxSrv
}
type userMetricSrvA struct {
*sqlxSrv
}
func (s *tweetMetricSrvA) UpdateTweetMetric(metric *cs.TweetMetric) error {
return s.db.Withx(func(tx *sqlx.Tx) error {
var motivationFactor int
tx.Stmtx(s.q.GetMotivationFactor).Get(&motivationFactor, metric.PostId)
@ -37,9 +45,51 @@ func (s *tweetMetricSrvA) DeleteTweetMetric(postId int64) error {
return err
}
func NewTweetMetricServentA(db *sqlx.DB) core.TweetMetricServantA {
func (s *commentMetricSrvA) UpdateCommentMetric(metric *cs.CommentMetric) error {
// TDOO
return cs.ErrNotImplemented
}
func (s *commentMetricSrvA) AddCommentMetric(commentId int64) (err error) {
// TDOO
return cs.ErrNotImplemented
}
func (s *commentMetricSrvA) DeleteCommentMetric(commentId int64) (err error) {
// TDOO
return cs.ErrNotImplemented
}
func (s *userMetricSrvA) UpdateUserMetric(userId int64, action uint8) error {
// TODO
return cs.ErrNotImplemented
}
func (s *userMetricSrvA) AddUserMetric(userId int64) (err error) {
// TDOO
return cs.ErrNotImplemented
}
func (s *userMetricSrvA) DeleteUserMetric(userId int64) (err error) {
// TDOO
return cs.ErrNotImplemented
}
func newTweetMetricServentA(db *sqlx.DB) core.TweetMetricServantA {
return &tweetMetricSrvA{
sqlxSrv: newSqlxSrv(db),
q: ccBuild(db, cc.BuildTweetMetrics),
}
}
func newCommentMetricServentA(db *sqlx.DB) core.CommentMetricServantA {
return &commentMetricSrvA{
sqlxSrv: newSqlxSrv(db),
}
}
func newUserMetricServentA(db *sqlx.DB) core.UserMetricServantA {
return &userMetricSrvA{
sqlxSrv: newSqlxSrv(db),
}
}

@ -8,7 +8,6 @@ import (
"sync"
"github.com/Masterminds/semver/v3"
"github.com/rocboss/paopao-ce/internal/conf"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/dao/cache"
"github.com/rocboss/paopao-ce/internal/dao/security"
@ -35,10 +34,12 @@ type dataSrv struct {
core.CommentManageService
core.UserManageService
core.ContactManageService
core.UserRelationService
core.FollowingManageService
core.SecurityService
core.AttachmentCheckService
core.TweetMetricServantA
core.CommentMetricServantA
}
type webDataSrvA struct {
@ -51,10 +52,12 @@ type webDataSrvA struct {
func NewDataService() (core.DataService, core.VersionInfo) {
lazyInitial()
pvs := security.NewPhoneVerifyService()
tms := NewTweetMetricServentA(_db)
cms := newCommentMetricServentA(_db)
tms := newTweetMetricServentA(_db)
cis := cache.NewEventCacheIndexSrv(tms)
ds := &dataSrv{
TweetMetricServantA: tms,
CommentMetricServantA: cms,
WalletService: newWalletService(_db),
MessageService: newMessageService(_db),
TopicService: newTopicService(_db),
@ -65,6 +68,7 @@ func NewDataService() (core.DataService, core.VersionInfo) {
CommentManageService: newCommentManageService(_db),
UserManageService: newUserManageService(_db),
ContactManageService: newContactManageService(_db),
UserRelationService: newUserRelationService(_db),
FollowingManageService: newFollowingManageService(_db),
SecurityService: newSecurityService(_db, pvs),
AttachmentCheckService: security.NewAttachmentCheckService(),
@ -74,16 +78,13 @@ func NewDataService() (core.DataService, core.VersionInfo) {
func NewWebDataServantA() (core.WebDataServantA, core.VersionInfo) {
lazyInitial()
tms := NewTweetMetricServentA(_db)
tms := newTweetMetricServentA(_db)
cis := cache.NewEventCacheIndexSrv(tms)
db := conf.MustSqlxDB()
ds := &webDataSrvA{
TopicServantA: newTopicServantA(db),
TweetServantA: newTweetServantA(db),
TweetManageServantA: newTweetManageServantA(db, cis),
TweetHelpServantA: newTweetHelpServantA(db),
TopicServantA: newTopicServantA(_db),
TweetServantA: newTweetServantA(_db),
TweetManageServantA: newTweetManageServantA(_db, cis),
TweetHelpServantA: newTweetHelpServantA(_db),
}
return ds, ds
}

@ -12,6 +12,7 @@ import (
"github.com/bitbus/sqlx"
"github.com/bitbus/sqlx/db"
"github.com/rocboss/paopao-ce/internal/core"
"github.com/rocboss/paopao-ce/internal/core/cs"
"github.com/rocboss/paopao-ce/internal/core/ms"
"github.com/rocboss/paopao-ce/internal/dao/sakila/auto/cc"
"github.com/rocboss/paopao-ce/internal/dao/sakila/auto/pgc"
@ -26,6 +27,10 @@ type userManageSrv struct {
q *cc.UserManage
}
type userRelationSrv struct {
*sqlxSrv
}
func (s *userManageSrv) GetUserByID(id int64) (*ms.User, error) {
return db.Get[ms.User](s.q.GetUserById, id)
}
@ -78,6 +83,26 @@ func (s *userManageSrv) GetRegisterUserCount() (res int64, err error) {
return
}
func (s *userRelationSrv) MyFriendIds(userId int64) (res []int64, err error) {
// TODO
return
}
func (s *userRelationSrv) MyFollowIds(userId int64) (res []int64, err error) {
// TODO
return
}
func (s *userRelationSrv) IsMyFriend(userId int64, friendIds ...int64) (map[int64]bool, error) {
// TODO
return nil, cs.ErrNotImplemented
}
func (s *userRelationSrv) IsMyFollow(userId int64, followIds ...int64) (map[int64]bool, error) {
// TODO
return nil, cs.ErrNotImplemented
}
func newUserManageService(db *sqlx.DB) (s core.UserManageService) {
ums := &userManageSrv{
sqlxSrv: newSqlxSrv(db),
@ -92,3 +117,9 @@ func newUserManageService(db *sqlx.DB) (s core.UserManageService) {
}
return
}
func newUserRelationService(db *sqlx.DB) core.UserRelationService {
return &userRelationSrv{
sqlxSrv: newSqlxSrv(db),
}
}

Loading…
Cancel
Save