软质押任务修改
This commit is contained in:
@@ -37,12 +37,15 @@ type (
|
||||
}
|
||||
|
||||
NhPromoteBind struct {
|
||||
Id uint `db:"id"`
|
||||
ShareUid uint `db:"share_uid"` // 分享者uid
|
||||
InvitedUid uint `db:"invited_uid"` // 受邀者uid
|
||||
CreateTime uint `db:"create_time"` // 创建时间
|
||||
IsPushUser int8 `db:"is_push_user"` // 是否已推送用户信息
|
||||
IsPushRole int8 `db:"is_push_role"` // 是否已推送绑定游戏账号
|
||||
Id uint `db:"id"`
|
||||
ShareUid uint `db:"share_uid"` // 分享者uid
|
||||
InvitedUid uint `db:"invited_uid"` // 受邀者uid
|
||||
CreateTime uint `db:"create_time"` // 创建时间
|
||||
IsPushUser int8 `db:"is_push_user"` // 是否已推送用户信息
|
||||
IsPushRole int8 `db:"is_push_role"` // 是否已推送绑定游戏账号
|
||||
IsCreateRole int8 `db:"is_create_role"` // 是否已创建角色,0=否,1=已创建
|
||||
IsBindWallet int8 `db:"is_bind_wallet"` // 是否已绑定钱包,0=否,1=已绑定
|
||||
IsOpenSeason int8 `db:"is_open_season"` // 是否已开启赛季,0=否,1=已开启
|
||||
}
|
||||
)
|
||||
|
||||
@@ -88,14 +91,14 @@ func (m *defaultNhPromoteBindModel) FindOneByInvitedUid(ctx context.Context, inv
|
||||
}
|
||||
|
||||
func (m *defaultNhPromoteBindModel) Insert(ctx context.Context, data *NhPromoteBind) (sql.Result, error) {
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?)", m.table, nhPromoteBindRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.ShareUid, data.InvitedUid, data.IsPushUser, data.IsPushRole)
|
||||
query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?)", m.table, nhPromoteBindRowsExpectAutoSet)
|
||||
ret, err := m.conn.ExecCtx(ctx, query, data.ShareUid, data.InvitedUid, data.IsPushUser, data.IsPushRole, data.IsCreateRole, data.IsBindWallet, data.IsOpenSeason)
|
||||
return ret, err
|
||||
}
|
||||
|
||||
func (m *defaultNhPromoteBindModel) Update(ctx context.Context, newData *NhPromoteBind) error {
|
||||
query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, nhPromoteBindRowsWithPlaceHolder)
|
||||
_, err := m.conn.ExecCtx(ctx, query, newData.ShareUid, newData.InvitedUid, newData.IsPushUser, newData.IsPushRole, newData.Id)
|
||||
_, err := m.conn.ExecCtx(ctx, query, newData.ShareUid, newData.InvitedUid, newData.IsPushUser, newData.IsPushRole, newData.IsCreateRole, newData.IsBindWallet, newData.IsOpenSeason, newData.Id)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ type (
|
||||
nhTaskModel
|
||||
withSession(session sqlx.Session) NhTaskModel
|
||||
FindTasksByCommunity(ctx context.Context, communityId uint) ([]*NhTask, error)
|
||||
FindDailyPayTask(ctx context.Context) (*NhTask, error)
|
||||
}
|
||||
|
||||
customNhTaskModel struct {
|
||||
@@ -38,6 +39,20 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
func (m *customNhTaskModel) FindDailyPayTask(ctx context.Context) (*NhTask, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = 1 and `type` = ? limit 1", nhTaskRows, m.table)
|
||||
var resp NhTask
|
||||
err := m.conn.QueryRowCtx(ctx, &resp, query, TASKTYPE_DAILY_PAY)
|
||||
switch {
|
||||
case err == nil:
|
||||
return &resp, nil
|
||||
case errors.Is(err, sqlx.ErrNotFound):
|
||||
return nil, ErrNotFound
|
||||
default:
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
func (m *customNhTaskModel) FindTasksByCommunity(ctx context.Context, communityId uint) ([]*NhTask, error) {
|
||||
query := fmt.Sprintf("select %s from %s where `status` = 1 and community_id = ? order by `sort`", nhTaskRows, m.table)
|
||||
var tasks []*NhTask
|
||||
|
||||
@@ -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