软质押任务修改
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user