fix: adjustment directory structure
This commit is contained in:
47
proxy/Nredis/create_acct.go
Normal file
47
proxy/Nredis/create_acct.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package Nredis
|
||||
|
||||
import (
|
||||
"proxy/MsgDef"
|
||||
l4g "proxy/logger"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func RdbSetCreateAcctRecord(r *MsgDef.ChgSyncMobile) error {
|
||||
key := "CreateAcct:"+r.ServiceNbr+":"+strconv.Itoa(r.PreId)
|
||||
err := rdb.HMSet(ctx, key, "prdInstId", r.PrdInstId, "serviceNbr", r.ServiceNbr,
|
||||
"operType", r.OperType, "state", r.State, "ofrId", r.OfrId,
|
||||
"custId", r.CustId, "acctId", r.AcctId, "mobileType", r.MobileType, "balance", r.Balance, "birthDate", r.BirthDate, "balanceExpDate", r.BalanceExpDate).Err()
|
||||
if err != nil {
|
||||
l4g.RedisLog.Errorf("HMSet %s, err: %v", key, err)
|
||||
} else {
|
||||
l4g.RedisLog.Debugf("HMSet %s, [%#v]", key, r)
|
||||
sadd := rdb.SAdd(ctx, "Msg2OcsSet", key)
|
||||
if sadd.Err() != nil {
|
||||
l4g.RedisLog.Errorf("SAdd Msg2OcsSet %s, err: %v", key, sadd.Err())
|
||||
return sadd.Err()
|
||||
} else {
|
||||
l4g.RedisLog.Debugf("SAdd Msg2OcsSet %s", key)
|
||||
}
|
||||
}
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func RdbGetCreateAcct(key string) *MsgDef.ChgSyncMobile {
|
||||
res := rdb.HGetAll(ctx, key)
|
||||
err := res.Err()
|
||||
if err != nil {
|
||||
l4g.RedisLog.Errorf("HGetAll %s, err: %v", key, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Scan the results into the struct.
|
||||
var acctInfo MsgDef.ChgSyncMobile
|
||||
if err = res.Scan(&acctInfo); err != nil {
|
||||
l4g.RedisLog.Errorf("HGetAll Scan %s, err: %v", key, err)
|
||||
return nil
|
||||
} else {
|
||||
l4g.RedisLog.Debugf("Get %s, [%v]", key, acctInfo)
|
||||
return &acctInfo
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user