完善数据上报,每日支付任务认证

This commit is contained in:
lianghuanjie
2024-12-20 17:50:24 +08:00
parent a3c4adfa25
commit bbbc750af2
17 changed files with 505 additions and 13 deletions

View File

@@ -0,0 +1,41 @@
package model
import (
"context"
"fmt"
"github.com/zeromicro/go-zero/core/stores/sqlx"
)
var _ NhWalletModel = (*customNhWalletModel)(nil)
type (
// NhWalletModel is an interface to be customized, add more methods here,
// and implement the added methods in customNhWalletModel.
NhWalletModel interface {
nhWalletModel
withSession(session sqlx.Session) NhWalletModel
FindWalletByAddress(ctx context.Context, address ...string) (uint, error)
}
customNhWalletModel struct {
*defaultNhWalletModel
}
)
func (m *customNhWalletModel) FindWalletByAddress(ctx context.Context, address ...string) (uint, error) {
query := fmt.Sprintf("select `uid` from %s where `address` in ? limit 1", m.table)
var uid uint
err := m.conn.QueryRowCtx(ctx, &uid, query, address)
return uid, err
}
// NewNhWalletModel returns a model for the database table.
func NewNhWalletModel(conn sqlx.SqlConn) NhWalletModel {
return &customNhWalletModel{
defaultNhWalletModel: newNhWalletModel(conn),
}
}
func (m *customNhWalletModel) withSession(session sqlx.Session) NhWalletModel {
return NewNhWalletModel(sqlx.NewSqlConnFromSession(session))
}