From 84fb8e390b83dc9482524c12d7af6c93405c3fc1 Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期五, 08 十二月 2023 16:36:32 +0800
Subject: [PATCH] debug

---
 model/model.go        |   18 +++++++++++++++++-
 crontask/cron_task.go |    6 +++---
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/crontask/cron_task.go b/crontask/cron_task.go
index 0199a20..2ee7286 100644
--- a/crontask/cron_task.go
+++ b/crontask/cron_task.go
@@ -81,9 +81,9 @@
 
 	if isMaster {
 		s.Every(20).Seconds().Do(SyncProductionProgress) //鍚屾鐢熶骇鏁版嵁
-		s.Every(30).Seconds().Do(SyncTaskStatus)         //鍚屾浠诲姟鐘舵��
-		s.Every(10).Seconds().Do(CheckNsqConn)           //鏌ヨnsq杩炴帴
-		s.Every(30).Seconds().Do(ReportData)             //涓婃姤鏁版嵁
+		//s.Every(30).Seconds().Do(SyncTaskStatus)         //鍚屾浠诲姟鐘舵��
+		s.Every(10).Seconds().Do(CheckNsqConn) //鏌ヨnsq杩炴帴
+		s.Every(30).Seconds().Do(ReportData)   //涓婃姤鏁版嵁
 	}
 
 	s.Every(20).Seconds().Do(QueryClusterStatus) //鏌ヨ闆嗙兢鑺傜偣鏁伴噺
diff --git a/model/model.go b/model/model.go
index 86bf20f..920a3e6 100644
--- a/model/model.go
+++ b/model/model.go
@@ -2,12 +2,15 @@
 
 import (
 	"apsClient/pkg/snowflake"
+	"encoding/json"
 	"github.com/jinzhu/gorm"
+	"strconv"
 	"time"
 )
 
 type CommonModel struct {
-	ID        uint `gorm:"primary_key;autoIncrement:false"`
+	ID        uint   `gorm:"primary_key;autoIncrement:false" json:"-"`
+	IDStr     string `json:"ID" gorm:"-"`
 	CreatedAt time.Time
 	UpdatedAt time.Time
 	DeletedAt *time.Time `sql:"index"`
@@ -22,3 +25,16 @@
 		c.ID = uint(id)
 	}
 }
+func (c CommonModel) UnmarshalJSON(b []byte) (err error) {
+	id, err := strconv.ParseUint(c.IDStr, 10, 64)
+	if err != nil {
+		return err
+	}
+	c.ID = uint(id)
+	return
+}
+
+func (c CommonModel) MarshalJSON() ([]byte, error) {
+	c.IDStr = strconv.FormatUint(uint64(c.ID), 10)
+	return json.Marshal(c)
+}

--
Gitblit v1.8.0