Jelajahi Sumber

Merge branch 'master' of 192.168.30.132:MTP2.0/MTP20_IF

zou.yingbin 4 tahun lalu
induk
melakukan
8ed1117356
5 mengubah file dengan 5312 tambahan dan 4842 penghapusan
  1. 11 0
      controllers/user/user.go
  2. 2198 2347
      docs/docs.go
  3. 2198 2347
      docs/swagger.json
  4. 879 133
      docs/swagger.yaml
  5. 26 15
      models/account.go

+ 11 - 0
controllers/user/user.go

@@ -233,6 +233,7 @@ type LoginQueryRsp struct {
 	LoginAccount      models.Loginaccount       `json:"loginAccount"`      // 登录账号
 	UserAccount       models.Useraccount        `json:"userAccount"`       // 用户账号
 	UserInfo          models.Userinfo           `json:"userInfo"`          // 用户信息
+	AreaRoles         []models.Arearole         `json:"areaRoles"`         // 所属角色信息
 	Markets           []models.Market           `json:"markets"`           // 市场
 	Goodsgroups       []models.Goodsgroup       `json:"goodsgroups"`       // 商品组
 	ExternalExchanges []models.Externalexchange `json:"externalExchanges"` // 外部交易所
@@ -287,6 +288,16 @@ func LoginQuery(c *gin.Context) {
 		return
 	}
 	rsp.UserInfo = *userInfo
+	// 角色信息
+	var areaRole models.Arearole
+	areaRoles, err := areaRole.GetAreaRolesByUserID(int(loginAccount.Userid))
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("LoginQuery failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	rsp.AreaRoles = areaRoles
 	// 有权限的市场
 	markets, err := models.GetMarketsByLoginID(req.LoginID)
 	if err != nil {

File diff ditekan karena terlalu besar
+ 2198 - 2347
docs/docs.go


File diff ditekan karena terlalu besar
+ 2198 - 2347
docs/swagger.json


File diff ditekan karena terlalu besar
+ 879 - 133
docs/swagger.yaml


+ 26 - 15
models/account.go

@@ -285,21 +285,21 @@ 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:顶级机构
-	Tradeaccountid int64     `json:"tradeaccountid"  xorm:"'TRADEACCOUNTID'"`        // 默认交易资金账号ID(做市会员被动接单使用、商城店铺默认资金账 号、圈内会员默认资金账号)  - 作废, 使用UserReckonAccount
-	Createtime     time.Time `json:"createtime"  xorm:"'CREATETIME'"`                // 创建时间
-	Creatorid      int64     `json:"creatorid"  xorm:"'CREATORID'"`                  // 创建人ID
-	Modifytime     time.Time `json:"modifytime"  xorm:"'MODIFYTIME'"`                // 修改时间
-	Modifierid     int64     `json:"modifierid"  xorm:"'MODIFIERID'"`                // 修改人ID
-	Shoppassword   string    `json:"shoppassword"  xorm:"'SHOPPASSWORD'"`            // 商城店铺登陆密码(商城店铺角色使用)
-	Isreturnscore  int32     `json:"isreturnscore"  xorm:"'ISRETURNSCORE'"`          // 是否返还积分 [经纪会员-辽东湾] - 0:不返还 1:返还
-	Transurl       string    `json:"transurl"  xorm:"'TRANSURL'"`                    // 物流地址(物流机构)
-	Outuserid      string    `json:"outuserid"  xorm:"'OUTUSERID'"`                  // 外部账户[场外期权做市商]
-	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:交易员
+	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:交易员
+	Tradeaccountid int64     `json:"tradeaccountid"  xorm:"TRADEACCOUNTID"`        // 默认交易资金账号ID(做市会员被动接单使用、商城店铺默认资金账 号、圈内会员默认资金账号)  - 作废, 使用UserReckonAccount
+	Createtime     time.Time `json:"createtime"  xorm:"CREATETIME"`                // 创建时间
+	Creatorid      int64     `json:"creatorid"  xorm:"CREATORID"`                  // 创建人ID
+	Modifytime     time.Time `json:"modifytime"  xorm:"MODIFYTIME"`                // 修改时间
+	Modifierid     int64     `json:"modifierid"  xorm:"MODIFIERID"`                // 修改人ID
+	Shoppassword   string    `json:"shoppassword"  xorm:"SHOPPASSWORD"`            // 商城店铺登陆密码(商城店铺角色使用)
+	Isreturnscore  int32     `json:"isreturnscore"  xorm:"ISRETURNSCORE"`          // 是否返还积分 [经纪会员-辽东湾] - 0:不返还 1:返还
+	Transurl       string    `json:"transurl"  xorm:"TRANSURL"`                    // 物流地址(物流机构)
+	Outuserid      string    `json:"outuserid"  xorm:"OUTUSERID"`                  // 外部账户[场外期权做市商]
+	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:交易员
 }
 
 // TableName is AREAROLE
@@ -307,6 +307,17 @@ func (Arearole) TableName() string {
 	return "AREAROLE"
 }
 
+// 获取目标账号的相关角色信息
+func (r *Arearole) GetAreaRolesByUserID(UserID int) ([]Arearole, error) {
+	areaRoles := make([]Arearole, 0)
+
+	if err := db.GetEngine().Where("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)

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini