Selaa lähdekoodia

erp用户角色修正

icole 4 vuotta sitten
vanhempi
commit
d20b4817b2

+ 2 - 2
go.mod

@@ -4,7 +4,7 @@ go 1.16
 
 require (
 	git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f
-	git.i2edu.net/i2/i2-bill-erp v0.0.0-20210706060443-0dc13cb6dbeb
+	git.i2edu.net/i2/i2-bill-erp v0.0.0-20210709062523-18c6edcaa220 // indirect
 	github.com/aliyun/aliyun-oss-go-sdk v2.1.8+incompatible
 	github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
 	github.com/clbanning/mxj v1.8.4 // indirect
@@ -16,4 +16,4 @@ require (
 )
 
 // go get -u git.i2edu.net/i2/i2-bill-erp@"$(git ls-remote https://git.i2edu.net/i2/i2-bill-erp refs/heads/master --heads | cut -f 1)"
-// replace git.i2edu.net/i2/i2-bill-erp v0.0.0 => ../i2-bill-erp
+//replace git.i2edu.net/i2/i2-bill-erp v0.0.0 => ../i2-bill-erp

+ 6 - 2
go.sum

@@ -1,8 +1,10 @@
 cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
 git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f h1:zD6rIG7+PhJwYXuQbHyw1pn/z5oUXzrUg9bo9F9+b5k=
 git.i2edu.net/i2/go-zero v1.0.1-0.20210616091154-7fac117e009f/go.mod h1:a9idDtfMmMXrZIHyDg6XnYjWuCpKG0I6zv6Vo9Fpncc=
-git.i2edu.net/i2/i2-bill-erp v0.0.0-20210706060443-0dc13cb6dbeb h1:JD7s0tGKfqiykoiJnrLMdER0XC5JRNDrmQR/cqQKFZU=
-git.i2edu.net/i2/i2-bill-erp v0.0.0-20210706060443-0dc13cb6dbeb/go.mod h1:gYy5Vw881tLNXYyfGeZvmNcpPaVkcVP5MXzE0dTr6Ys=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210708072024-8e03931b0a43 h1:mI+bIZKhPGng8VfpwjaShlNTgBbRqqQxgtSohfeVhh8=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210708072024-8e03931b0a43/go.mod h1:gYy5Vw881tLNXYyfGeZvmNcpPaVkcVP5MXzE0dTr6Ys=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210709062523-18c6edcaa220 h1:j9jLWoD5oX56dpmicLucgz/wzNBFeARmRONa4UqFzfY=
+git.i2edu.net/i2/i2-bill-erp v0.0.0-20210709062523-18c6edcaa220/go.mod h1:gYy5Vw881tLNXYyfGeZvmNcpPaVkcVP5MXzE0dTr6Ys=
 gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s=
 gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU=
 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
@@ -262,9 +264,11 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H
 github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
 github.com/syndtr/goleveldb v1.0.0 h1:fBdIW9lB4Iz0n9khmH8w27SJ3QEJ7+IgjPEwGSZiFdE=
 github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ=
+github.com/tal-tech/go-zero v1.1.7 h1:rs78kI5ZiBx1RIl562qDzkBV8P7CdnbCiljknyC4mXg=
 github.com/tal-tech/go-zero v1.1.7/go.mod h1:BEylLQnv5moldpMT1lH3kUoMEcdaIp+r9Lgp+41dXxg=
 github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
 github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
+github.com/thoas/go-funk v0.8.0 h1:JP9tKSvnpFVclYgDM0Is7FD9M4fhPvqA0s0BsXmzSRQ=
 github.com/thoas/go-funk v0.8.0/go.mod h1:+IWnUfUmFO1+WVYQWQtIJHeRRdaIyyYglZN7xzUPe4Q=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
 github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=

+ 3 - 3
internal/logic/acquirer_mkt_qr/acquirer_mkt_qr_get_logic.go

@@ -31,12 +31,12 @@ func NewAcquirerMktQrGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) A
 func (l *AcquirerMktQrGetLogic) AcquirerMktQrGet(r *http.Request) (*types.Response, error) {
 	// todo: add your logic here and delete this line
 	userId := l.svcCtx.GetUserIdByJwt(l.ctx)
-	erpId, err := model.GetAcquirePerm(userId, l.svcCtx.Transformer, l.svcCtx.DB)
+	erpUser, err := model.GetAcquirePerm(userId, l.svcCtx.Transformer, l.svcCtx.DB)
 	if err != nil {
 		logx.Error(err.Error())
 		return &types.Response{500, err.Error(), nil}, nil
 	}
-	if erpId == "" {
+	if erpUser == nil || erpUser.UserId == "" {
 		return &types.Response{500, "请先申请成为兼职", nil}, nil
 	}
 	qr, err := model.GetAcquirerMktQr(userId, l.svcCtx.DB)
@@ -57,7 +57,7 @@ func (l *AcquirerMktQrGetLogic) AcquirerMktQrGet(r *http.Request) (*types.Respon
 		return &types.Response{500, err.Error(), nil}, nil
 	}
 	var networkId, networkName string
-	utils.TreePath(networkNodes, qr.QudaoId, &networkId, &networkName)
+	utils.TreePath(networkNodes, qr.NetworkDetailId, &networkId, &networkName)
 	qrByte, _ := json.Marshal(qr)
 	var qrMap = make(map[string]interface{})
 	json.Unmarshal(qrByte, &qrMap)

+ 12 - 8
internal/logic/acquirer_mkt_qr/acquirer_mkt_qr_update_logic.go

@@ -52,12 +52,12 @@ func (l *AcquirerMktQrUpdateLogic) AcquirerMktQrUpdate(r *http.Request) (*types.
 	//var ty = "part"
 	//mk
 	if userInfo.ErpId != "" {
-		erpId, err := model.GetErpUser("", userInfo.ErpId, l.svcCtx.Transformer)
+		erpUser, err := model.GetErpUser("", userInfo.ErpId, l.svcCtx.Transformer)
 		if err != nil {
 			logx.Error(err.Error())
 			return &types.Response{500, err.Error(), nil}, nil
 		}
-		if erpId == "" {
+		if erpUser == nil || erpUser.UserId == "" {
 			return &types.Response{500, "未找到mk用户", nil}, nil
 		}
 		//ty = "mk"
@@ -71,16 +71,18 @@ func (l *AcquirerMktQrUpdateLogic) AcquirerMktQrUpdate(r *http.Request) (*types.
 		if partUser.Id == 0 {
 			return &types.Response{500, "请先申请成为兼职", nil}, nil
 		}
-		erpId, err := model.GetErpUser("", partUser.MkId, l.svcCtx.Transformer)
+		erpUser, err := model.GetErpUser("", partUser.MkId, l.svcCtx.Transformer)
 		if err != nil {
 			logx.Error(err.Error())
 			return &types.Response{500, err.Error(), nil}, nil
 		}
-		if erpId == "" {
+		if erpUser == nil || erpUser.UserId == "" {
 			return &types.Response{500, "未找到mk用户", nil}, nil
 		}
-		bean.QudaoId = 1058
-		bean.ActivityId = 0
+		bean.QuaoYji = 1001
+		bean.CallType = 1007
+		bean.MaType = 1445
+		bean.NetworkDetailId = 1058
 	}
 	acquirersQr := new(model.I2billAcquirerMktQrXorm)
 	_, err = l.svcCtx.DB.Where("user_id = ? and del_flag = 0", userId).Get(acquirersQr)
@@ -93,8 +95,10 @@ func (l *AcquirerMktQrUpdateLogic) AcquirerMktQrUpdate(r *http.Request) (*types.
 		acquirersQr.LastUpdateBy = userId
 		acquirersQr.SchoolId = bean.SchoolId
 		acquirersQr.ActivityId = bean.ActivityId
-		acquirersQr.QudaoId = bean.QudaoId
-		_, err = l.svcCtx.DB.ID(acquirersQr.Id).Cols("school_id", "activity_id", "qudao_id", "last_update_time", "last_update_by").Update(acquirersQr)
+		acquirersQr.QuaoYji = bean.QuaoYji
+		acquirersQr.CallType = bean.CallType
+		acquirersQr.MaType = bean.MaType
+		_, err = l.svcCtx.DB.ID(acquirersQr.Id).Cols("school_id", "activity_id", "quao_yji", "call_type", "ma_type", "network_detail_id", "last_update_time", "last_update_by").Update(acquirersQr)
 		if err != nil {
 			logx.Error(err.Error())
 			return &types.Response{500, err.Error(), nil}, nil

+ 8 - 4
internal/logic/acquirer_student/acquirer_student_add_logic.go

@@ -44,12 +44,12 @@ func (l *AcquirerStudentAddLogic) AcquirerStudentAdd(req types.EnrollAddReq) (*t
 		return &types.Response{500, err.Error(), nil}, nil
 	}
 	//是否有权限收单
-	erpId, err := model.GetAcquirePerm(userId, l.svcCtx.Transformer, l.svcCtx.DB)
+	erpUser, err := model.GetAcquirePerm(userId, l.svcCtx.Transformer, l.svcCtx.DB)
 	if err != nil {
 		logx.Error(err.Error())
 		return &types.Response{500, err.Error(), nil}, nil
 	}
-	if erpId == "" {
+	if erpUser == nil || erpUser.UserId == "" {
 		return &types.Response{500, "二维码已失效", nil}, nil
 	}
 	//去重
@@ -66,6 +66,7 @@ func (l *AcquirerStudentAddLogic) AcquirerStudentAdd(req types.EnrollAddReq) (*t
 	bean.StuPhone = req.StuPhone
 	bean.Address = req.Address
 	bean.UserId = userId
+	bean.LoadSchId = erpUser.SchId
 	//获取渠道收单信息
 	acquirerInfo, err := model.GetAcquirerMktQr(userId, l.svcCtx.DB)
 	if err != nil {
@@ -76,8 +77,11 @@ func (l *AcquirerStudentAddLogic) AcquirerStudentAdd(req types.EnrollAddReq) (*t
 		return &types.Response{500, "二维码已失效", nil}, nil
 	}
 
-	bean.MkId = erpId
-	bean.NetworkDetailId = acquirerInfo.QudaoId
+	bean.MkId = erpUser.UserId
+	bean.NetworkDetailId = acquirerInfo.NetworkDetailId
+	bean.QuaoYji = acquirerInfo.QuaoYji
+	bean.MaType = acquirerInfo.MaType
+	bean.CallType = acquirerInfo.CallType
 	bean.ActiveId = acquirerInfo.ActivityId
 	bean.DelFlag = 0
 	bean.CheckState = 54

+ 3 - 3
internal/logic/base_organ_school/get_erp_sch_perm_logic.go

@@ -26,15 +26,15 @@ func NewGetErpSchPermLogic(ctx context.Context, svcCtx *svc.ServiceContext) GetE
 
 func (l *GetErpSchPermLogic) GetErpSchPerm() (*types.Response, error) {
 	// todo: add your logic here and delete this line
-	erpUserId, err := model.GetAcquirePerm(l.svcCtx.GetUserIdByJwt(l.ctx), l.svcCtx.Transformer, l.svcCtx.DB)
+	erpUser, err := model.GetAcquirePerm(l.svcCtx.GetUserIdByJwt(l.ctx), l.svcCtx.Transformer, l.svcCtx.DB)
 	if err != nil {
 		logx.Error(err.Error())
 		return &types.Response{500, err.Error(), nil}, nil
 	}
-	if erpUserId == "" {
+	if erpUser == nil || erpUser.UserId == "" {
 		return &types.Response{}, nil
 	}
-	school, err := model.GetUserSchoolPerm(erpUserId, l.svcCtx.Transformer, l.svcCtx.DB)
+	school, err := model.GetUserSchoolPerm(erpUser.UserId, l.svcCtx.Transformer, l.svcCtx.DB)
 	if err != nil {
 		logx.Error(err.Error())
 		return &types.Response{500, err.Error(), nil}, nil

+ 30 - 24
model/i2bill_acquirer_mkt_qr_model.go

@@ -34,30 +34,36 @@ type (
 	}
 
 	I2billAcquirerMktQr struct {
-		SchoolId       sql.NullInt64  `db:"school_id" json:"school_id"` // 校区id
-		Qr             sql.NullString `db:"qr" json:"qr"`               // 二维码url
-		LastUpdateBy   sql.NullInt64  `db:"last_update_by" json:"last_update_by"`
-		Id             int64          `db:"id" json:"id"`                   // 主键
-		UserId         sql.NullInt64  `db:"user_id" json:"user_id"`         // 用户id
-		ActivityId     sql.NullInt64  `db:"activity_id" json:"activity_id"` // 活动id
-		CreateBy       sql.NullInt64  `db:"create_by" json:"create_by"`
-		LastUpdateTime sql.NullTime   `db:"last_update_time" json:"last_update_time"`
-		QudaoId        sql.NullInt64  `db:"qudao_id" json:"qudao_id"` // 渠道id
-		DelFlag        sql.NullInt64  `db:"del_flag" json:"del_flag"`
-		CreateTime     sql.NullTime   `db:"create_time" json:"create_time"`
+		SchoolId        sql.NullInt64  `db:"school_id" json:"school_id"` // 校区id
+		Qr              sql.NullString `db:"qr" json:"qr"`               // 二维码url
+		LastUpdateBy    sql.NullInt64  `db:"last_update_by" json:"last_update_by"`
+		Id              int64          `db:"id" json:"id"`                   // 主键
+		UserId          sql.NullInt64  `db:"user_id" json:"user_id"`         // 用户id
+		ActivityId      sql.NullInt64  `db:"activity_id" json:"activity_id"` // 活动id
+		CreateBy        sql.NullInt64  `db:"create_by" json:"create_by"`
+		LastUpdateTime  sql.NullTime   `db:"last_update_time" json:"last_update_time"`
+		QuaoYji         sql.NullInt64  `db:"quao_yji" json:"quao_yji"`                   // 渠道一级
+		CallType        sql.NullInt64  `db:"call_type" json:"call_type"`                 // 渠道二级
+		MaType          sql.NullInt64  `db:"ma_type"  json:"ma_type"`                    //渠道三级
+		NetworkDetailId sql.NullInt64  `db:"network_detail_id" json:"network_detail_id"` //渠道四级
+		DelFlag         sql.NullInt64  `db:"del_flag" json:"del_flag"`
+		CreateTime      sql.NullTime   `db:"create_time" json:"create_time"`
 	}
 	I2billAcquirerMktQrXorm struct {
-		SchoolId       int64     `json:"school_id"`
-		Qr             string    `json:"qr"`
-		LastUpdateBy   int64     `json:"last_update_by"`
-		Id             int64     `json:"id"`
-		UserId         int64     `json:"user_id"`
-		ActivityId     int64     `json:"activity_id"`
-		CreateBy       int64     `json:"create_by"`
-		LastUpdateTime time.Time `json:"last_update_time"`
-		QudaoId        int64     `json:"qudao_id"`
-		DelFlag        int64     `json:"del_flag"`
-		CreateTime     time.Time `json:"create_time"`
+		SchoolId        int64     `json:"school_id"`
+		Qr              string    `json:"qr"`
+		LastUpdateBy    int64     `json:"last_update_by"`
+		Id              int64     `json:"id"`
+		UserId          int64     `json:"user_id"`
+		ActivityId      int64     `json:"activity_id"`
+		CreateBy        int64     `json:"create_by"`
+		LastUpdateTime  time.Time `json:"last_update_time"`
+		QuaoYji         int64     `json:"quao_yji"`          // 渠道一级
+		CallType        int64     `json:"call_type"`         // 渠道二级
+		MaType          int64     `json:"ma_type"`           //渠道三级
+		NetworkDetailId int64     `json:"network_detail_id"` //渠道四级
+		DelFlag         int64     `json:"del_flag"`
+		CreateTime      time.Time `json:"create_time"`
 	}
 )
 
@@ -70,7 +76,7 @@ func NewI2billAcquirerMktQrModel(conn sqlx.SqlConn) I2billAcquirerMktQrModel {
 
 func (m *defaultI2billAcquirerMktQrModel) Insert(data I2billAcquirerMktQr) (sql.Result, error) {
 	query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, i2billAcquirerMktQrRowsExpectAutoSet)
-	ret, err := m.conn.Exec(query, data.SchoolId, data.Qr, data.LastUpdateBy, data.UserId, data.ActivityId, data.CreateBy, data.LastUpdateTime, data.QudaoId, data.DelFlag)
+	ret, err := m.conn.Exec(query, data.SchoolId, data.Qr, data.LastUpdateBy, data.UserId, data.ActivityId, data.CreateBy, data.LastUpdateTime, data.QuaoYji, data.CallType, data.MaType, data.NetworkDetailId, data.DelFlag)
 	return ret, err
 }
 
@@ -90,7 +96,7 @@ func (m *defaultI2billAcquirerMktQrModel) FindOne(id int64) (*I2billAcquirerMktQ
 
 func (m *defaultI2billAcquirerMktQrModel) Update(data I2billAcquirerMktQr) error {
 	query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, i2billAcquirerMktQrRowsWithPlaceHolder)
-	_, err := m.conn.Exec(query, data.SchoolId, data.Qr, data.LastUpdateBy, data.UserId, data.ActivityId, data.CreateBy, data.LastUpdateTime, data.QudaoId, data.DelFlag, data.Id)
+	_, err := m.conn.Exec(query, data.SchoolId, data.Qr, data.LastUpdateBy, data.UserId, data.ActivityId, data.CreateBy, data.LastUpdateTime, data.QuaoYji, data.CallType, data.MaType, data.NetworkDetailId, data.DelFlag, data.Id)
 	return err
 }
 

+ 13 - 5
model/i2bill_acquirer_student_model.go

@@ -49,7 +49,11 @@ type (
 		AgeGroup        int64          `db:"age_group" json:"age_group"` // 学员年龄
 		SchId           sql.NullInt64  `db:"sch_id" json:"sch_id"`       // 意向校区
 		DelFlag         int64          `db:"del_flag" json:"del_flag"`
-		NetworkDetailId sql.NullInt64  `db:"network_detail_id" json:"network_detail_id"` // 渠道
+		QuaoYji         sql.NullInt64  `db:"quao_yji" json:"quao_yji"`                   // 渠道一级
+		CallType        sql.NullInt64  `db:"call_type" json:"call_type"`                 // 渠道二级
+		MaType          sql.NullInt64  `db:"ma_type"  json:"ma_type"`                    //渠道三级
+		NetworkDetailId sql.NullInt64  `db:"network_detail_id" json:"network_detail_id"` //渠道四级
+		LoadSchId       sql.NullInt64  `db:"load_sch_id" json:"load_sch_id"`             //资源收集校区
 		ActiveId        sql.NullInt64  `db:"active_id" json:"active_id"`                 //活动
 	}
 
@@ -69,7 +73,11 @@ type (
 		AgeGroup        int64     `db:"age_group" json:"age_group"` // 学员年龄
 		SchId           int64     `db:"sch_id" json:"sch_id"`       // 意向校区
 		DelFlag         int64     `db:"del_flag" json:"del_flag"`
-		NetworkDetailId int64     `db:"network_detail_id" json:"network_detail_id"` // 渠道
+		QuaoYji         int64     `db:"quao_yji" json:"quao_yji"`                   // 渠道一级
+		CallType        int64     `db:"call_type" json:"call_type"`                 // 渠道二级
+		MaType          int64     `db:"ma_type"  json:"ma_type"`                    //渠道三级
+		NetworkDetailId int64     `db:"network_detail_id" json:"network_detail_id"` //渠道四级
+		LoadSchId       int64     `db:"load_sch_id" json:"load_sch_id"`             //收集收集校区
 		ActiveId        int64     `db:"active_id" json:"active_id"`                 //活动
 	}
 )
@@ -86,8 +94,8 @@ func NewI2billAcquirerStudentModel(conn sqlx.SqlConn) I2billAcquirerStudentModel
 }
 
 func (m *defaultI2billAcquirerStudentModel) Insert(data I2billAcquirerStudent) (sql.Result, error) {
-	query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", m.table, i2billAcquirerStudentRowsExpectAutoSet)
-	ret, err := m.conn.Exec(query, data.StuLinkPerson, data.StuPhone, data.CheckTime, data.CheckBy, data.MkId, data.UserId, data.Address, data.CheckState, data.Id, data.PartTimeUserId, data.StuName, data.AgeGroup, data.SchId, data.DelFlag, data.NetworkDetailId)
+	query := fmt.Sprintf("insert into %s (%s) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,?,?,?,?,?)", m.table, i2billAcquirerStudentRowsExpectAutoSet)
+	ret, err := m.conn.Exec(query, data.StuLinkPerson, data.StuPhone, data.CheckTime, data.CheckBy, data.MkId, data.UserId, data.Address, data.CheckState, data.Id, data.PartTimeUserId, data.StuName, data.AgeGroup, data.SchId, data.DelFlag, data.QuaoYji, data.CallType, data.MaType, data.NetworkDetailId, data.LoadSchId, data.ActiveId)
 	return ret, err
 }
 
@@ -107,7 +115,7 @@ func (m *defaultI2billAcquirerStudentModel) FindOne(id int64) (*I2billAcquirerSt
 
 func (m *defaultI2billAcquirerStudentModel) Update(data I2billAcquirerStudent) error {
 	query := fmt.Sprintf("update %s set %s where `id` = ?", m.table, i2billAcquirerStudentRowsWithPlaceHolder)
-	_, err := m.conn.Exec(query, data.StuLinkPerson, data.StuPhone, data.CheckTime, data.CheckBy, data.MkId, data.UserId, data.Address, data.CheckState, data.PartTimeUserId, data.StuName, data.AgeGroup, data.SchId, data.DelFlag, data.NetworkDetailId, data.Id)
+	_, err := m.conn.Exec(query, data.StuLinkPerson, data.StuPhone, data.CheckTime, data.CheckBy, data.MkId, data.UserId, data.Address, data.CheckState, data.PartTimeUserId, data.StuName, data.AgeGroup, data.SchId, data.DelFlag, data.QuaoYji, data.CallType, data.MaType, data.NetworkDetailId, data.LoadSchId, data.ActiveId, data.Id)
 	return err
 }
 

+ 7 - 7
model/i2bill_user_model.go

@@ -223,11 +223,11 @@ func GetI2bilUserInfo(userId int64, engine *xorm.Engine) (*UserXorm, error) {
 	return user, nil
 }
 
-func GetAcquirePerm(userId int64, rpcClient transformclient.Transform, engine *xorm.Engine) (string, error) {
+func GetAcquirePerm(userId int64, rpcClient transformclient.Transform, engine *xorm.Engine) (*transform.GetErpRoleRes, error) {
 
 	partUser, err := GetPartTimeXormByUserId(userId, engine)
 	if err != nil {
-		return "", err
+		return nil, err
 	}
 	if partUser.Id != 0 && partUser.MkId != "" {
 		return GetErpUser("", partUser.MkId, rpcClient)
@@ -235,31 +235,31 @@ func GetAcquirePerm(userId int64, rpcClient transformclient.Transform, engine *x
 
 	user, err := GetI2bilUserInfo(userId, engine)
 	if err != nil {
-		return "", err
+		return nil, err
 	}
 
 	return GetErpUser(user.Mobile, "", rpcClient)
 }
 
-func GetErpUser(mobile string, erpUserId string, rpcClient transformclient.Transform) (string, error) {
+func GetErpUser(mobile string, erpUserId string, rpcClient transformclient.Transform) (*transform.GetErpRoleRes, error) {
 	ctx := context.Background()
 	in := new(transform.GetErpRoleReq)
 	in.Mobile = mobile
 	in.UserId = erpUserId
 	erpRoles, err := rpcClient.GetErpRole(ctx, in)
 	if err != nil {
-		return "", err
+		return nil, err
 	}
 	if erpRoles.UserId != "" {
 		roles := strings.Split(erpRoles.Role, ",")
 		for _, r := range roles {
 			if r == "LAMK" || r == "LAMKM" || r == "student/readingStudent" {
-				return erpRoles.UserId, nil
+				return erpRoles, nil
 			}
 		}
 
 	}
-	return "", nil
+	return nil, nil
 }
 
 //获取校区权限