feat: 固定创建真实采购任务 (#112)
This commit is contained in:
@@ -170,6 +170,7 @@ type PurchaseTaskOptions struct {
|
||||
ExecutionMode model.TaskExecutionMode
|
||||
LiveAcknowledged bool
|
||||
LiveConfirmation string
|
||||
ClientSeenAfter string
|
||||
}
|
||||
|
||||
// PurchaseTaskResult 同时返回已创建数量和每条无法创建的原因。
|
||||
@@ -212,6 +213,15 @@ func CreatePurchaseTasksWithOptions(db *sql.DB, actor *model.User, requests []Pu
|
||||
if !visible {
|
||||
return result, fmt.Errorf("所选客户端不存在或不在当前账号可见范围")
|
||||
}
|
||||
if options.ClientSeenAfter != "" {
|
||||
online, err := repository.ClientSeenAfter(tx, clientID, options.ClientSeenAfter)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
if !online {
|
||||
return result, fmt.Errorf("所选客户端已离线,请刷新页面后选择在线客户端")
|
||||
}
|
||||
}
|
||||
executionMode := options.ExecutionMode
|
||||
if executionMode == "" {
|
||||
executionMode = model.TaskExecutionDryRun
|
||||
|
||||
Reference in New Issue
Block a user