Prechádzať zdrojové kódy

增加接口 /Common/QueryMemberGoodsLimitConfig 查询会员商品限制配置表

zhou.xiaoning 2 rokov pred
rodič
commit
33f3462a61

+ 16 - 0
controllers/common/common.go

@@ -254,3 +254,19 @@ func GetServerTime(c *gin.Context) {
 	logger.GetLogger().Debugln("GetServerTime successed: %v", rst)
 	appG.Response(http.StatusOK, e.SUCCESS, rst)
 }
+
+// QueryMemberGoodsLimitConfig
+// @Summary 查询会员商品限制配置表
+// @Produce json
+// @Param   userid   query    int true "用户ID"
+// @Param   roletype query    int true "会员角色 - 6:自营会员 7:经纪会员"
+// @Success 200      {array}  models.Membergoodslimitconfig
+// @Failure 500      {object} app.Response
+// @Router  /Common/QueryMemberGoodsLimitConfig [get]
+// @Tags    通用服务
+func QueryMemberGoodsLimitConfig(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Membergoodslimitconfig{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 85 - 4
docs/docs.go

@@ -945,6 +945,50 @@ const docTemplate = `{
                 }
             }
         },
+        "/Common/QueryMemberGoodsLimitConfig": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "查询会员商品限制配置表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "会员角色 - 6:自营会员 7:经纪会员",
+                        "name": "roletype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Membergoodslimitconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/QueryNewContents": {
             "get": {
                 "produces": [
@@ -40070,10 +40114,6 @@ const docTemplate = `{
                 "loginid"
             ],
             "properties": {
-                "accountname": {
-                    "description": "账户名称",
-                    "type": "string"
-                },
                 "canoutin": {
                     "description": "是否可出入金 - 0:不可 1:可",
                     "type": "integer"
@@ -40496,6 +40536,47 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Membergoodslimitconfig": {
+            "type": "object",
+            "required": [
+                "roletype",
+                "userid"
+            ],
+            "properties": {
+                "autoid": {
+                    "description": "AutoID(SEQ_MEMBERGOODSLIMITCONFIG)",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "iscannotbuy": {
+                    "description": "是否不能挂买 0:否 1:是",
+                    "type": "integer"
+                },
+                "iscannotsell": {
+                    "description": "是否不能挂卖 0:否 1:是",
+                    "type": "integer"
+                },
+                "isnodisplay": {
+                    "description": "是否显示 0:否 1:是",
+                    "type": "integer"
+                },
+                "roletype": {
+                    "description": "会员角色 - 6:自营会员 7:经纪会员",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "会员用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Messageboard": {
             "type": "object",
             "required": [

+ 85 - 4
docs/swagger.json

@@ -936,6 +936,50 @@
                 }
             }
         },
+        "/Common/QueryMemberGoodsLimitConfig": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "通用服务"
+                ],
+                "summary": "查询会员商品限制配置表",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "会员角色 - 6:自营会员 7:经纪会员",
+                        "name": "roletype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Membergoodslimitconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Common/QueryNewContents": {
             "get": {
                 "produces": [
@@ -40061,10 +40105,6 @@
                 "loginid"
             ],
             "properties": {
-                "accountname": {
-                    "description": "账户名称",
-                    "type": "string"
-                },
                 "canoutin": {
                     "description": "是否可出入金 - 0:不可 1:可",
                     "type": "integer"
@@ -40487,6 +40527,47 @@
                 }
             }
         },
+        "models.Membergoodslimitconfig": {
+            "type": "object",
+            "required": [
+                "roletype",
+                "userid"
+            ],
+            "properties": {
+                "autoid": {
+                    "description": "AutoID(SEQ_MEMBERGOODSLIMITCONFIG)",
+                    "type": "integer"
+                },
+                "goodsid": {
+                    "description": "商品ID",
+                    "type": "integer"
+                },
+                "iscannotbuy": {
+                    "description": "是否不能挂买 0:否 1:是",
+                    "type": "integer"
+                },
+                "iscannotsell": {
+                    "description": "是否不能挂卖 0:否 1:是",
+                    "type": "integer"
+                },
+                "isnodisplay": {
+                    "description": "是否显示 0:否 1:是",
+                    "type": "integer"
+                },
+                "roletype": {
+                    "description": "会员角色 - 6:自营会员 7:经纪会员",
+                    "type": "integer"
+                },
+                "updatetime": {
+                    "description": "更新时间",
+                    "type": "string"
+                },
+                "userid": {
+                    "description": "会员用户ID",
+                    "type": "integer"
+                }
+            }
+        },
         "models.Messageboard": {
             "type": "object",
             "required": [

+ 59 - 3
docs/swagger.yaml

@@ -13489,9 +13489,6 @@ definitions:
     type: object
   models.Loginaccount:
     properties:
-      accountname:
-        description: 账户名称
-        type: string
       canoutin:
         description: 是否可出入金 - 0:不可 1:可
         type: integer
@@ -13819,6 +13816,36 @@ definitions:
     - tradedate
     - tradedate2
     type: object
+  models.Membergoodslimitconfig:
+    properties:
+      autoid:
+        description: AutoID(SEQ_MEMBERGOODSLIMITCONFIG)
+        type: integer
+      goodsid:
+        description: 商品ID
+        type: integer
+      iscannotbuy:
+        description: 是否不能挂买 0:否 1:是
+        type: integer
+      iscannotsell:
+        description: 是否不能挂卖 0:否 1:是
+        type: integer
+      isnodisplay:
+        description: 是否显示 0:否 1:是
+        type: integer
+      roletype:
+        description: 会员角色 - 6:自营会员 7:经纪会员
+        type: integer
+      updatetime:
+        description: 更新时间
+        type: string
+      userid:
+        description: 会员用户ID
+        type: integer
+    required:
+    - roletype
+    - userid
+    type: object
   models.Messageboard:
     properties:
       contactnum:
@@ -30496,6 +30523,35 @@ paths:
       summary: 查询轮播图配置信息
       tags:
       - 通用服务
+  /Common/QueryMemberGoodsLimitConfig:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 会员角色 - 6:自营会员 7:经纪会员
+        in: query
+        name: roletype
+        required: true
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Membergoodslimitconfig'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 查询会员商品限制配置表
+      tags:
+      - 通用服务
   /Common/QueryNewContents:
     get:
       parameters:

+ 51 - 0
models/common.go

@@ -1346,3 +1346,54 @@ func GetJ10News(limit int) (datas []GetJ10NewsRsp, err error) {
 
 	return
 }
+
+// Membergoodslimitconfig 会员商品限制配置表(不显示、不能交易的权限)
+type Membergoodslimitconfig struct {
+	AUTOID       int64     `json:"autoid" xorm:"AUTOID"`                                          // AutoID(SEQ_MEMBERGOODSLIMITCONFIG)
+	USERID       int64     `json:"userid" xorm:"USERID" form:"userid" binding:"required"`         // 会员用户ID
+	ROLETYPE     int32     `json:"roletype" xorm:"ROLETYPE"  form:"roletype"  binding:"required"` // 会员角色 - 6:自营会员 7:经纪会员
+	GOODSID      int64     `json:"goodsid" xorm:"GOODSID"`                                        // 商品ID
+	ISNODISPLAY  int32     `json:"isnodisplay" xorm:"ISNODISPLAY"`                                // 是否显示 0:否 1:是
+	ISCANNOTBUY  int32     `json:"iscannotbuy" xorm:"ISCANNOTBUY"`                                // 是否不能挂买 0:否 1:是
+	ISCANNOTSELL int32     `json:"iscannotsell" xorm:"ISCANNOTSELL"`                              // 是否不能挂卖 0:否 1:是
+	UPDATETIME   time.Time `json:"updatetime" xorm:"UPDATETIME"`                                  // 更新时间
+}
+
+func (r *Membergoodslimitconfig) calc() {
+
+}
+
+func (r *Membergoodslimitconfig) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.autoid,
+		t.userid,
+		t.roletype,
+		t.goodsid,
+		t.isnodisplay,
+		t.iscannotbuy,
+		t.iscannotsell,
+		t.updatetime
+	from Membergoodslimitconfig t 
+	where 1=1 
+	`
+
+	sqlId.And("t.userid", r.USERID)
+	sqlId.And("t.roletype", r.ROLETYPE)
+
+	return sqlId.String()
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *Membergoodslimitconfig) GetDataEx() (interface{}, error) {
+	e := db.GetEngine()
+	s := e.SQL(r.buildSql())
+	sData := make([]Membergoodslimitconfig, 0)
+	if err := s.Find(&sData); err != nil {
+		return nil, err
+	}
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, nil
+}

+ 1 - 0
routers/router.go

@@ -164,6 +164,7 @@ func InitRouter() *gin.Engine {
 		commonR.Use(token.Auth()).GET("/GetClientNewFuncmenu", common.GetClientNewFuncmenu)
 
 		commonR.Use(token.Auth()).GET("/QueryRates", common.QueryRates)
+		commonR.Use(token.Auth()).GET("/QueryMemberGoodsLimitConfig", common.QueryMemberGoodsLimitConfig)
 	}
 	// ************************ 通用市场 ************************
 	marketR := apiR.Group("Market")