Sfoglia il codice sorgente

1、商品查询增加详情字段;
2、菜单权限适配千海金新需求。

zhou.xiaoning 4 anni fa
parent
commit
8d6423bbd2
4 ha cambiato i file con 38 aggiunte e 4 eliminazioni
  1. 15 2
      models/account.go
  2. 17 2
      models/common.go
  3. 3 0
      models/ermcpGoods.go
  4. 3 0
      models/goods.go

+ 15 - 2
models/account.go

@@ -292,7 +292,7 @@ func (Quoter) TableName() string {
 // Arearole 机构角色表
 type Arearole struct {
 	Userid         int64     `json:"userid"  xorm:"USERID" binding:"required"`     // 机构用户ID其他做市关系,都设置为 1
-	Roletype       int32     `json:"roletype"  xorm:"ROLETYPE" binding:"required"` // 角色类型 -  1:交易所 2:运营机构 3:营销中心 4:仓库机构 5:三方服务机构 6:自营会员 7:经纪会员 8:做市会员 9:产业会员 10:金融机构 11:商城店铺 12:子机构 13:报价商 14:积分服务商 15:供货商 16:圈内会员 17:物流机构 18:报价配置机构 19:场外期权做市商 20:组织机构 21:顶级机构 22:业务员 23:跟单员 24:交易员
+	Roletype       int32     `json:"roletype"  xorm:"ROLETYPE" binding:"required"` // 角色类型 -  1:交易所 2:运营机构 3:营销中心 4:仓库机构 5:三方服务机构 6:自营会员 7:经纪会员 8:做市会员 9:产业会员 10:金融机构 11:商城店铺 12:子机构 13:报价商 14:积分服务商 15:供货商 16:圈内会员 17:物流机构 18:报价配置机构 19:场外期权做市商 20:组织机构 21:顶级机构 22:业务员 23:跟单员 24:交易员 25:客户      98:代理 99:门店
 	Tradeaccountid int64     `json:"tradeaccountid"  xorm:"TRADEACCOUNTID"`        // 默认交易资金账号ID(做市会员被动接单使用、商城店铺默认资金账 号、圈内会员默认资金账号)  - 作废, 使用UserReckonAccount
 	Createtime     time.Time `json:"createtime"  xorm:"CREATETIME"`                // 创建时间
 	Creatorid      int64     `json:"creatorid"  xorm:"CREATORID"`                  // 创建人ID
@@ -305,7 +305,9 @@ type Arearole struct {
 	Parentuserid   int64     `json:"parentuserid"  xorm:"PARENTUSERID"`            // 上级组织机构(组织机构)
 	Rootuserid     int64     `json:"rootuserid"  xorm:"ROOTUSERID"`                // 顶级组织机构用户ID(组织机构)
 	Sublevelpath   string    `json:"sublevelpath"  xorm:"SUBLEVELPATH"`            // 组织机构层级路径(逗号分隔,首尾加逗号)
-	Orgtype        int32     `json:"orgtype"  xorm:"ORGTYPE"`                      // 组织机构类型 1:机构 2:交易员
+	Orgtype        int32     `json:"orgtype"  xorm:"ORGTYPE"`                      // 组织机构类型 1:机构\分支节点 2:交易员\叶子节点 3:部门\分支节点
+	Fromuserid     int64     `json:"fromuserid"  xorm:"FROMUSERID"`                // 所属机构(组织机构)( OrgType = 1时为自己, = 2\3时取上级机构的所属机构)
+	Suborgtype     int32     `json:"suborgtype"  xorm:"SUBORGTYPE"`                // 子机构类型(千海金) - 0:机构 1:代理 2:门店
 }
 
 // TableName is AREAROLE
@@ -324,6 +326,17 @@ func (r *Arearole) GetAreaRolesByUserID(UserID int) ([]Arearole, error) {
 	return areaRoles, nil
 }
 
+// 获取目标账号的相关角色信息
+func (r *Arearole) GetAreaRoles(UserID int) ([]Arearole, error) {
+	areaRoles := make([]Arearole, 0)
+
+	if err := db.GetEngine().Where("ROLETYPE = 20 and USERID = ?", UserID).Find(&areaRoles); err != nil {
+		return nil, err
+	}
+
+	return areaRoles, nil
+}
+
 // Taaccountlog 资金账户记账流水表 - 导历史
 type Taaccountlog struct {
 	Autoid           int64     `json:"autoid"  xorm:"'AUTOID'" binding:"required"`                     // 流水ID(220+Unix秒时间戳(10位)+xxxxxx)

+ 17 - 2
models/common.go

@@ -822,8 +822,23 @@ func GetErmcpRoleFuncMenuLists(loginID int, resourceCode string) ([]Funcmenulist
 		return nil, errors.New("没有对应的用户信息")
 	}
 
+	// 是否企业
+	isEnterprise := false
+	// 查询机构角色表
+	var arearole Arearole
+	arearoles, err := arearole.GetAreaRoles(int(userAccount.Userid))
+	if err != nil {
+		return nil, err
+	}
+	if len(arearoles) > 0 {
+		arearole = arearoles[0]
+		if arearole.Suborgtype == 0 {
+			isEnterprise = true
+		}
+	}
+
 	// 判断是企业还是企业成员
-	if userAccount.Usertype == 2 {
+	if userAccount.Usertype == 2 && isEnterprise {
 		// UserType=2:企业。原逻辑:根据LoginAccount表"ClientRoleID"查询”ERMCP_MemberFuncMenu“表中该用户对应角色的菜单权限
 		sql := fmt.Sprintf(`select F.* from FUNCMENULIST F where F.MENUTYPE = 3 
 							and 
@@ -836,7 +851,7 @@ func GetErmcpRoleFuncMenuLists(loginID int, resourceCode string) ([]Funcmenulist
 		if err := db.GetEngine().SQL(sql).Find(&funcMenuLists); err != nil {
 			return nil, err
 		}
-	} else if userAccount.Usertype == 7 {
+	} else if userAccount.Usertype == 6 || userAccount.Usertype == 7 || (userAccount.Usertype == 2 && !isEnterprise) {
 		// UserType=7:企业成员
 		// 查询本用户的角色ID  - AreaRole表
 		// 根据 ”ParentuserID ”和 自己的角色查询“ERMCP_MemberFuncMenu“表中的菜单权限

+ 3 - 0
models/ermcpGoods.go

@@ -69,6 +69,9 @@ type ErmcpGoods struct {
 	Goodsquotetype        int64     `json:"goodsquotetype"  xorm:"'GOODSQUOTETYPE'"`               // 合约报价类型: 1-直接报价  2-间接报价
 	Quotegear             int64     `json:"quotegear"  xorm:"'QUOTEGEAR'"`                         // 行情档位(1-10)
 	Outgoodscode          string    `json:"outgoodscode"  xorm:"'OUTGOODSCODE'"`                   // 商品代码(外部)
+	Isvisible             int32     `json:"isvisible"  xorm:"ISVISIBLE"`                           // 游客是否可见 - 0:不可见 1:可见
+	Areauserid            int64     `json:"areauserid"  xorm:"AREAUSERID"`                         // 所属机构
+	Pictureurl            string    `json:"pictureurl"  xorm:"PICTUREURL"`                         // 商品图片
 
 	Relatedgoodsid int32 `json:"relatedgoodsid"  xorm:"RELATEDGOODSID"` // 关联参考商品ID
 

+ 3 - 0
models/goods.go

@@ -54,6 +54,9 @@ type Goods struct {
 	Goodsquotetype        int64     `json:"goodsquotetype"  xorm:"'GOODSQUOTETYPE'"`               // 合约报价类型: 1-直接报价  2-间接报价
 	Quotegear             int64     `json:"quotegear"  xorm:"'QUOTEGEAR'"`                         // 行情档位(1-10)
 	Outgoodscode          string    `json:"outgoodscode"  xorm:"'OUTGOODSCODE'"`                   // 商品代码(外部)
+	Isvisible             int32     `json:"isvisible"  xorm:"ISVISIBLE"`                           // 游客是否可见 - 0:不可见 1:可见
+	Areauserid            int64     `json:"areauserid"  xorm:"AREAUSERID"`                         // 所属机构
+	Pictureurl            string    `json:"pictureurl"  xorm:"PICTUREURL"`                         // 商品图片
 }
 
 // TableName is GOODS