Explorar el Código

增加接口:
1、/Ferroalloy/QueryInvestorLevelGroup 查询查询我推荐的好友等级;
2、/Ferroalloy/QueryTHJFriends 查询好友;
3、/Ferroalloy/QueryTHJProfits 查询收益

zhou.xiaoning hace 2 años
padre
commit
3dbaee4d09
Se han modificado 6 ficheros con 1047 adiciones y 9 borrados
  1. 66 9
      controllers/ferroalloy/mine.go
  2. 268 0
      docs/docs.go
  3. 268 0
      docs/swagger.json
  4. 180 0
      docs/swagger.yaml
  5. 262 0
      models/ferroalloy.go
  6. 3 0
      routers/router.go

+ 66 - 9
controllers/ferroalloy/mine.go

@@ -12,15 +12,15 @@ import (
 
 // QueryMyRefer
 // @Summary  查询我的推荐列表
-// @Produce json
+// @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid query    int true "用户ID"
-// @Param    page     query    int false "页码"
-// @Param    pagesize query    int false "每页条数"
+// @Param    userid      query    int    true  "用户ID"
+// @Param    page        query    int    false "页码"
+// @Param    pagesize    query    int    false "每页条数"
 // @Success  200      {array}  models.MyRefer
-// @Failure 500       {object} app.Response
+// @Failure  500          {object} app.Response
 // @Router   /Ferroalloy/QueryMyRefer [get]
-// @Tags    铁合金
+// @Tags     铁合金
 func QueryMyRefer(c *gin.Context) {
 	a := app.GinUtils{Gin: app.Gin{C: c}}
 	m := models.MyRefer{}
@@ -32,8 +32,8 @@ func QueryMyRefer(c *gin.Context) {
 // @Summary 查询我的注册红包
 // @Produce  json
 // @Param   accountid query    int true "资金账户"
-// @Success 200       {array}  models.RegisterMoney
-// @Failure  500      {object} app.Response
+// @Success 200 {array}  models.RegisterMoney
+// @Failure  500         {object} app.Response
 // @Router  /Ferroalloy/QueryMyRegisterMoney [get]
 // @Tags     铁合金
 func QueryMyRegisterMoney(c *gin.Context) {
@@ -47,7 +47,7 @@ func QueryMyRegisterMoney(c *gin.Context) {
 // @Summary  查询用户等级信息
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid   query    int true  "用户ID"
+// @Param    userid query    int true "用户ID"
 // @Success  200    {array}  models.THJUserLevelInfo
 // @Failure  500    {object} app.Response
 // @Router   /Ferroalloy/QueryUserLevelInfo [get]
@@ -67,3 +67,60 @@ func QueryUserLevelInfo(c *gin.Context) {
 		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
 	}
 }
+
+// QueryInvestorLevelGroup
+// @Summary 查询查询我推荐的好友等级
+// @Produce  json
+// @Success 200       {array}  models.RegisterMoney
+// @Failure 500 {object} app.Response
+// @Router  /Ferroalloy/QueryInvestorLevelGroup [get]
+// @Tags     铁合金
+func QueryInvestorLevelGroup(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.Thjinvestorlevelgroup{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}
+
+// QueryTHJFriends
+// @Summary  查询好友
+// @Produce json
+// @Security ApiKeyAuth
+// @Param    userid       query    int    true  "用户ID"
+// @Param    customername query    string false "客户名称(企业名称),模糊查询"
+// @Param    mobile       query    string false "手机号码(加密存储),加密串精确查询"
+// @Param    levelgroupid query    int    false "等级ID"
+// @Param    page         query    int    false "页码"
+// @Param    pagesize     query    int    false "每页条数"
+// @Success  200          {array}  models.THJFriend
+// @Failure  500      {object} app.Response
+// @Router   /Ferroalloy/QueryTHJFriends [get]
+// @Tags    铁合金
+func QueryTHJFriends(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJFriend{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}
+
+// QueryTHJProfits
+// @Summary  查询收益
+// @Produce json
+// @Security ApiKeyAuth
+// @Param    userid   query    int true  "用户ID"
+// @Param    marketid    query    int    false "市场ID"
+// @Param    accountname query    string false "好友名称,模糊查询"
+// @Param    goods       query    string false "商品代码或商品名称,模糊查询"
+// @Param    marketid    query    int    false "分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)"
+// @Param    page     query    int false "页码"
+// @Param    pagesize query    int false "每页条数"
+// @Success  200         {array}  models.THJProfit
+// @Failure 500       {object} app.Response
+// @Router   /Ferroalloy/QueryTHJProfits [get]
+// @Tags    铁合金
+func QueryTHJProfits(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJProfit{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 268 - 0
docs/docs.go

@@ -7602,6 +7602,34 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryInvestorLevelGroup": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询查询我推荐的好友等级",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.RegisterMoney"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryMyRefer": {
             "get": {
                 "security": [
@@ -7740,6 +7768,78 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJFriends": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询好友",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "客户名称(企业名称),模糊查询",
+                        "name": "customername",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "手机号码(加密存储),加密串精确查询",
+                        "name": "mobile",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "等级ID",
+                        "name": "levelgroupid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJFriend"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJGoodsDetail": {
             "get": {
                 "security": [
@@ -7895,6 +7995,84 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJProfits": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询收益",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "好友名称,模糊查询",
+                        "name": "accountname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品代码或商品名称,模糊查询",
+                        "name": "goods",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJProfit"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJPromotionIncome": {
             "get": {
                 "security": [
@@ -44137,6 +44315,35 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJFriend": {
+            "type": "object",
+            "properties": {
+                "accoutstatus": {
+                    "description": "状态",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "customername": {
+                    "description": "客户名称(企业名称),模糊查询",
+                    "type": "string"
+                },
+                "groupname": {
+                    "description": "分级名称",
+                    "type": "string"
+                },
+                "hasauth": {
+                    "description": "是否已实名认证 - 0:未认证 1:已认证 2:已提交(待审核) 3:已拒绝",
+                    "type": "integer"
+                },
+                "mobile": {
+                    "description": "手机号码(加密存储),加密串精确查询",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJGoodsDetailRsp": {
             "type": "object",
             "properties": {
@@ -44203,6 +44410,67 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJProfit": {
+            "type": "object",
+            "properties": {
+                "brokerprofitrate": {
+                    "description": "会员释出比例",
+                    "type": "string"
+                },
+                "brokerrate": {
+                    "description": "会员比例",
+                    "type": "string"
+                },
+                "buyorselldisplay": {
+                    "description": "方向",
+                    "type": "string"
+                },
+                "chargeamount": {
+                    "description": "手续费总额",
+                    "type": "number"
+                },
+                "firend": {
+                    "description": "下单好友",
+                    "type": "string"
+                },
+                "levelonevalue": {
+                    "description": "一级比例",
+                    "type": "string"
+                },
+                "leveltwovalue": {
+                    "description": "二级比例",
+                    "type": "string"
+                },
+                "marketname": {
+                    "description": "市场",
+                    "type": "string"
+                },
+                "profitamount": {
+                    "description": "分润金额",
+                    "type": "number"
+                },
+                "profitroletypedisplay": {
+                    "description": "分润角色",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号",
+                    "type": "string"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "tradetimedisplay": {
+                    "description": "成交时间",
+                    "type": "string"
+                },
+                "wrstandardname": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJPurchaseTradeDetailRsp": {
             "type": "object",
             "properties": {

+ 268 - 0
docs/swagger.json

@@ -7593,6 +7593,34 @@
                 }
             }
         },
+        "/Ferroalloy/QueryInvestorLevelGroup": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询查询我推荐的好友等级",
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.RegisterMoney"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryMyRefer": {
             "get": {
                 "security": [
@@ -7731,6 +7759,78 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJFriends": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询好友",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "string",
+                        "description": "客户名称(企业名称),模糊查询",
+                        "name": "customername",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "手机号码(加密存储),加密串精确查询",
+                        "name": "mobile",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "等级ID",
+                        "name": "levelgroupid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJFriend"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJGoodsDetail": {
             "get": {
                 "security": [
@@ -7886,6 +7986,84 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJProfits": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询收益",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "用户ID",
+                        "name": "userid",
+                        "in": "query",
+                        "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "市场ID",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "好友名称,模糊查询",
+                        "name": "accountname",
+                        "in": "query"
+                    },
+                    {
+                        "type": "string",
+                        "description": "商品代码或商品名称,模糊查询",
+                        "name": "goods",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)",
+                        "name": "marketid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "页码",
+                        "name": "page",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
+                        "description": "每页条数",
+                        "name": "pagesize",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.THJProfit"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJPromotionIncome": {
             "get": {
                 "security": [
@@ -44128,6 +44306,35 @@
                 }
             }
         },
+        "models.THJFriend": {
+            "type": "object",
+            "properties": {
+                "accoutstatus": {
+                    "description": "状态",
+                    "type": "string"
+                },
+                "createtime": {
+                    "description": "创建时间",
+                    "type": "string"
+                },
+                "customername": {
+                    "description": "客户名称(企业名称),模糊查询",
+                    "type": "string"
+                },
+                "groupname": {
+                    "description": "分级名称",
+                    "type": "string"
+                },
+                "hasauth": {
+                    "description": "是否已实名认证 - 0:未认证 1:已认证 2:已提交(待审核) 3:已拒绝",
+                    "type": "integer"
+                },
+                "mobile": {
+                    "description": "手机号码(加密存储),加密串精确查询",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJGoodsDetailRsp": {
             "type": "object",
             "properties": {
@@ -44194,6 +44401,67 @@
                 }
             }
         },
+        "models.THJProfit": {
+            "type": "object",
+            "properties": {
+                "brokerprofitrate": {
+                    "description": "会员释出比例",
+                    "type": "string"
+                },
+                "brokerrate": {
+                    "description": "会员比例",
+                    "type": "string"
+                },
+                "buyorselldisplay": {
+                    "description": "方向",
+                    "type": "string"
+                },
+                "chargeamount": {
+                    "description": "手续费总额",
+                    "type": "number"
+                },
+                "firend": {
+                    "description": "下单好友",
+                    "type": "string"
+                },
+                "levelonevalue": {
+                    "description": "一级比例",
+                    "type": "string"
+                },
+                "leveltwovalue": {
+                    "description": "二级比例",
+                    "type": "string"
+                },
+                "marketname": {
+                    "description": "市场",
+                    "type": "string"
+                },
+                "profitamount": {
+                    "description": "分润金额",
+                    "type": "number"
+                },
+                "profitroletypedisplay": {
+                    "description": "分润角色",
+                    "type": "string"
+                },
+                "tradeid": {
+                    "description": "成交单号",
+                    "type": "string"
+                },
+                "tradeqty": {
+                    "description": "成交数量",
+                    "type": "integer"
+                },
+                "tradetimedisplay": {
+                    "description": "成交时间",
+                    "type": "string"
+                },
+                "wrstandardname": {
+                    "description": "商品",
+                    "type": "string"
+                }
+            }
+        },
         "models.THJPurchaseTradeDetailRsp": {
             "type": "object",
             "properties": {

+ 180 - 0
docs/swagger.yaml

@@ -18465,6 +18465,27 @@ definitions:
         description: '[参考价]商品单价'
         type: number
     type: object
+  models.THJFriend:
+    properties:
+      accoutstatus:
+        description: 状态
+        type: string
+      createtime:
+        description: 创建时间
+        type: string
+      customername:
+        description: 客户名称(企业名称),模糊查询
+        type: string
+      groupname:
+        description: 分级名称
+        type: string
+      hasauth:
+        description: 是否已实名认证 - 0:未认证 1:已认证 2:已提交(待审核) 3:已拒绝
+        type: integer
+      mobile:
+        description: 手机号码(加密存储),加密串精确查询
+        type: string
+    type: object
   models.THJGoodsDetailRsp:
     properties:
       goodsinfo:
@@ -18512,6 +18533,51 @@ definitions:
         description: 现货商品名称
         type: string
     type: object
+  models.THJProfit:
+    properties:
+      brokerprofitrate:
+        description: 会员释出比例
+        type: string
+      brokerrate:
+        description: 会员比例
+        type: string
+      buyorselldisplay:
+        description: 方向
+        type: string
+      chargeamount:
+        description: 手续费总额
+        type: number
+      firend:
+        description: 下单好友
+        type: string
+      levelonevalue:
+        description: 一级比例
+        type: string
+      leveltwovalue:
+        description: 二级比例
+        type: string
+      marketname:
+        description: 市场
+        type: string
+      profitamount:
+        description: 分润金额
+        type: number
+      profitroletypedisplay:
+        description: 分润角色
+        type: string
+      tradeid:
+        description: 成交单号
+        type: string
+      tradeqty:
+        description: 成交数量
+        type: integer
+      tradetimedisplay:
+        description: 成交时间
+        type: string
+      wrstandardname:
+        description: 商品
+        type: string
+    type: object
   models.THJPurchaseTradeDetail_Date:
     properties:
       depositrate:
@@ -30749,6 +30815,24 @@ paths:
       summary: 获取现货行情
       tags:
       - 铁合金
+  /Ferroalloy/QueryInvestorLevelGroup:
+    get:
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.RegisterMoney'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      summary: 查询查询我推荐的好友等级
+      tags:
+      - 铁合金
   /Ferroalloy/QueryMyRefer:
     get:
       parameters:
@@ -30836,6 +30920,52 @@ paths:
       summary: 查询行情-现货列表
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJFriends:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 客户名称(企业名称),模糊查询
+        in: query
+        name: customername
+        type: string
+      - description: 手机号码(加密存储),加密串精确查询
+        in: query
+        name: mobile
+        type: string
+      - description: 等级ID
+        in: query
+        name: levelgroupid
+        type: integer
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.THJFriend'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询好友
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJGoodsDetail:
     get:
       parameters:
@@ -30933,6 +31063,56 @@ paths:
       summary: 获取产品介绍列表
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJProfits:
+    get:
+      parameters:
+      - description: 用户ID
+        in: query
+        name: userid
+        required: true
+        type: integer
+      - description: 市场ID
+        in: query
+        name: marketid
+        type: integer
+      - description: 好友名称,模糊查询
+        in: query
+        name: accountname
+        type: string
+      - description: 商品代码或商品名称,模糊查询
+        in: query
+        name: goods
+        type: string
+      - description: 分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)
+        in: query
+        name: marketid
+        type: integer
+      - description: 页码
+        in: query
+        name: page
+        type: integer
+      - description: 每页条数
+        in: query
+        name: pagesize
+        type: integer
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.THJProfit'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询收益
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJPromotionIncome:
     get:
       parameters:

+ 262 - 0
models/ferroalloy.go

@@ -1771,3 +1771,265 @@ func (r *Thjspotquoteconfig) GetDataEx() (interface{}, error) {
 	}
 	return sData, nil
 }
+
+func (r *Thjinvestorlevelgroup) calc() {
+
+}
+
+func (r *Thjinvestorlevelgroup) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select t.* from thj_investorlevelgroup t order by t.grouplevel
+	`
+
+	return sqlId.String()
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *Thjinvestorlevelgroup) GetDataEx() (interface{}, error) {
+	e := db.GetEngine()
+	s := e.SQL(r.buildSql())
+	sData := make([]Thjinvestorlevelgroup, 0)
+	if err := s.Find(&sData); err != nil {
+		return nil, err
+	}
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, nil
+}
+
+type THJFriend struct {
+	CUSTOMERNAME string `json:"customername" xorm:"CUSTOMERNAME" form:"customername"` // 客户名称(企业名称),模糊查询
+	MOBILE       string `json:"mobile" xorm:"MOBILE" form:"mobile"`                   // 手机号码(加密存储),加密串精确查询
+	CREATETIME   string `json:"createtime" xorm:"CREATETIME"`                         // 创建时间
+
+	GROUPNAME string `json:"groupname" xorm:"GROUPNAME"` // 分级名称
+
+	ACCOUTSTATUS string `json:"accoutstatus" xorm:"ACCOUTSTATUS"` // 状态
+
+	HASAUTH int32 `json:"hasauth" xorm:"HASAUTH"` // 是否已实名认证 - 0:未认证 1:已认证 2:已提交(待审核) 3:已拒绝
+
+	USERID       int64 `json:"-" xorm:"-" form:"userid" binding:"required"` // 用户ID
+	LEVELGROUPID int64 `json:"-" xorm:"-" form:"levelgroupid"`              // 等级ID
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *THJFriend) calc() {
+
+}
+
+func (r *THJFriend) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.CUSTOMERNAME,
+		t.MOBILE,
+		g.GROUPNAME,
+		ed.enumdicname ACCOUTSTATUS,
+		ua.HASAUTH,
+		t.CREATETIME
+	from userinfo t
+	inner join useraccount ua on t.userid = ua.userid
+	left join THJ_UserAccount thjua on t.userid = thjua.userid
+	left join thj_investorlevelgroup g on thjua.levelgroupid = g.levelgroupid
+	left join enumdicitem ed on ed.enumdiccode = 'accountstatus' and ua.accountstatus = ed.enumitemname
+	where ua.refereeuserid = %v
+	`
+	sqlId.FormatParam(r.USERID)
+	sqlId.AndLike("t.customername", r.CUSTOMERNAME)
+	sqlId.AndEx("t.mobile", r.MOBILE, r.MOBILE != "")
+	sqlId.AndEx("g.levelgroupid", r.LEVELGROUPID, r.LEVELGROUPID != 0)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *THJFriend) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]THJFriend, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}
+
+type THJProfit struct {
+	Marketname            string  `json:"marketname" xorm:"marketname"`                       // 市场
+	Firend                string  `json:"firend" xorm:"firend"`                               // 下单好友
+	Buyorselldisplay      string  `json:"buyorselldisplay" xorm:"buyorselldisplay"`           // 方向
+	Wrstandardname        string  `json:"wrstandardname" xorm:"wrstandardname"`               // 商品
+	Tradeqty              int     `json:"tradeqty" xorm:"tradeqty"`                           // 成交数量
+	Chargeamount          float64 `json:"chargeamount" xorm:"chargeamount"`                   // 手续费总额
+	Profitamount          float64 `json:"profitamount" xorm:"profitamount"`                   // 分润金额
+	Profitroletypedisplay string  `json:"profitroletypedisplay" xorm:"profitroletypedisplay"` // 分润角色
+	Brokerrate            string  `json:"brokerrate" xorm:"brokerrate"`                       // 会员比例
+	Brokerprofitrate      string  `json:"brokerprofitrate" xorm:"brokerprofitrate"`           // 会员释出比例
+	Levelonevalue         string  `json:"levelonevalue" xorm:"levelonevalue"`                 // 一级比例
+	Leveltwovalue         string  `json:"leveltwovalue" xorm:"leveltwovalue"`                 // 二级比例
+	Tradeid               string  `json:"tradeid" xorm:"tradeid"`                             // 成交单号
+	Tradetimedisplay      string  `json:"tradetimedisplay" xorm:"tradetimedisplay"`           // 成交时间
+
+	USERID         int64  `json:"-" xorm:"-" form:"userid" binding:"required"` // 用户ID
+	MarketID       int    `json:"-" xorm:"-" form:"marketid"`                  // 市场ID
+	Accountname    string `json:"-" xorm:"-" form:"accountname"`               // 好友名称,模糊查询
+	Goods          string `json:"-" xorm:"-" form:"goods"`                     // 商品代码或商品名称,模糊查询
+	PROFITROLETYPE int32  `json:"-" xorm:"-" form:"profitroletype"`            // 分润机构角色 - 1:平台 2:经纪会员 3:一级交易商 4:二级交易商(枚举:THJProfitRoleType)
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *THJProfit) calc() {
+
+}
+
+func (r *THJProfit) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		m1.enumdicname "marketname",
+
+       ua2.accountname "firend",
+
+       m2.enumdicname "buyorselldisplay",
+
+       wr.wrstandardcode || '/' || wr.wrstandardname "wrstandardname",
+
+       htd.tradeqty "tradeqty",
+
+       t.chargeamount "chargeamount",
+
+       t.profitamount "profitamount",
+
+       m4.enumdicname "profitroletypedisplay",
+
+       to_char(t.brokerrate * 100, 'fm999999990.00') || '%' "brokerrate",
+
+       to_char(t.brokerprofitrate * 100, 'fm999999990.00') || '%' "brokerprofitrate",
+
+       case t.levelonealgorithm
+
+         when 0 then
+
+          '-'
+
+         when 1 then
+
+          '比例/' || to_char(to_char(t.levelonevalue * 100, 'fm999999990.00')) || ' %'
+
+         else
+
+          '固定/' || to_char(t.levelonevalue, 'fm999999990.00')
+
+       end "levelonevalue",
+
+       case t.leveltwoalgorithm
+
+         when 0 then
+
+          '-'
+
+         when 1 then
+
+          '比例/' || to_char(to_char(t.leveltwovalue * 100, 'fm999999990.00')) || ' %'
+
+         else
+
+          '固定/' || to_char(t.leveltwovalue, 'fm999999990.00')
+
+       end "leveltwovalue",
+
+       to_char(t.tradetime, 'yyyy-MM-dd hh24:mi:ss') "tradetimedisplay",
+
+       to_char(t.tradeid) "tradeid"
+
+  from THJ_Reckon_ProfitRecode t
+
+  left join enumdicitem m1
+
+    on m1.enumdiccode = 'THJMarket'
+
+   and t.marketid = m1.enumitemname
+
+  left join enumdicitem m2
+
+    on m2.enumdiccode = 'buyOrSell'
+
+   and t.buyorsell = m2.enumitemname
+
+  left join enumdicitem m4
+
+    on m4.enumdiccode = 'THJProfitRoleType'
+
+   and t.profitroletype = m4.enumitemname
+
+  left join wrstandard wr
+
+    on t.wrstandardid = wr.wrstandardid
+
+  left join useraccount ua
+
+    on ua.userid = t.userid
+
+  left join (select a.transferid  tradeid,
+
+                    1             buyorsell,
+
+                    a.selluserid  userid,
+
+                    a.transferqty tradeqty
+
+               from THJ_PurchaseTransfer a
+
+             union
+
+             select a2.wrtradedetailid tradeid,
+
+                    a2.buyorsell       buyorsell,
+
+                    ta2.userid         userid,
+
+                    a2.tradeqty        tradeqty
+
+               from his_wrtrade_tradedetail a2
+
+               left join taaccount ta2
+
+                 on a2.accountid = ta2.accountid
+
+              where a2.isvaliddata = 1) htd
+
+    on t.tradeid = htd.tradeid
+
+   and t.buyorsell = htd.buyorsell
+
+  left join useraccount ua2
+
+    on ua2.userid = htd.userid
+
+ where 1=1 
+ `
+
+	// sqlId.FormatParam(r.USERID)  // 发生错误 %!v(MISSING)
+	// sqlId = utils.SQLVal(fmt.Sprintf(string(sqlId), r.USERID))
+	sqlId.AndEx("t.userid", r.USERID, r.USERID != 0)
+	sqlId.AndEx("t.marketid", r.MarketID, r.MarketID != 0)
+	sqlId.AndLike("ua2.accountname", r.Accountname)
+	sqlId.AndLikes2("wr.wrstandardcode", "wr.wrstandardname", r.Goods)
+	sqlId.AndEx(" t.profitroletype", r.PROFITROLETYPE, r.PROFITROLETYPE != 0)
+	sqlId.OrderByDesc("t.tradetime")
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *THJProfit) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]THJProfit, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	total := 0
+	for i := range sData {
+		sData[i].calc()
+		total = sData[i].Total
+	}
+	return sData, err, r.Page, r.PageSize, total
+}

+ 3 - 0
routers/router.go

@@ -716,6 +716,9 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryUserLevelInfo", ferroalloy.QueryUserLevelInfo)
 		ferroalloyR.Use(token.Auth()).GET("QuerySpotgoodsPrice", ferroalloy.QuerySpotgoodsPrice)
 		ferroalloyR.Use(token.Auth()).GET("QueryThjSpotQuoteConfig", ferroalloy.QueryThjSpotQuoteConfig)
+		ferroalloyR.Use(token.Auth()).GET("QueryInvestorLevelGroup", ferroalloy.QueryInvestorLevelGroup)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJFriends", ferroalloy.QueryTHJFriends)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJProfits", ferroalloy.QueryTHJProfits)
 	}
 
 	return r