fix: reload after batch add or del
This commit is contained in:
@@ -129,7 +129,7 @@ func (r *IMSUserService) SelectList(u model.IMSUser) []model.IMSUser {
|
||||
// Insert 从数据中读取后删除imsi再存入数据库
|
||||
// imsi长度15,ki长度32,opc长度0或者32
|
||||
func (r *IMSUserService) Insert(neId string, u model.IMSUser) int64 {
|
||||
uArr := r.dataByRedis(u.IMSI, neId)
|
||||
uArr := r.dataByRedis(u.IMSI+":*", neId)
|
||||
if len(uArr) > 0 {
|
||||
r.imsUserRepository.Delete(u.IMSI, neId)
|
||||
return r.imsUserRepository.Inserts(uArr)
|
||||
@@ -187,10 +187,17 @@ func (r *IMSUserService) LoadData(neId, imsi, num string) {
|
||||
subNum, _ := strconv.ParseInt(num, 10, 64)
|
||||
var i int64
|
||||
for i = 0; i < subNum; i++ {
|
||||
keyIMSI := fmt.Sprintf("%015d", startIMSI+i)
|
||||
var keyIMSI string
|
||||
if len(imsi) == model.IMSI_MAX_LENGTH {
|
||||
keyIMSI = fmt.Sprintf("%015d", startIMSI+i)
|
||||
} else {
|
||||
// 处理不满15位的IMSI, tag=TAG_VoIP
|
||||
keyIMSI = fmt.Sprintf("%d", startIMSI+i)
|
||||
}
|
||||
|
||||
// 删除原数据
|
||||
r.imsUserRepository.Delete(keyIMSI, neId)
|
||||
arr := r.dataByRedis(keyIMSI, neId)
|
||||
arr := r.dataByRedis(keyIMSI+":*", neId)
|
||||
if len(arr) < 1 {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user