Explorar o código

update record conf

dujunchen hai 1 semana
pai
achega
64c9485c1c

+ 10 - 10
internal/app/ami/action/index.go

@@ -61,17 +61,17 @@ func HandleAMI(event map[string]string) {
 		}
 
 	case "ExtensionStatus":
-		lfshook.NewLogger().Infof("=========%s", event["Event"])
-		if event["StatusText"] == "Idle" || event["StatusText"] == "Unavailable" {
-			status := &model.Extension{
-				Extension: event["Exten"],
-				Status:    event["StatusText"],
-			}
-			_, err := mysql.DBOrmInstance.Where("exten = ?", status.Extension).Cols("status").Update(status)
-			if err != nil {
-				lfshook.NewLogger().Infof("update extension status err : %+v", err.Error())
-			}
+		lfshook.NewLogger().Infof("=========event:%s   status:%s", event["Event"], event["StatusText"])
 
+		status := &model.Extension{
+			Extension: event["Exten"],
+			Status:    event["StatusText"],
+		}
+		_, err := mysql.DBOrmInstance.Where("exten = ?", status.Extension).Cols("status").Update(status)
+		if err != nil {
+			lfshook.NewLogger().Infof("update extension status err : %+v", err.Error())
+		}
+		if event["StatusText"] == "Idle" || event["StatusText"] == "Unavailable" {
 			if len(event["Exten"]) > 3 {
 				alstatus.AlarmStatus(event["Exten"], event["StatusText"], conn) // Alarm idle + unavailable
 			}

+ 5 - 1
internal/app/ami/model/cdr.go

@@ -28,7 +28,11 @@ type RcdConf struct {
 	PadRcdStorageDays int `xorm:"pad_rcdstorage_days" json:"padRcdStorageDays"`
 	PaRcdStorageDays  int `xorm:"pa_rcdstorage_days" json:"paRcdStorageDays"`
 	CpaRcdStorageDays int `xorm:"cpa_rcdstorage_days" json:"cpaRcdStorageDays"`
-	OpaRcdStorageDays int `xorm:"0pa_rcdstorage_days" json:"opaRcdStorageDays"`
+	OpaRcdStorageDays int `xorm:"opa_rcdstorage_days" json:"opaRcdStorageDays"`
+	PadRcdDelDays     int `xorm:"pad_rcd_del" json:"pad_rcd_del_days"`
+	PaRcdDelDays      int `xorm:"pa_rcd_del" json:"pa_rcd_del_days"`
+	CpaRcdDelDays     int `xorm:"cpa_rcd_del" json:"cpa_rcd_del_days"`
+	OpaRcdDelDays     int `xorm:"opa_rcd_del" json:"opa_rcd_del_days"`
 }
 
 func (*RcdConf) TableName() string {

+ 19 - 18
internal/app/stc/broadcast/stc-broadcast.go

@@ -363,15 +363,15 @@ func AlarmHandle(data []byte) {
 		lfshook.NewLogger().Logger.Infof("================ICP Answer PAD================:%s ", exten)
 		if infoExt.Status == "Idle" {
 			if active.CabNum == "1" && active.Actived {
-				action.Dial("0402", PacuNum, "default", PacuNum, exten, "1") // PACU dial ICP
+				action.Dial("0402", PacuNum, "default", PacuNum, exten, "1") // PACU dial ICP MC1
 			} else if active.CabNum == "8" && active.Actived {
-				action.Dial("0402", PacuNum, "default", PacuNum, exten, "8") // PACU dial ICP
+				action.Dial("0402", PacuNum, "default", PacuNum, exten, "8") // PACU dial ICP MC8
 			}
 		} else {
 			if active.CabNum == "1" && active.Actived {
-				action.RedirectInQueue(exten, "0402", "default", "1") // PACU dial ICP
+				action.RedirectInQueue(exten, "0402", "default", "1") // PAD dial ICP MC1
 			} else if active.CabNum == "8" && active.Actived {
-				action.RedirectInQueue(exten, "0402", "default", "8") // PACU dial ICP
+				action.RedirectInQueue(exten, "0402", "default", "8") // PAD dial ICP MC8
 			}
 		}
 
@@ -435,7 +435,7 @@ func AlarmResetAll() {
 
 	var AlarmExts []model.Extension
 
-	er := mysql.DBOrmInstance.Where("dev_type = ?", "PAIU").Find(&AlarmExts)
+	er := mysql.DBOrmInstance.Where("dev_type = ? and status != ?", "PAIU", "Idle").Find(&AlarmExts)
 	if er != nil {
 		lfshook.NewLogger().Logger.Infof("update special voice to exten err : %+v", er.Error())
 	}
@@ -444,25 +444,26 @@ func AlarmResetAll() {
 		action.Hangup(ext.Extension)
 	}
 
-	action.Hangup("2311")
+	if active.CabNum == "1" && active.Actived {
+		action.Hangup("2311") //1 车接听
+	} else if active.CabNum == "8" && active.Actived {
+		action.Hangup("2381") //8 车接听
+	}
 }
 
 func RecordStorageConf(data []byte) {
-	padRcdEnable := data[0]
-	padRcdStorageDays := data[1]
-	paRcdStorageDays := data[2]
-	cpaRcdStorageDays := data[3]
-
-	//padRcdDelDays := data[4]
-	//PaRcdDelDays := data[5]
-	//cpaRcdDelDays := data[6]
 
 	var info model.RcdConf
 
-	info.PadRcdEnable = int(padRcdEnable)
-	info.PadRcdStorageDays = int(padRcdStorageDays)
-	info.CpaRcdStorageDays = int(cpaRcdStorageDays)
-	info.PaRcdStorageDays = int(paRcdStorageDays)
+	info.PadRcdEnable = int(data[0])
+	info.PadRcdStorageDays = int(data[1])
+	info.PaRcdStorageDays = int(data[2])
+	info.CpaRcdStorageDays = int(data[3])
+
+	info.PadRcdDelDays = int(data[4])
+	info.PaRcdDelDays = int(data[5])
+	info.CpaRcdDelDays = int(data[6])
+	info.OpaRcdDelDays = int(data[7])
 
 	//update record config
 	_, er := mysql.DBOrmInstance.Update(&info)