增加提取castile到游戏的逻辑。
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package model
|
||||
|
||||
import "github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var _ NhCastileTokenModel = (*customNhCastileTokenModel)(nil)
|
||||
|
||||
@@ -9,7 +13,8 @@ type (
|
||||
// and implement the added methods in customNhCastileTokenModel.
|
||||
NhCastileTokenModel interface {
|
||||
nhCastileTokenModel
|
||||
withSession(session sqlx.Session) NhCastileTokenModel
|
||||
WithSession(session sqlx.Session) NhCastileTokenModel
|
||||
UpdateTransferIncrease(ctx context.Context, reduce uint, id uint) error
|
||||
}
|
||||
|
||||
customNhCastileTokenModel struct {
|
||||
@@ -24,6 +29,12 @@ func NewNhCastileTokenModel(conn sqlx.SqlConn) NhCastileTokenModel {
|
||||
}
|
||||
}
|
||||
|
||||
func (m *customNhCastileTokenModel) withSession(session sqlx.Session) NhCastileTokenModel {
|
||||
func (m *customNhCastileTokenModel) WithSession(session sqlx.Session) NhCastileTokenModel {
|
||||
return NewNhCastileTokenModel(sqlx.NewSqlConnFromSession(session))
|
||||
}
|
||||
|
||||
func (m *customNhCastileTokenModel) UpdateTransferIncrease(ctx context.Context, num uint, id uint) error {
|
||||
query := fmt.Sprintf("update %s set `transfer` = `transfer` + ? where `id` = ?", m.table)
|
||||
_, err := m.conn.ExecCtx(ctx, query, num, id)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user