软质押任务修改
This commit is contained in:
@@ -16,6 +16,7 @@ type (
|
||||
nhTouristBindModel
|
||||
withSession(session sqlx.Session) NhTouristBindModel
|
||||
FindRequirePushUser(ctx context.Context, shareUid uint) ([]NhTouristBindUser, error)
|
||||
FindOneByEmail(ctx context.Context, email string) (*NhTouristBind, error)
|
||||
}
|
||||
|
||||
customNhTouristBindModel struct {
|
||||
@@ -28,6 +29,20 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (m *customNhTouristBindModel) FindOneByEmail(ctx context.Context, email string) (*NhTouristBind, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `email` = ? limit 1", nhTouristBindRows, m.table)
|
||||
var resp NhTouristBind
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, email)
|
||||
switch {
|
||||
case err == nil:
|
||||
return &resp, nil
|
||||
case errors.Is(err, sqlx.ErrNotFound):
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user