selfcare init
This commit is contained in:
51
proxy_go/Nrestful/alert_sms.go
Normal file
51
proxy_go/Nrestful/alert_sms.go
Normal 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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user