Selaa lähdekoodia

查询我的推广-推广收益 接口增加入参

zhou.xiaoning 3 vuotta sitten
vanhempi
commit
7c0c3e58e1
5 muutettua tiedostoa jossa 40 lisäystä ja 19 poistoa
  1. 9 8
      controllers/ferroalloy/trade.go
  2. 7 1
      docs/docs.go
  3. 7 1
      docs/swagger.json
  4. 5 1
      docs/swagger.yaml
  5. 12 8
      models/ferroalloy.go

+ 9 - 8
controllers/ferroalloy/trade.go

@@ -11,12 +11,12 @@ import (
 // @Summary  查询我的订单-采购订单
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid   query    int    true  "用户ID"
+// @Param    userid       query    int true  "用户ID"
 // @Param    type     query    int false "类型 - 0:未完成 1:已完成"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page         query    int false "页码"
+// @Param    pagesize     query    int false "每页条数"
 // @Success  200      {array}  models.Thjpurchasetradedetail
-// @Failure  500      {object} app.Response
+// @Failure  500          {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPurchaseTradeDetail [get]
 // @Tags     铁合金
 func QueryTHJPurchaseTradeDetail(c *gin.Context) {
@@ -30,10 +30,10 @@ func QueryTHJPurchaseTradeDetail(c *gin.Context) {
 // @Summary  获取我的推广-交易数据
 // @Produce  json
 // @Security ApiKeyAuth
-// @Param    userid   query    int true  "用户ID"
+// @Param    userid   query    int    true  "用户ID"
 // @Param    marketid query    int true  "市场ID 采购-64201 供求-65201"
-// @Param    page     query    int false "页码"
-// @Param    pagesize query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200      {array}  models.THJTradeData
 // @Failure  500      {object} app.Response
 // @Router   /Ferroalloy/QueryTHJTradeData [get]
@@ -68,9 +68,10 @@ func QueryTHJPurchaseTransferOrder(c *gin.Context) {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    userid   query    int true  "用户ID"
+// @Param    profitstatus query    int false "状态 - 0:全部 1:已支付 2:未支付"
 // @Param    page     query    int false "页码"
 // @Param    pagesize query    int false "每页条数"
-// @Success  200      {array}  models.PromotionIncome
+// @Success  200          {array}  models.PromotionIncome
 // @Failure  500      {object} app.Response
 // @Router   /Ferroalloy/QueryTHJPromotionIncome [get]
 // @Tags     铁合金

+ 7 - 1
docs/docs.go

@@ -7819,6 +7819,12 @@ const docTemplate = `{
                     },
                     {
                         "type": "integer",
+                        "description": "状态 - 0:全部 1:已支付 2:未支付",
+                        "name": "profitstatus",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"
@@ -34997,7 +35003,7 @@ const docTemplate = `{
                     "type": "string"
                 },
                 "profitstatus": {
-                    "description": "状态 - 1:已支付 2:未支付",
+                    "description": "状态 - 0:全部 1:已支付 2:未支付",
                     "type": "integer"
                 },
                 "sumamount": {

+ 7 - 1
docs/swagger.json

@@ -7810,6 +7810,12 @@
                     },
                     {
                         "type": "integer",
+                        "description": "状态 - 0:全部 1:已支付 2:未支付",
+                        "name": "profitstatus",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"
@@ -34988,7 +34994,7 @@
                     "type": "string"
                 },
                 "profitstatus": {
-                    "description": "状态 - 1:已支付 2:未支付",
+                    "description": "状态 - 0:全部 1:已支付 2:未支付",
                     "type": "integer"
                 },
                 "sumamount": {

+ 5 - 1
docs/swagger.yaml

@@ -12808,7 +12808,7 @@ definitions:
         description: 时间
         type: string
       profitstatus:
-        description: 状态 - 1:已支付 2:未支付
+        description: 状态 - 0:全部 1:已支付 2:未支付
         type: integer
       sumamount:
         description: 金额
@@ -29038,6 +29038,10 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 状态 - 0:全部 1:已支付 2:未支付
+        in: query
+        name: profitstatus
+        type: integer
       - description: 页码
         in: query
         name: page

+ 12 - 8
models/ferroalloy.go

@@ -1293,12 +1293,12 @@ func (r *Thjpurchasetransfer) GetDataByPage() (interface{}, error, int, int, int
 }
 
 type PromotionIncome struct {
-	PROFITMONTH    string  `json:"profitmonth" xorm:"PROFITMONTH"`       // 时间
-	WRSTANDARDID   int32   `json:"wrstandardid" xorm:"WRSTANDARDID"`     // 现货商品ID
-	WRSTANDARDCODE string  `json:"wrstandardcode" xorm:"WRSTANDARDCODE"` // 现货商品代码
-	WRSTANDARDNAME string  `json:"wrstandardname" xorm:"WRSTANDARDNAME"` // 现货商品名称
-	SUMAMOUNT      float64 `json:"sumamount" xorm:"SUMAMOUNT"`           // 金额
-	PROFITSTATUS   int32   `json:"profitstatus" xorm:"PROFITSTATUS"`     // 状态 - 1:已支付 2:未支付
+	PROFITMONTH    string  `json:"profitmonth" xorm:"PROFITMONTH"`                       // 时间
+	WRSTANDARDID   int32   `json:"wrstandardid" xorm:"WRSTANDARDID"`                     // 现货商品ID
+	WRSTANDARDCODE string  `json:"wrstandardcode" xorm:"WRSTANDARDCODE"`                 // 现货商品代码
+	WRSTANDARDNAME string  `json:"wrstandardname" xorm:"WRSTANDARDNAME"`                 // 现货商品名称
+	SUMAMOUNT      float64 `json:"sumamount" xorm:"SUMAMOUNT"`                           // 金额
+	PROFITSTATUS   int32   `json:"profitstatus" xorm:"PROFITSTATUS" form:"profitstatus"` // 状态 - 0:全部 1:已支付 2:未支付
 
 	USERID int64 `json:"-" xorm:"-" form:"userid" binding:"required"` // 用户ID
 
@@ -1319,11 +1319,15 @@ func (r *PromotionIncome) buildSql() string {
 		sum(t.profitamount) SUMAMOUNT
 	from THJ_Reckon_ProfitSum t
 	left join wrstandard wr on t.wrstandardid = wr.wrstandardid
-	where t.userid = %v and t.profitstatus = 1
+	where t.userid = %v and %v
 	group by substr(t.reckondate, 0, 6), t.wrstandardid, wr.wrstandardname
 	order by substr(t.reckondate, 0, 6) desc, t.wrstandardid, wr.wrstandardname
 `
-	sqlId.FormatParam(r.USERID)
+	param := "1=1"
+	if r.PROFITSTATUS > 0 {
+		param = fmt.Sprintf("t.profitstatus = %v", r.PROFITSTATUS)
+	}
+	sqlId.FormatParam(r.USERID, param)
 
 	sqlId.Page(r.Page, r.PageSize)
 	return sqlId.String()