Merge remote-tracking branch 'origin/main' into lichang
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# 项目信息
|
||||
framework:
|
||||
name: "CN EMS"
|
||||
version: "2.2404.4"
|
||||
version: "2.2404.6"
|
||||
|
||||
# 应用服务配置
|
||||
server:
|
||||
|
||||
@@ -25,8 +25,9 @@ type BarProcessor struct {
|
||||
type BarParams struct {
|
||||
Duration int `json:"duration"`
|
||||
TableName string `json:"tableName"`
|
||||
ColName string `json:"colName"` // column name of time string
|
||||
Extras string `json:"extras"` // extras condition for where
|
||||
ColName string `json:"colName"` // column name of time string
|
||||
Extras string `json:"extras"` // extras condition for where
|
||||
SessFlag bool `json:"sessFlag"` // session flag, true: session model, false: no session
|
||||
}
|
||||
|
||||
func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
@@ -74,10 +75,19 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
where = fmt.Sprintf("NOW()>ADDDATE(`%s`,interval %d day) and %s", params.ColName, params.Duration, params.Extras)
|
||||
}
|
||||
|
||||
affected, err := dborm.XormDeleteDataByWhere(where, params.TableName)
|
||||
if err != nil {
|
||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
||||
return nil, err
|
||||
var affected int64 = 0
|
||||
if params.SessFlag {
|
||||
affected, err = dborm.XormDeleteDataByWhere(where, params.TableName)
|
||||
if err != nil {
|
||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
affected, err = dborm.XormDeleteDataByWhereNoSession(where, params.TableName)
|
||||
if err != nil {
|
||||
// panic(fmt.Sprintf("Failed to XormDeleteDataByWhere:%v", err))
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
// 返回结果,用于记录执行结果
|
||||
|
||||
@@ -121,7 +121,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
}
|
||||
if len(*neState) == 0 {
|
||||
log.Warn("Not found record in ne_state:")
|
||||
continue
|
||||
//continue
|
||||
}
|
||||
//log.Debug("neState:", *neState)
|
||||
|
||||
@@ -150,7 +150,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
var timestamp string
|
||||
if len(*neState) == 0 {
|
||||
log.Infof("Not found ne_state neType:%s, neId:%s", ne.NeType, ne.NeId)
|
||||
timestamp = ne.UpdateTime
|
||||
timestamp = ne.UpdateTime.Format(time.DateTime)
|
||||
} else {
|
||||
timestamp = (*neState)[0]["timestamp"]
|
||||
}
|
||||
@@ -208,6 +208,7 @@ func (s *BarProcessor) Execute(data any) (any, error) {
|
||||
log.Debug("requestURL: POST ", requestURL)
|
||||
response, err = client.R().
|
||||
EnableTrace().
|
||||
//SetHeaders(map[string]string{tokenConst.HEADER_KEY: r.Header.Get(tokenConst.HEADER_KEY)}).
|
||||
SetHeaders(map[string]string{"User-Agent": config.GetDefaultUserAgent()}).
|
||||
SetHeaders(map[string]string{"Content-Type": "application/json;charset=UTF-8"}).
|
||||
SetBody(body).
|
||||
|
||||
@@ -40,7 +40,7 @@ func (r *NeInfoImpl) SelectNeInfoByNeTypeAndNeID(neType, neID string) model.NeIn
|
||||
}
|
||||
} else {
|
||||
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
||||
if neInfo.NeId == neID {
|
||||
if neInfo.ID != "" && neInfo.NeId == neID {
|
||||
redis.Del("", key)
|
||||
values, _ := json.Marshal(neInfo)
|
||||
redis.Set("", key, string(values))
|
||||
@@ -55,7 +55,7 @@ func (r *NeInfoImpl) RefreshByNeTypeAndNeID(neType, neID string) model.NeInfo {
|
||||
key := fmt.Sprintf("%s%s:%s", cachekey.NE_KEY, strings.ToUpper(neType), neID)
|
||||
redis.Del("", key)
|
||||
neInfo = r.neInfoRepository.SelectNeInfoByNeTypeAndNeID(neType, neID)
|
||||
if neInfo.NeId == neID {
|
||||
if neInfo.ID != "" && neInfo.NeId == neID {
|
||||
values, _ := json.Marshal(neInfo)
|
||||
redis.Set("", key, string(values))
|
||||
}
|
||||
|
||||
@@ -143,7 +143,8 @@ func (s *TcpdumpImpl) DumpUPF(neType, neId, cmdStr string) (string, string, erro
|
||||
timeStr := date.ParseDateToStr(time.Now(), date.YYYYMMDDHHMMSS)
|
||||
fileName := fmt.Sprintf("%s_%s", timeStr, neTypeID)
|
||||
// UPF标准版本telnet脚本
|
||||
scriptStr := "set pcapCmd [lindex $argv 0]\nspawn telnet localhost 5002\nexpect \"upfd1# \"\nsend \"$pcapCmd\\n\"\nexpect \"upfd1# \"\nsend \"quit\\n\"\nexpect \"eof\""
|
||||
scriptStr := "set pcapCmd [lindex $argv 0]\nspawn telnet " + neInfo.IP + " 5002\nexpect \"upfd1# \"\nsend \"$pcapCmd\\n\"\nexpect \"upfd1# \"\nsend \"quit\\n\"\nexpect \"eof\""
|
||||
// scriptStr := "set pcapCmd [lindex $argv 0]\nspawn telnet localhost 5002\nexpect \"upfd1# \"\nsend \"$pcapCmd\\n\"\nexpect \"upfd1# \"\nsend \"quit\\n\"\nexpect \"eof\""
|
||||
writePcapFile := fmt.Sprintf("echo '%s' > pcapUPF.sh\n %s chmod +x pcapUPF.sh", scriptStr, withSudo)
|
||||
writeLogFile := fmt.Sprintf("> %s.log 2>&1 \ncat %s.log", fileName, fileName)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user