package NatsServer import ( "Cold_Api/controllers/lib" "fmt" "github.com/beego/beego/v2/core/logs" "github.com/vmihailenco/msgpack/v5" "time" ) func Read_WorkOrderT_State_Count(T_pids string) (int64, int64) { msg, err := lib.Nats.Request("Cold_WorkOrder_Read_WorkOrderT_State_Count", []byte(T_pids), 3*time.Second) if err != nil { return 0, 0 } logs.Debug(fmt.Sprintf("UserListAll: %v\n", string(msg.Data))) type T_R struct { Code int16 `xml:"Code"` Msg string `xml:"Msg"` TodayWorkOrderNum int64 // 今日工单数量 UntreatedWorkOrderNum int64 // 未处理工单数量 } var t_R T_R err = msgpack.Unmarshal(msg.Data, &t_R) if err != nil { return 0, 0 } return t_R.TodayWorkOrderNum, t_R.UntreatedWorkOrderNum }