package service import ( "app.yhyue.com/moapp/jybase/common" "app.yhyue.com/moapp/jybase/redis" MC "bp.jydev.jianyu360.cn/BaseService/biCenter/api/common" "encoding/base64" "github.com/tjfoc/gmsm/sm4" ) type InfoService struct { } func (l *InfoService) Myinfo(sid string) map[string]interface{} { infoMap := map[string]interface{}{} info_i := redis.Get("session", sid) if info_i != nil { info_m, _ := info_i.(map[string]interface{}) infoMap = map[string]interface{}{ "nickName": RsaEncrypt([]byte(common.InterfaceToStr(info_m["s_nickname"]))), "entRole": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entRole"]))), "entNicheDis": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entNicheDis"]))), "positionId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["positionId"]))), "accountId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["accountId"]))), "entAccountId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entAccountId"]))), "entId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entId"]))), "entName": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entName"]))), "entUserName": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entUserName"]))), "entUserId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["entUserId"]))), "userId": RsaEncrypt([]byte(common.InterfaceToStr(info_m["base_user_id"]))), } } return infoMap } // 加密 func RsaEncrypt(data []byte) string { key := []byte(MC.C.PublicKey) //加密 b, _ := sm4.Sm4Ecb(key, data, true) return base64.StdEncoding.EncodeToString(b) }