selfcare init

This commit is contained in:
zhangsz
2025-03-03 11:40:37 +08:00
parent 19f09dd7ea
commit aca2bace68
692 changed files with 273972 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package Nrestful
import (
mysql "proxy/Nmysql"
rdb "proxy/Nredis"
"strconv"
"strings"
)
func RdbScanAlertSmsRecord() {
keys := rdb.RdbScanAlertSmsRecord()
for _, key := range keys {
if strings.HasPrefix(key, "AlertSms:") {
smsContent := rdb.RdbGetAlertSmsContent(key)
if smsContent != "" {
ss := strings.Split(key, ":")
if len(ss) >= 3 {
SendNtfSms2Ocs(ss[1], smsContent)
alertId, _ := strconv.Atoi(ss[2])
_ = mysql.SetAlertSmsState2Sent(alertId)
}
}
rdb.RdsDelMsg2OcsKey(key)
} else if strings.HasPrefix(key, "CreateAcct:") {
ai := rdb.RdbGetCreateAcct(key)
if ai != nil {
ss := strings.Split(key, ":")
if len(ss) >= 3 {
cugId, err := mysql.QueryOfrIdByPrdInstId(ai.PrdInstId)
userClass := 1
ofrLevel, err := mysql.QueryOfrLevelByOfrId(ai.OfrId)
if err == nil {
userClass = ofrLevel
}
rent, _ := mysql.QueryRentByOfrId(ai.OfrId)
//SendCrtAcct2Ocs(ss[1], ai, cugId, userClass, rent)
CreateAcct2Ocs(ss[1], ai, cugId, userClass, rent, key)
}
}
}
}
//for _, key := range keys {
// rdb.RdsDelMsg2OcsKey(key)
//}
return
}