wangchuanjin 2 жил өмнө
parent
commit
b9cca6f057
1 өөрчлөгдсөн 16 нэмэгдсэн , 0 устгасан
  1. 16 0
      identity/identity.go

+ 16 - 0
identity/identity.go

@@ -4,6 +4,7 @@ import (
 	"strconv"
 
 	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
 )
 
 type IdentityInfo struct {
@@ -19,6 +20,21 @@ type IdentityInfo struct {
 	EntUserName  string //企业员工姓名
 }
 
+func NewIdentityInfo(i *pb.Identity) *IdentityInfo {
+	return &IdentityInfo{
+		Name:         i.Name,
+		PersonId:     i.PersonId,
+		UserName:     i.UserName,
+		AccountId:    i.AccountId,
+		EntAccountId: i.EntAccountId,
+		PositionId:   i.PositionId,
+		PositionType: i.PositionType,
+		EntId:        i.EntId,
+		EntUserId:    i.EntUserId,
+		EntUserName:  i.EntUserName,
+	}
+}
+
 //切换身份
 func (i *IdentityInfo) Switch(sess *httpsession.Session) bool {
 	ok := false