|
@@ -55,47 +55,47 @@ class TSGeneratePhotoOperation: TSGenerateBaseOperation , @unchecked Sendable{
|
|
|
kPurchaseToolShared.useOnceForFree(type: .photo)
|
|
|
}
|
|
|
|
|
|
-// //模拟数据
|
|
|
-// func creatPhoto(oldModel:TSActionInfoModel? = nil,prompt:String,promptSort:String) {
|
|
|
-// if let model = oldModel {
|
|
|
-// currentActionInfoModel = model
|
|
|
-// }else {
|
|
|
-// currentActionInfoModel.id = Int.timestampInt()
|
|
|
-// currentActionInfoModel.request.prompt = prompt
|
|
|
-// currentActionInfoModel.request.promptSort = promptSort
|
|
|
-// currentActionInfoModel.actionStatus = .pending
|
|
|
-// currentActionInfoModel.status = "pending"
|
|
|
-// }
|
|
|
-//
|
|
|
-// replaceSaveInfoModel(model: currentActionInfoModel)
|
|
|
-// stateDatauPblished = (.start,currentActionInfoModel)
|
|
|
-// let time = 5.0
|
|
|
-//
|
|
|
-// for i in 0..<Int(time){
|
|
|
-// kDelayOnMainThread(Double(i)) {
|
|
|
-// let progress = Float(i)*10/100.0
|
|
|
-// self.currentActionInfoModel.percent = progress
|
|
|
-// self.currentActionInfoModel.actionStatus = .running
|
|
|
-// self.currentActionInfoModel.status = "running"
|
|
|
-// self.replaceSaveInfoModel(model: self.currentActionInfoModel)
|
|
|
-// self.stateDatauPblished = (.progressString(self.generating(progress: progress)),nil)
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// kDelayOnMainThread(time+1.0) {
|
|
|
-// if kRandomBool(), let infoModel = TSActionInfoModel(JSON: self.actionInfoDict){
|
|
|
-// infoModel.id = Int.uuid
|
|
|
-// self.replaceSaveInfoModel(model: infoModel)
|
|
|
-// self.stateDatauPblished = (.success(nil),self.currentActionInfoModel)
|
|
|
-// }else{
|
|
|
-// self.currentActionInfoModel.actionStatus = .failed
|
|
|
-// self.currentActionInfoModel.status = "failed"
|
|
|
-// self.replaceSaveInfoModel(model: self.currentActionInfoModel)
|
|
|
-// self.stateDatauPblished = (.failed("error?.localizedDescription"),nil)
|
|
|
-// }
|
|
|
-//// TSPhotoHistory.shared.dePrintAllModel()
|
|
|
-// }
|
|
|
-// }
|
|
|
+ //模拟数据
|
|
|
+ func creatPhoto(oldModel:TSActionInfoModel? = nil,prompt:String,promptSort:String) {
|
|
|
+ if let model = oldModel {
|
|
|
+ currentActionInfoModel = model
|
|
|
+ }else {
|
|
|
+ currentActionInfoModel.id = Int.timestampInt()
|
|
|
+ currentActionInfoModel.request.prompt = prompt
|
|
|
+ currentActionInfoModel.request.promptSort = promptSort
|
|
|
+ currentActionInfoModel.actionStatus = .pending
|
|
|
+ currentActionInfoModel.status = "pending"
|
|
|
+ }
|
|
|
+
|
|
|
+ replaceSaveInfoModel(model: currentActionInfoModel)
|
|
|
+ stateDatauPblished = (.start,currentActionInfoModel)
|
|
|
+ let time = 5.0
|
|
|
+
|
|
|
+ for i in 0..<Int(time){
|
|
|
+ kDelayOnMainThread(Double(i)) {
|
|
|
+ let progress = Float(i)*10/100.0
|
|
|
+ self.currentActionInfoModel.percent = progress
|
|
|
+ self.currentActionInfoModel.actionStatus = .running
|
|
|
+ self.currentActionInfoModel.status = "running"
|
|
|
+ self.replaceSaveInfoModel(model: self.currentActionInfoModel)
|
|
|
+ self.stateDatauPblished = (.progressString(self.generating(progress: progress)),nil)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ kDelayOnMainThread(time+1.0) {
|
|
|
+ if kRandomBool(), let infoModel = TSActionInfoModel(JSON: self.actionInfoDict){
|
|
|
+ infoModel.id = Int.uuid
|
|
|
+ self.replaceSaveInfoModel(model: infoModel)
|
|
|
+ self.stateDatauPblished = (.success(nil),self.currentActionInfoModel)
|
|
|
+ }else{
|
|
|
+ self.currentActionInfoModel.actionStatus = .failed
|
|
|
+ self.currentActionInfoModel.status = "failed"
|
|
|
+ self.replaceSaveInfoModel(model: self.currentActionInfoModel)
|
|
|
+ self.stateDatauPblished = (.failed("error?.localizedDescription"),nil)
|
|
|
+ }
|
|
|
+// TSPhotoHistory.shared.dePrintAllModel()
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|