mirror of https://github.com/rocboss/paopao-ce
parent
1ce877fb59
commit
060840030e
@ -0,0 +1,59 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.AuthorizationManageService = (*authorizationManageServant)(nil)
|
||||
)
|
||||
|
||||
type authorizationManageServant struct {
|
||||
db *sqlx.DB
|
||||
stmtIdx *sqlx.Stmt
|
||||
stmtUpdateFriend *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *authorizationManageServant) IsAllow(user *core.User, action *core.Action) bool {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return false
|
||||
}
|
||||
|
||||
func (s *authorizationManageServant) MyFriendSet(userId int64) core.FriendSet {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *authorizationManageServant) BeFriendFilter(userId int64) core.FriendFilter {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *authorizationManageServant) BeFriendIds(userId int64) ([]int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *authorizationManageServant) isFriend(userId int64, friendId int64) bool {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return false
|
||||
}
|
||||
|
||||
func newAuthorizationManageService(db *sqlx.DB) core.AuthorizationManageService {
|
||||
return &authorizationManageServant{
|
||||
db: db,
|
||||
stmtIdx: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtUpdateFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.CommentService = (*commentServant)(nil)
|
||||
_ core.CommentManageService = (*commentManageServant)(nil)
|
||||
)
|
||||
|
||||
type commentServant struct {
|
||||
db *sqlx.DB
|
||||
stmtGetComments *sqlx.Stmt
|
||||
stmtGetReply *sqlx.Stmt
|
||||
}
|
||||
|
||||
type commentManageServant struct {
|
||||
db *sqlx.DB
|
||||
stmtDelComments *sqlx.Stmt
|
||||
stmtAddComents *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *commentServant) GetComments(conditions *core.ConditionsT, offset, limit int) ([]*core.Comment, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentServant) GetCommentByID(id int64) (*core.Comment, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentServant) GetCommentReplyByID(id int64) (*core.CommentReply, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentServant) GetCommentCount(conditions *core.ConditionsT) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *commentServant) GetCommentContentsByIDs(ids []int64) ([]*core.CommentContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentServant) GetCommentRepliesByID(ids []int64) ([]*core.CommentReplyFormated, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentManageServant) DeleteComment(comment *core.Comment) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *commentManageServant) CreateComment(comment *core.Comment) (*core.Comment, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentManageServant) CreateCommentReply(reply *core.CommentReply) (*core.CommentReply, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *commentManageServant) DeleteCommentReply(reply *core.CommentReply) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *commentManageServant) CreateCommentContent(content *core.CommentContent) (*core.CommentContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func newCommentService(db *sqlx.DB) core.CommentService {
|
||||
return &commentServant{
|
||||
db: db,
|
||||
stmtGetComments: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetReply: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
||||
|
||||
func newCommentManageService(db *sqlx.DB) core.CommentManageService {
|
||||
return &commentManageServant{
|
||||
db: db,
|
||||
stmtAddComents: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelComments: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.ContactManageService = (*contactManageServant)(nil)
|
||||
)
|
||||
|
||||
type contactManageServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddFriend *sqlx.Stmt
|
||||
stmtDelFriend *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *contactManageServant) RequestingFriend(userId int64, friendId int64, greetings string) (err error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *contactManageServant) AddFriend(userId int64, friendId int64) (err error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *contactManageServant) RejectFriend(userId int64, friendId int64) (err error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *contactManageServant) DeleteFriend(userId int64, friendId int64) (err error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *contactManageServant) GetContacts(userId int64, offset int, limit int) (*core.ContactList, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *contactManageServant) IsFriend(userId int64, friendId int64) bool {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return false
|
||||
}
|
||||
|
||||
func newContactManageService(db *sqlx.DB) core.ContactManageService {
|
||||
return &contactManageServant{
|
||||
db: db,
|
||||
stmtAddFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.MessageService = (*messageServant)(nil)
|
||||
)
|
||||
|
||||
type messageServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddMsg *sqlx.Stmt
|
||||
stmtGetMsg *sqlx.Stmt
|
||||
stmtReadMsg *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *messageServant) CreateMessage(msg *core.Message) (*core.Message, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *messageServant) GetUnreadCount(userID int64) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *messageServant) GetMessageByID(id int64) (*core.Message, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *messageServant) ReadMessage(message *core.Message) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *messageServant) GetMessages(conditions *core.ConditionsT, offset, limit int) ([]*core.MessageFormated, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *messageServant) GetMessageCount(conditions *core.ConditionsT) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func newMessageService(db *sqlx.DB) core.MessageService {
|
||||
return &messageServant{
|
||||
db: db,
|
||||
stmtAddMsg: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetMsg: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtReadMsg: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -1,25 +1,86 @@
|
||||
// Copyright 2022 ROC. All rights reserved.
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Core service implement base sqlx+mysql. All sub-service
|
||||
// will declare here and provide initial function.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"github.com/alimy/cfg"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/internal/dao/cache"
|
||||
"github.com/rocboss/paopao-ce/internal/dao/security"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.DataService = (*dataServant)(nil)
|
||||
_ core.VersionInfo = (*dataServant)(nil)
|
||||
)
|
||||
|
||||
type dataServant struct {
|
||||
core.IndexPostsService
|
||||
core.WalletService
|
||||
core.MessageService
|
||||
core.TopicService
|
||||
core.TweetService
|
||||
core.TweetManageService
|
||||
core.TweetHelpService
|
||||
core.CommentService
|
||||
core.CommentManageService
|
||||
core.UserManageService
|
||||
core.ContactManageService
|
||||
core.SecurityService
|
||||
core.AttachmentCheckService
|
||||
}
|
||||
|
||||
func NewDataService() (core.DataService, core.VersionInfo) {
|
||||
logrus.Fatal("not support now")
|
||||
_ = newIndexPostsService(sqlxDB())
|
||||
_ = newSimpleIndexPostsService(sqlxDB())
|
||||
return nil, nil
|
||||
// initialize CacheIndex if needed
|
||||
var (
|
||||
c core.CacheIndexService
|
||||
v core.VersionInfo
|
||||
)
|
||||
db := sqlxDB()
|
||||
pvs := security.NewPhoneVerifyService()
|
||||
|
||||
i := newIndexPostsService(db)
|
||||
if cfg.If("SimpleCacheIndex") {
|
||||
i = newSimpleIndexPostsService(db)
|
||||
c, v = cache.NewSimpleCacheIndexService(i)
|
||||
} else if cfg.If("BigCacheIndex") {
|
||||
a := newAuthorizationManageService(db)
|
||||
c, v = cache.NewBigCacheIndexService(i, a)
|
||||
} else {
|
||||
c, v = cache.NewNoneCacheIndexService(i)
|
||||
}
|
||||
logrus.Infof("use %s as cache index service by version: %s", v.Name(), v.Version())
|
||||
|
||||
ds := &dataServant{
|
||||
IndexPostsService: c,
|
||||
WalletService: newWalletService(db),
|
||||
MessageService: newMessageService(db),
|
||||
TopicService: newTopicService(db),
|
||||
TweetService: newTweetService(db),
|
||||
TweetManageService: newTweetManageService(db, c),
|
||||
TweetHelpService: newTweetHelpService(db),
|
||||
CommentService: newCommentService(db),
|
||||
CommentManageService: newCommentManageService(db),
|
||||
UserManageService: newUserManageService(db),
|
||||
ContactManageService: newContactManageService(db),
|
||||
SecurityService: newSecurityService(db, pvs),
|
||||
AttachmentCheckService: security.NewAttachmentCheckService(),
|
||||
}
|
||||
return ds, ds
|
||||
}
|
||||
|
||||
func NewAuthorizationManageService() core.AuthorizationManageService {
|
||||
logrus.Fatal("not support now")
|
||||
return nil
|
||||
return newAuthorizationManageService(sqlxDB())
|
||||
}
|
||||
|
||||
func (s *dataServant) Name() string {
|
||||
return "Sqlx"
|
||||
}
|
||||
|
||||
func (s *dataServant) Version() *semver.Version {
|
||||
return semver.MustParse("v0.1.0")
|
||||
}
|
||||
|
@ -0,0 +1,52 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.SecurityService = (*securityServant)(nil)
|
||||
)
|
||||
|
||||
type securityServant struct {
|
||||
db *sqlx.DB
|
||||
phoneVerify core.PhoneVerifyService
|
||||
stmtAddCaptcha *sqlx.Stmt
|
||||
stmtGetCaptcha *sqlx.Stmt
|
||||
}
|
||||
|
||||
// GetLatestPhoneCaptcha 获取最新短信验证码
|
||||
func (s *securityServant) GetLatestPhoneCaptcha(phone string) (*core.Captcha, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// UsePhoneCaptcha 更新短信验证码
|
||||
func (s *securityServant) UsePhoneCaptcha(captcha *core.Captcha) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
// SendPhoneCaptcha 发送短信验证码
|
||||
func (s *securityServant) SendPhoneCaptcha(phone string) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func newSecurityService(db *sqlx.DB, phoneVerify core.PhoneVerifyService) core.SecurityService {
|
||||
return &securityServant{
|
||||
db: db,
|
||||
phoneVerify: phoneVerify,
|
||||
stmtAddCaptcha: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetCaptcha: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.TopicService = (*topicServant)(nil)
|
||||
)
|
||||
|
||||
type topicServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddTag *sqlx.Stmt
|
||||
stmtDelTag *sqlx.Stmt
|
||||
stmtListTag *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *topicServant) CreateTag(tag *core.Tag) (*core.Tag, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *topicServant) DeleteTag(tag *core.Tag) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *topicServant) GetTags(conditions *core.ConditionsT, offset, limit int) ([]*core.Tag, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *topicServant) GetTagsByKeyword(keyword string) ([]*core.Tag, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func newTopicService(db *sqlx.DB) core.TopicService {
|
||||
return &topicServant{
|
||||
db: db,
|
||||
stmtAddTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtListTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/internal/dao/jinzhu/dbr"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.TweetService = (*tweetServant)(nil)
|
||||
_ core.TweetManageService = (*tweetManageServant)(nil)
|
||||
_ core.TweetHelpService = (*tweetHelpServant)(nil)
|
||||
)
|
||||
|
||||
type tweetServant struct {
|
||||
db *sqlx.DB
|
||||
stmtGetTweet *sqlx.Stmt
|
||||
stmtListTweet *sqlx.Stmt
|
||||
stmtListStar *sqlx.Stmt
|
||||
}
|
||||
|
||||
type tweetManageServant struct {
|
||||
db *sqlx.DB
|
||||
cacheIndex core.CacheIndexService
|
||||
stmtAddTweet *sqlx.Stmt
|
||||
stmtDelTweet *sqlx.Stmt
|
||||
stmtStickTweet *sqlx.Stmt
|
||||
}
|
||||
|
||||
type tweetHelpServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddTag *sqlx.Stmt
|
||||
stmtDelTag *sqlx.Stmt
|
||||
stmtListTag *sqlx.Stmt
|
||||
}
|
||||
|
||||
// MergePosts post数据整合
|
||||
func (s *tweetHelpServant) MergePosts(posts []*core.Post) ([]*core.PostFormated, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// RevampPosts post数据整形修复
|
||||
func (s *tweetHelpServant) RevampPosts(posts []*core.PostFormated) ([]*core.PostFormated, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetHelpServant) getPostContentsByIDs(ids []int64) ([]*dbr.PostContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetHelpServant) getUsersByIDs(ids []int64) ([]*dbr.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreatePostCollection(postID, userID int64) (*core.PostCollection, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeletePostCollection(p *core.PostCollection) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreatePostContent(content *core.PostContent) (*core.PostContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreateAttachment(attachment *core.Attachment) (*core.Attachment, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreatePost(post *core.Post) (*core.Post, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeletePost(post *core.Post) ([]string, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) deleteCommentByPostId(db *gorm.DB, postId int64) ([]string, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) LockPost(post *core.Post) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) StickPost(post *core.Post) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) VisiblePost(post *core.Post, visibility core.PostVisibleT) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) UpdatePost(post *core.Post) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreatePostStar(postID, userID int64) (*core.PostStar, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeletePostStar(p *core.PostStar) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPostByID(id int64) (*core.Post, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPosts(conditions *core.ConditionsT, offset, limit int) ([]*core.Post, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPostCount(conditions *core.ConditionsT) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostStar(postID, userID int64) (*core.PostStar, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostStars(userID int64, offset, limit int) ([]*core.PostStar, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostStarCount(userID int64) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostCollection(postID, userID int64) (*core.PostCollection, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostCollections(userID int64, offset, limit int) ([]*core.PostCollection, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserPostCollectionCount(userID int64) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetUserWalletBillCount(userID int64) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPostAttatchmentBill(postID, userID int64) (*core.PostAttachmentBill, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPostContentsByIDs(ids []int64) ([]*core.PostContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *tweetServant) GetPostContentByID(id int64) (*core.PostContent, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func newTweetService(db *sqlx.DB) core.TweetService {
|
||||
return &tweetServant{
|
||||
db: db,
|
||||
stmtGetTweet: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtListTweet: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtListStar: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
||||
|
||||
func newTweetManageService(db *sqlx.DB, cacheIndex core.CacheIndexService) core.TweetManageService {
|
||||
return &tweetManageServant{
|
||||
db: db,
|
||||
cacheIndex: cacheIndex,
|
||||
stmtAddTweet: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelTweet: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtStickTweet: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
||||
|
||||
func newTweetHelpService(db *sqlx.DB) core.TweetHelpService {
|
||||
return &tweetHelpServant{
|
||||
db: db,
|
||||
stmtAddTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtListTag: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.UserManageService = (*userManageServant)(nil)
|
||||
)
|
||||
|
||||
type userManageServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddUser *sqlx.Stmt
|
||||
stmtUpdateUser *sqlx.Stmt
|
||||
stmtGetUser *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetUserByID(id int64) (*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetUserByUsername(username string) (*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetUserByPhone(phone string) (*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetUsersByIDs(ids []int64) ([]*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetUsersByKeyword(keyword string) ([]*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) GetTagsByKeyword(keyword string) ([]*core.Tag, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) CreateUser(user *core.User) (*core.User, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *userManageServant) UpdateUser(user *core.User) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func newUserManageService(db *sqlx.DB) core.UserManageService {
|
||||
return &userManageServant{
|
||||
db: db,
|
||||
stmtAddUser: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtUpdateUser: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetUser: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package sakila
|
||||
|
||||
import (
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/pkg/debug"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.WalletService = (*walletServant)(nil)
|
||||
)
|
||||
|
||||
type walletServant struct {
|
||||
db *sqlx.DB
|
||||
stmtAddRecharge *sqlx.Stmt
|
||||
stmtGetRecharge *sqlx.Stmt
|
||||
stmtGetBills *sqlx.Stmt
|
||||
}
|
||||
|
||||
func (s *walletServant) GetRechargeByID(id int64) (*core.WalletRecharge, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
func (s *walletServant) CreateRecharge(userId, amount int64) (*core.WalletRecharge, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *walletServant) GetUserWalletBills(userID int64, offset, limit int) ([]*core.WalletStatement, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *walletServant) GetUserWalletBillCount(userID int64) (int64, error) {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (s *walletServant) HandleRechargeSuccess(recharge *core.WalletRecharge, tradeNo string) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *walletServant) HandlePostAttachmentBought(post *core.Post, user *core.User) error {
|
||||
// TODO
|
||||
debug.NotImplemented()
|
||||
return nil
|
||||
}
|
||||
|
||||
func newWalletService(db *sqlx.DB) core.WalletService {
|
||||
return &walletServant{
|
||||
db: db,
|
||||
stmtAddRecharge: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetRecharge: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetBills: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Use of this source code is governed by a MIT style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package debug
|
||||
|
||||
import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func TODO() {
|
||||
logrus.Fatalln("in todo progress")
|
||||
}
|
||||
|
||||
func NotImplemented() {
|
||||
logrus.Fatalln("not implemented")
|
||||
}
|
Loading…
Reference in new issue