浏览代码

wip:调整加密方式

fuwencai 3 年之前
父节点
当前提交
e6bb5c734d

+ 1 - 6
api/medical/internal/logic/public/distributorclaimlogic.go

@@ -29,12 +29,7 @@ func NewDistributorClaimLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 // DistributorClaim 经销商认领
 func (l *DistributorClaimLogic) DistributorClaim(req *types.ClaimReq) (resp *types.ClaimResp, err error) {
 	// 解密企业id
-	entID := encrypt.SE.DecodeString(req.EntId)
-	if !entity.IsUtf8([]byte(entID)) {
-		// 尝试使用第二种方式解密
-		logx.Infof("解密失败,尝试第二种方式")
-		entID = encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
-	}
+	entID := encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
 	if entID == "" || req.EntName == "" {
 		return &types.ClaimResp{
 			Error_msg:   "参数有误",

+ 1 - 6
api/medical/internal/logic/public/distributorunclaimedlogic.go

@@ -28,12 +28,7 @@ func NewDistributorUnclaimedLogic(ctx context.Context, svcCtx *svc.ServiceContex
 // DistributorUnclaimed 经销商取消认领
 func (l *DistributorUnclaimedLogic) DistributorUnclaimed(req *types.ClaimReq) (resp *types.ClaimResp, err error) {
 	// 解密企业id
-	entID := encrypt.SE.DecodeString(req.EntId)
-	if !entity.IsUtf8([]byte(entID)) {
-		// 尝试使用第二种方式解密
-		logx.Infof("解密失败,尝试第二种方式")
-		entID = encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
-	}
+	entID := encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
 	if entID == "" {
 		return &types.ClaimResp{
 			Error_msg:   "参数有误",

+ 1 - 7
api/medical/internal/logic/public/institutionclaimlogic.go

@@ -26,13 +26,7 @@ func NewInstitutionclaimLogic(ctx context.Context, svcCtx *svc.ServiceContext) *
 
 // Institutionclaim 机构认领
 func (l *InstitutionclaimLogic) Institutionclaim(req *types.ClaimReq) (resp *types.ClaimResp, err error) {
-	// 解密企业id
-	entID := encrypt.SE.DecodeString(req.EntId)
-	if !entity.IsUtf8([]byte(entID)) {
-		// 尝试使用第二种方式解密
-		logx.Infof("解密失败,尝试第二种方式")
-		entID = encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
-	}
+	entID := encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
 	if entID == "" || req.EntName == "" {
 		return &types.ClaimResp{
 			Error_msg:   "参数有误",

+ 1 - 7
api/medical/internal/logic/public/institutionunclaimedlogic.go

@@ -28,13 +28,7 @@ func NewInstitutionUnclaimedLogic(ctx context.Context, svcCtx *svc.ServiceContex
 
 // InstitutionUnclaimed 机构取消认领
 func (l *InstitutionUnclaimedLogic) InstitutionUnclaimed(req *types.ClaimReq) (resp *types.ClaimResp, err error) {
-	// 解密企业id
-	entID := encrypt.SE.DecodeString(req.EntId)
-	if !entity.IsUtf8([]byte(entID)) {
-		// 尝试使用第二种方式解密
-		logx.Infof("解密失败,尝试第二种方式")
-		entID = encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
-	}
+	entID := encrypt.DecodeArticleId2ByCheck(req.EntId)[0]
 	if entID == "" {
 		return &types.ClaimResp{
 			Error_msg:   "参数有误",

+ 1 - 6
api/medical/internal/logic/public/isclaimedlogic.go

@@ -29,12 +29,7 @@ func NewIsClaimedLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsClaim
 // IsClaimed 是否认领
 func (l *IsClaimedLogic) IsClaimed(req *types.IsClaimedReq) (resp *types.CommonRes, err error) {
 	// 解密企业id
-	entID := encrypt.SE.DecodeString(req.CompanyId)
-	if !entity.IsUtf8([]byte(entID)) {
-		// 尝试使用第二种方式解密
-		logx.Infof("解密失败,尝试第二种方式")
-		entID = encrypt.DecodeArticleId2ByCheck(req.CompanyId)[0]
-	}
+	entID := encrypt.DecodeArticleId2ByCheck(req.CompanyId)[0]
 	if entID == "" {
 		return &types.CommonRes{
 			Error_msg:  "参数有误",

+ 2 - 2
rpc/medical/internal/logic/claimeddistributorlistlogic.go

@@ -58,9 +58,9 @@ func (l *ClaimedDistributorListLogic) ClaimedDistributorList(in *medical.Claimed
 			city := common.ObjToString(info["city"])
 			resultList.List = append(resultList.List,
 				&medical.EntClaim{
-					Id:            encrypt.SE.EncodeString(fmt.Sprintf("%v", (*rs)[i]["id"])),
+					Id:            encrypt.EncodeArticleId2ByCheck(fmt.Sprintf("%v", (*rs)[i]["id"])),
 					AppId:         common.ObjToString((*rs)[i]["appid"]),
-					EntId:         encrypt.SE.EncodeString(entId),
+					EntId:         encrypt.EncodeArticleId2ByCheck(entId),
 					EntName:       common.ObjToString((*rs)[i]["ent_name"]),
 					Address:       common.ObjToString(common.If(area != "", fmt.Sprintf("%v省 %v", area, city), "")),
 					EstablishDate: common.ObjToString(info["establish_date"]),

+ 2 - 2
rpc/medical/internal/logic/claimedinstitutionlistlogic.go

@@ -60,9 +60,9 @@ func (l *ClaimedInstitutionListLogic) ClaimedInstitutionList(in *medical.Claimed
 			city := common.ObjToString(info["city"])
 			resultList.List = append(resultList.List,
 				&medical.EntClaim{
-					Id:         encrypt.SE.EncodeString(fmt.Sprintf("%v", (*rs)[i]["id"])),
+					Id:         encrypt.EncodeArticleId2ByCheck(fmt.Sprintf("%v", (*rs)[i]["id"])),
 					AppId:      common.ObjToString((*rs)[i]["appid"]),
-					EntId:      encrypt.SE.EncodeString(entId),
+					EntId:      encrypt.EncodeArticleId2ByCheck(entId),
 					EntName:    common.ObjToString((*rs)[i]["ent_name"]),
 					Address:    common.ObjToString(common.If(area != "", fmt.Sprintf("%v省 %v", area, city), "")),
 					UpdateTime: common.ObjToString((*rs)[i]["update_time"]),