完善数据上报,每日支付任务认证
This commit is contained in:
@@ -1,6 +1,11 @@
|
||||
package model
|
||||
|
||||
import "github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/stores/sqlx"
|
||||
)
|
||||
|
||||
var _ NhTouristBindModel = (*customNhTouristBindModel)(nil)
|
||||
|
||||
@@ -10,13 +15,29 @@ type (
|
||||
NhTouristBindModel interface {
|
||||
nhTouristBindModel
|
||||
withSession(session sqlx.Session) NhTouristBindModel
|
||||
FindRequirePushUser(ctx context.Context, shareUid uint) ([]NhTouristBindUser, error)
|
||||
}
|
||||
|
||||
customNhTouristBindModel struct {
|
||||
*defaultNhTouristBindModel
|
||||
}
|
||||
|
||||
NhTouristBindUser struct {
|
||||
Id uint `db:"id"`
|
||||
Uid uint `db:"uid"`
|
||||
}
|
||||
)
|
||||
|
||||
func (m *customNhTouristBindModel) FindRequirePushUser(ctx context.Context, shareUid uint) ([]NhTouristBindUser, error) {
|
||||
query := fmt.Sprintf("SELECT t2.id, t1.uid FROM nh_tourist_bind t1 JOIN nh_promote_bind t2 ON t1.uid = t2.invited_uid WHERE t2.share_uid = ? AND t2.is_push_role = 0;")
|
||||
var resp []NhTouristBindUser
|
||||
err := m.conn.QueryRowsCtx(ctx, &resp, query, shareUid)
|
||||
if err != nil && !errors.Is(err, sqlx.ErrNotFound) {
|
||||
return nil, err
|
||||
}
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
// NewNhTouristBindModel returns a model for the database table.
|
||||
func NewNhTouristBindModel(conn sqlx.SqlConn) NhTouristBindModel {
|
||||
return &customNhTouristBindModel{
|
||||
|
||||
Reference in New Issue
Block a user