diff --git a/hasaki-gen-crud/template.go b/hasaki-gen-crud/template.go index cd0e4fa..4f62154 100644 --- a/hasaki-gen-crud/template.go +++ b/hasaki-gen-crud/template.go @@ -86,15 +86,15 @@ func (TempLowHead3A60 *Temp3A60) getXorm() *xorm.Engine { // 队列状态 const ( - Temp3A60QueueWait = 2 * time.Second - Temp3A60QueueStatusNone = "None" - Temp3A60QueueStatusIng = "Ing" - Temp3A60QueueStatusSuccess = "Success" - Temp3A60QueueStatusFail = "Fail" + TempLowHead3A60_AutoQueueWait = 2 * time.Second + TempLowHead3A60_AutoQueueStatusNone = "None" + TempLowHead3A60_AutoQueueStatusIng = "Ing" + TempLowHead3A60_AutoQueueStatusSuccess = "Success" + TempLowHead3A60_AutoQueueStatusFail = "Fail" ) // 不同service对应的不同队列状态 -var Temp3A60QueueStatusFieldMap = map[string]string{ +var TempLowHead3A60_AutoQueueStatusFieldMap = map[string]string{ "service": "queue_status", } @@ -280,7 +280,7 @@ func (TempLowHead3A60 *Temp3A60) Delete() (err error) { func StartQueueTaskPrefixHigHead3A60Temp3A60() { serviceName := "Prefix3A60" - f := Temp3A60QueueStatusFieldMap[serviceName] + f := TempLowHead3A60_AutoQueueStatusFieldMap[serviceName] go func() { defer func() { err := recover() @@ -294,7 +294,7 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { for { onec := &Temp3A60{} - hskdb.GetXormAuto().Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).OrderBy("rand()").Find(&onec) + hskdb.GetXormAuto().Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).OrderBy("rand()").Find(&onec) session := onec.getXorm().NewSession() defer session.Close() @@ -307,7 +307,7 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { session = session.Where(whereCond) } - i, err := session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusIng}) + i, err := session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusIng}) if err == nil && i == 1 { func() { { @@ -323,14 +323,14 @@ func StartQueueTaskPrefixHigHead3A60Temp3A60() { session = session.Where(whereCond) } if err != nil { - session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusFail}) + session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusFail}) } else { - session.Where(fmt.Sprintf("`%s`=?", f), Temp3A60QueueStatusNone).Update(map[string]interface{}{f: Temp3A60QueueStatusSuccess}) + session.Where(fmt.Sprintf("`%s`=?", f), TempLowHead3A60_AutoQueueStatusNone).Update(map[string]interface{}{f: TempLowHead3A60_AutoQueueStatusSuccess}) } } }() } - time.Sleep(Temp3A60QueueWait) + time.Sleep(TempLowHead3A60_AutoQueueWait) } }()