瀏覽代碼

修复查询客户资料解密电话bug(网上开户表的telphone字段不用解密)

zou.yingbin 4 年之前
父節點
當前提交
865cce64f4
共有 1 個文件被更改,包括 11 次插入7 次删除
  1. 11 7
      models/ermcpUser.go

+ 11 - 7
models/ermcpUser.go

@@ -99,7 +99,7 @@ func (r *ErmcpUserModel) buildSql(accStatus string) string {
 }
 
 // 解密卡号和电话号码字段
-func (r *ErmcpUserModel) DecryptField(decryptAddress bool) {
+func (r *ErmcpUserModel) DecryptField(isWskh bool) {
 	key := "0d299ce2d4105282f7471074cb0f9f9d"
 	key2, _ := hex.DecodeString(key)
 	fd := func(str string) string {
@@ -115,9 +115,13 @@ func (r *ErmcpUserModel) DecryptField(decryptAddress bool) {
 
 	r.CARDNUM = fd(r.CARDNUM)
 	r.MOBILE = fd(r.MOBILE)
-	r.TELPHONE = fd(r.TELPHONE)
 
-	if decryptAddress && len(r.ADDRESS) != 0 { // 地址不为空
+	if !isWskh {
+		// 正式用户表(非网上开户)需要解密电话号码
+		r.TELPHONE = fd(r.TELPHONE)
+	}
+
+	if isWskh && len(r.ADDRESS) != 0 { // 地址不为空
 		r.ADDRESS = fd(r.ADDRESS)
 	}
 }
@@ -147,14 +151,14 @@ func (r *ErmcpUserModel) GetData(queryType int32) ([]ErmcpUserModel, error) {
 	sData := make([]ErmcpUserModel, 0)
 	e := db.GetEngine()
 	var sqlId string
-	var decryptAddr bool = false
+	var isWskh bool = false
 	switch queryType {
 	case 1: //未提交
 		sqlId = r.buildWskhSql("1")
-		decryptAddr = true
+		isWskh = true
 	case 2: //待审核
 		sqlId = r.buildWskhSql("2,4,5")
-		decryptAddr = true
+		isWskh = true
 	case 3: //正常
 		sqlId = r.buildSql("4")
 	case 4: //已停用
@@ -168,7 +172,7 @@ func (r *ErmcpUserModel) GetData(queryType int32) ([]ErmcpUserModel, error) {
 
 	// 解密
 	for i := range sData {
-		sData[i].DecryptField(decryptAddr)
+		sData[i].DecryptField(isWskh)
 		sData[i].DecodeStausName(queryType)
 	}