feat: 固定创建真实采购任务 (#112)
This commit is contained in:
@@ -205,6 +205,24 @@ func ListAssignableClients(db *sql.DB, actor *model.User, threshold time.Duratio
|
||||
return ListClientViewsForUser(db, actor, "", threshold)
|
||||
}
|
||||
|
||||
// ListLivePurchaseClients 返回当前用户能分配真实采购任务的在线客户端。
|
||||
//
|
||||
// 页面过滤只用于减少误选;创建任务时仍会在事务内重新校验可见范围和 live 能力。
|
||||
func ListLivePurchaseClients(db *sql.DB, actor *model.User, threshold time.Duration) ([]ClientView, error) {
|
||||
clients, err := ListClientViewsForUser(db, actor, "", threshold)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := make([]ClientView, 0, len(clients))
|
||||
for _, client := range clients {
|
||||
if client.Status != "在线" || client.PurchaseMode != string(model.TaskExecutionLive) {
|
||||
continue
|
||||
}
|
||||
result = append(result, client)
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// ListActivePurchasers 返回管理员可选择的绑定目标。
|
||||
func ListActivePurchasers(db *sql.DB, actor *model.User) ([]model.User, error) {
|
||||
if actor == nil || !actor.IsAdmin() {
|
||||
|
||||
Reference in New Issue
Block a user