mirror of https://github.com/rocboss/paopao-ce
parent
6e6ab81c1c
commit
e25faa8a3c
@ -1,59 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(db),
|
||||
stmtIdx: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtUpdateFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -1,110 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
stmtGetComments *sqlx.Stmt
|
||||
stmtGetReply *sqlx.Stmt
|
||||
}
|
||||
|
||||
type commentManageServant struct {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(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{
|
||||
sqlxServant: newSqlxServant(db),
|
||||
stmtAddComents: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelComments: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(db),
|
||||
stmtAddFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtDelFriend: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(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,114 +1,23 @@
|
||||
// Copyright 2023 ROC. All rights reserved.
|
||||
// Copyright 2022 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 (
|
||||
"sync"
|
||||
|
||||
"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)
|
||||
|
||||
_onceInitial sync.Once
|
||||
)
|
||||
|
||||
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) {
|
||||
lazyInitial()
|
||||
|
||||
var (
|
||||
v core.VersionInfo
|
||||
cis core.CacheIndexService
|
||||
ips core.IndexPostsService
|
||||
)
|
||||
pvs := security.NewPhoneVerifyService()
|
||||
ams := NewAuthorizationManageService()
|
||||
ths := newTweetHelpService(_db)
|
||||
|
||||
// initialize core.IndexPostsService
|
||||
if cfg.If("Friendship") {
|
||||
ips = newFriendIndexService(_db, ams, ths)
|
||||
} else if cfg.If("Followship") {
|
||||
ips = newFollowIndexService(_db, ths)
|
||||
} else if cfg.If("Lightship") {
|
||||
ips = newLightIndexService(_db, ths)
|
||||
} else {
|
||||
// default use lightship post index service
|
||||
ips = newLightIndexService(_db, ths)
|
||||
}
|
||||
|
||||
// initialize core.CacheIndexService
|
||||
if cfg.If("SimpleCacheIndex") {
|
||||
// simpleCache use special post index service
|
||||
ips = newSimpleIndexPostsService(_db, ths)
|
||||
cis, v = cache.NewSimpleCacheIndexService(ips)
|
||||
} else if cfg.If("BigCacheIndex") {
|
||||
// TODO: make cache index post in different scence like friendship/followship/lightship
|
||||
cis, v = cache.NewBigCacheIndexService(ips, ams)
|
||||
} else {
|
||||
cis, v = cache.NewNoneCacheIndexService(ips)
|
||||
}
|
||||
logrus.Infof("use %s as cache index service by version: %s", v.Name(), v.Version())
|
||||
|
||||
ds := &dataServant{
|
||||
IndexPostsService: cis,
|
||||
WalletService: newWalletService(_db),
|
||||
MessageService: newMessageService(_db),
|
||||
TopicService: newTopicService(_db),
|
||||
TweetService: newTweetService(_db),
|
||||
TweetManageService: newTweetManageService(_db, cis),
|
||||
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
|
||||
logrus.Fatal("not support now")
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func NewAuthorizationManageService() core.AuthorizationManageService {
|
||||
lazyInitial()
|
||||
return newAuthorizationManageService(_db)
|
||||
}
|
||||
|
||||
func (s *dataServant) Name() string {
|
||||
return "Sqlx"
|
||||
}
|
||||
|
||||
func (s *dataServant) Version() *semver.Version {
|
||||
return semver.MustParse("v0.1.0")
|
||||
}
|
||||
|
||||
// lazyInitial do some package lazy initialize for performance
|
||||
func lazyInitial() {
|
||||
_onceInitial.Do(func() {
|
||||
initSqlxDB()
|
||||
})
|
||||
logrus.Fatal("not support now")
|
||||
return nil
|
||||
}
|
||||
|
@ -1,52 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(db),
|
||||
phoneVerify: phoneVerify,
|
||||
stmtAddCaptcha: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
stmtGetCaptcha: c(`SELECT * FROM @person WHERE first_name=?`),
|
||||
}
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
// 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 (
|
||||
"context"
|
||||
"database/sql"
|
||||
"strings"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/conf"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var (
|
||||
_db *sqlx.DB
|
||||
)
|
||||
|
||||
type sqlxServant struct {
|
||||
db *sqlx.DB
|
||||
}
|
||||
|
||||
func (s *sqlxServant) with(handle func(tx *sqlx.Tx) error) error {
|
||||
tx, err := s.db.Beginx()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
if err = handle(tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
func (s *sqlxServant) withTx(ctx context.Context, opts *sql.TxOptions, handle func(*sqlx.Tx) error) error {
|
||||
tx, err := s.db.BeginTxx(ctx, opts)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
if err = handle(tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return tx.Commit()
|
||||
}
|
||||
|
||||
func (s *sqlxServant) in(query string, args ...any) (string, []any, error) {
|
||||
q, params, err := sqlx.In(query, args...)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return s.db.Rebind(q), params, nil
|
||||
}
|
||||
|
||||
func (s *sqlxServant) inExec(execer sqlx.Execer, query string, args ...any) (sql.Result, error) {
|
||||
q, params, err := sqlx.In(query, args...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return execer.Exec(s.db.Rebind(q), params...)
|
||||
}
|
||||
|
||||
func (s *sqlxServant) inSelect(queryer sqlx.Queryer, dest any, query string, args ...any) error {
|
||||
q, params, err := sqlx.In(query, args...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sqlx.Select(queryer, dest, s.db.Rebind(q), params...)
|
||||
}
|
||||
|
||||
func (s *sqlxServant) inGet(queryer sqlx.Queryer, dest any, query string, args ...any) error {
|
||||
q, params, err := sqlx.In(query, args...)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return sqlx.Get(queryer, dest, s.db.Rebind(q), params...)
|
||||
}
|
||||
|
||||
func newSqlxServant(db *sqlx.DB) *sqlxServant {
|
||||
return &sqlxServant{
|
||||
db: db,
|
||||
}
|
||||
}
|
||||
|
||||
func r(query string) string {
|
||||
return _db.Rebind(t(query))
|
||||
}
|
||||
|
||||
func c(query string) *sqlx.Stmt {
|
||||
stmt, err := _db.Preparex(_db.Rebind(t(query)))
|
||||
if err != nil {
|
||||
logrus.Fatalf("prepare query(%s) error: %s", query, err)
|
||||
}
|
||||
return stmt
|
||||
}
|
||||
|
||||
func n(query string) *sqlx.NamedStmt {
|
||||
stmt, err := _db.PrepareNamed(t(query))
|
||||
if err != nil {
|
||||
logrus.Fatalf("prepare named query(%s) error: %s", query, err)
|
||||
}
|
||||
return stmt
|
||||
}
|
||||
|
||||
// t repace table prefix for query
|
||||
func t(query string) string {
|
||||
return strings.Replace(query, "@", conf.DatabaseSetting.TablePrefix, -1)
|
||||
}
|
||||
|
||||
func initSqlxDB() {
|
||||
_db = conf.MustSqlxDB()
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
// 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 (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jmoiron/sqlx"
|
||||
"github.com/rocboss/paopao-ce/internal/core"
|
||||
"github.com/rocboss/paopao-ce/internal/core/cs"
|
||||
)
|
||||
|
||||
var (
|
||||
_ core.TopicService = (*topicServant)(nil)
|
||||
)
|
||||
|
||||
type topicServant struct {
|
||||
*sqlxServant
|
||||
stmtNewestTags *sqlx.Stmt
|
||||
stmtHotTags *sqlx.Stmt
|
||||
stmtTagsByKeywordA *sqlx.Stmt
|
||||
stmtTagsByKeywordB *sqlx.Stmt
|
||||
stmtInsertTag *sqlx.Stmt
|
||||
sqlTagsByIdA string
|
||||
sqlTagsByIdB string
|
||||
sqlDecrTagsById string
|
||||
sqlTagsForIncr string
|
||||
sqlIncrTagsById string
|
||||
}
|
||||
|
||||
func (s *topicServant) UpsertTags(userId int64, tags []string) (res cs.TagInfoList, xerr error) {
|
||||
if len(tags) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
xerr = s.with(func(tx *sqlx.Tx) error {
|
||||
var upTags cs.TagInfoList
|
||||
if err := s.inSelect(tx, &upTags, s.sqlTagsForIncr, tags); err != nil {
|
||||
return err
|
||||
}
|
||||
now := time.Now().Unix()
|
||||
if len(upTags) > 0 {
|
||||
var ids []int64
|
||||
for _, t := range upTags {
|
||||
ids = append(ids, t.ID)
|
||||
t.QuoteNum++
|
||||
// prepare remain tags just delete updated tag
|
||||
// notice ensure tags slice is distinct elements
|
||||
for i, name := range tags {
|
||||
if name == t.Tag {
|
||||
lastIdx := len(tags) - 1
|
||||
tags[i] = tags[lastIdx]
|
||||
tags = tags[:lastIdx]
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, err := s.inExec(tx, s.sqlIncrTagsById, now, ids); err != nil {
|
||||
return err
|
||||
}
|
||||
res = append(res, upTags...)
|
||||
}
|
||||
// process remain tags if tags is not empty
|
||||
if len(tags) == 0 {
|
||||
return nil
|
||||
}
|
||||
var ids []int64
|
||||
for _, tag := range tags {
|
||||
res, err := s.stmtInsertTag.Exec(userId, tag, now, now)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
id, err := res.LastInsertId()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ids = append(ids, id)
|
||||
}
|
||||
var newTags cs.TagInfoList
|
||||
if err := s.inSelect(tx, &newTags, s.sqlTagsByIdB, ids); err != nil {
|
||||
return err
|
||||
}
|
||||
res = append(res, newTags...)
|
||||
return nil
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (s *topicServant) DecrTagsById(ids []int64) error {
|
||||
return s.with(func(tx *sqlx.Tx) error {
|
||||
var ids []int64
|
||||
err := s.inSelect(tx, &ids, s.sqlTagsByIdA, ids)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = s.inExec(tx, s.sqlDecrTagsById, time.Now().Unix(), ids)
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
||||
func (s *topicServant) ListTags(typ cs.TagType, limit int, offset int) (res cs.TagList, err error) {
|
||||
switch typ {
|
||||
case cs.TagTypeHot:
|
||||
err = s.stmtHotTags.Select(&res, limit, offset)
|
||||
case cs.TagTypeNew:
|
||||
err = s.stmtNewestTags.Select(&res, limit, offset)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (s *topicServant) TagsByKeyword(keyword string) (res cs.TagInfoList, err error) {
|
||||
keyword = "%" + strings.Trim(keyword, " ") + "%"
|
||||
if keyword == "%%" {
|
||||
err = s.stmtTagsByKeywordA.Select(&res)
|
||||
} else {
|
||||
err = s.stmtTagsByKeywordB.Select(&res)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func newTopicService(db *sqlx.DB) core.TopicService {
|
||||
return &topicServant{
|
||||
sqlxServant: newSqlxServant(db),
|
||||
stmtNewestTags: c(`SELECT t.id id, t.user_id user_id, t.tag tag, t.quote_num quote_num, u.id, u.nickname, u.username, u.status, u.avatar, u.is_admin FROM @tag t JOIN @user u ON t.user_id = u.id WHERE t.is_del = 0 AND t.quote_num > 0 ORDER BY t.id DESC LIMIT ? OFFSET ?`),
|
||||
stmtHotTags: c(`SELECT t.id id, t.user_id user_id, t.tag tag, t.quote_num quote_num, u.id, u.nickname, u.username, u.status, u.avatar, u.is_admin FROM @tag t JOIN @user u ON t.user_id = u.id WHERE t.is_del = 0 AND t.quote_num > 0 ORDER BY t.quote_num DESC LIMIT ? OFFSET ?`),
|
||||
stmtTagsByKeywordA: c(`SELECT id, user_id, tag, quote_num FROM @tag WHERE is_del = 0 ORDER BY quote_num DESC LIMIT 6`),
|
||||
stmtTagsByKeywordB: c(`SELECT id, user_id, tag, quote_num FROM @tag WHERE is_del = 0 AND tag LIKE ? ORDER BY quote_num DESC LIMIT 6`),
|
||||
stmtInsertTag: c(`INSERT INTO @tag (user_id, tag, created_on, modified_on, quote_num) VALUES (?, ?, ?, ?, 1)`),
|
||||
sqlTagsByIdA: t(`SELECT id FROM @tag WHERE id IN (?) AND is_del = 0 AND quote_num > 0`),
|
||||
sqlTagsByIdB: t(`SELECT id, user_id, tag, quote_num FROM @tag WHERE id IN (?)`),
|
||||
sqlDecrTagsById: t(`UPDATE @tag SET quote_num=quote_num-1, modified_on=? WHERE id IN (?)`),
|
||||
sqlTagsForIncr: t(`SELECT id, user_id, tag, quote_num FROM @tag WHERE tag IN (?)`),
|
||||
sqlIncrTagsById: t(`UPDATE @tag SET quote_num=quote_num+1, is_del=0, modified_on=? WHERE id IN (?)`),
|
||||
}
|
||||
}
|
@ -1,352 +0,0 @@
|
||||
// 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/core/cs"
|
||||
"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 {
|
||||
*sqlxServant
|
||||
stmtGetTweet *sqlx.Stmt
|
||||
stmtListTweet *sqlx.Stmt
|
||||
stmtListStar *sqlx.Stmt
|
||||
}
|
||||
|
||||
type tweetManageServant struct {
|
||||
*sqlxServant
|
||||
cacheIndex core.CacheIndexService
|
||||
stmtAddTweet *sqlx.Stmt
|
||||
stmtDelTweet *sqlx.Stmt
|
||||
stmtStickTweet *sqlx.Stmt
|
||||
}
|
||||
|
||||
type tweetHelpServant struct {
|
||||
*sqlxServant
|
||||
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) RevampTweets(tweets cs.TweetList) (cs.TweetList, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetHelpServant) MergeTweets(tweets cs.TweetInfo) (cs.TweetList, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
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(obj *cs.Attachment) (int64, error) {
|
||||
// TODO
|
||||
return 0, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
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 *tweetManageServant) CreateTweet(userId int64, req *cs.NewTweetReq) (*cs.TweetItem, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeleteTweet(userId int64, tweetId int64) ([]string, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) LockTweet(userId int64, tweetId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) StickTweet(userId int64, tweetId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) VisibleTweet(userId int64, visibility cs.TweetVisibleType) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreateReaction(userId int64, tweetId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeleteReaction(userId int64, reactionId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) CreateFavorite(userId int64, tweetId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetManageServant) DeleteFavorite(userId int64, favoriteId int64) error {
|
||||
// TODO
|
||||
return debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
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 (s *tweetServant) TweetInfoById(id int64) (*cs.TweetInfo, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) TweetItemById(id int64) (*cs.TweetItem, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) UserTweets(visitorId, userId int64) (cs.TweetList, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) ReactionByTweetId(userId int64, tweetId int64) (*cs.ReactionItem, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) UserReactions(userId int64, offset int, limit int) (cs.ReactionList, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) FavoriteByTweetId(userId int64, tweetId int64) (*cs.FavoriteItem, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) UserFavorites(userId int64, offset int, limit int) (cs.FavoriteList, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func (s *tweetServant) AttachmentByTweetId(userId int64, tweetId int64) (*cs.AttachmentBill, error) {
|
||||
// TODO
|
||||
return nil, debug.ErrNotImplemented
|
||||
}
|
||||
|
||||
func newTweetService(db *sqlx.DB) core.TweetService {
|
||||
return &tweetServant{
|
||||
sqlxServant: newSqlxServant(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{
|
||||
sqlxServant: newSqlxServant(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{
|
||||
sqlxServant: newSqlxServant(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=?`),
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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) 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{
|
||||
sqlxServant: newSqlxServant(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=?`),
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
// 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 {
|
||||
*sqlxServant
|
||||
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{
|
||||
sqlxServant: newSqlxServant(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=?`),
|
||||
}
|
||||
}
|
Loading…
Reference in new issue