From 4db8b372c61025a80af529a47872a6fec6daf854 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期三, 27 九月 2023 10:21:30 +0800
Subject: [PATCH] 删除获取未开始任务接口,统一用获取任务接口

---
 service/cache_store.go |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/service/cache_store.go b/service/cache_store.go
index 325db21..2f6c515 100644
--- a/service/cache_store.go
+++ b/service/cache_store.go
@@ -3,7 +3,6 @@
 import (
 	"apsClient/constvar"
 	"apsClient/model"
-	"apsClient/model/response"
 	"fmt"
 	"github.com/spf13/cast"
 	"sync"
@@ -47,8 +46,8 @@
 }
 
 const (
-	PlcCacheKey             = "plc:%v:%v" //plc:channel:key
-	CurrentTaskCacheKey     = "current_task"
+	PlcCacheKey             = "plc:%v:%v"                    //plc:channel:key
+	CurrentTaskCacheKey     = "current_task:%v"              //current_task:channel
 	CurrentProgressCacheKey = "current_progress:%v"          //current_progress:channel
 	PlcCacheKeyUpdateTime   = "finish_number_update_time:%v" //finish_number_update_time:channel
 )
@@ -79,19 +78,19 @@
 	defaultCacheStore.Add(fmt.Sprintf(PlcCacheKeyUpdateTime, channel), value)
 }
 
-func TaskCacheSet(value *response.TaskData) {
-	defaultCacheStore.Add(CurrentTaskCacheKey, value)
+func TaskFlagSet(channel int32) {
+	defaultCacheStore.Add(fmt.Sprintf(CurrentTaskCacheKey, channel), struct{}{})
 }
 
-func TaskCacheUnset() {
-	defaultCacheStore.Remove(CurrentTaskCacheKey)
+func TaskFlagUnset(channel int32) {
+	defaultCacheStore.Remove(fmt.Sprintf(CurrentTaskCacheKey, channel))
 }
 
-func TaskCacheGet() (*response.TaskData, bool) {
-	if v, ok := defaultCacheStore.Get(CurrentTaskCacheKey); ok {
-		return v.(*response.TaskData), ok
+func TaskFlagGet(channel int32) bool {
+	if _, ok := defaultCacheStore.Get(fmt.Sprintf(CurrentTaskCacheKey, channel)); ok {
+		return true
 	}
-	return nil, false
+	return false
 }
 
 func ProgressCacheGet(channel int32) (*model.ProductionProgress, bool) {

--
Gitblit v1.8.0