Jelajahi Sumber

1、增加积分配置查询接口;
2、我的积分流水增加入参和出参。

zhou.xiaoning 3 tahun lalu
induk
melakukan
cba85460cf
7 mengubah file dengan 309 tambahan dan 8 penghapusan
  1. 29 3
      controllers/ferroalloy/score.go
  2. 92 0
      docs/docs.go
  3. 92 0
      docs/swagger.json
  4. 66 0
      docs/swagger.yaml
  5. 26 3
      models/ferroalloy.go
  6. 3 2
      models/ori.go
  7. 1 0
      routers/router.go

+ 29 - 3
controllers/ferroalloy/score.go

@@ -44,9 +44,10 @@ func Signin(c *gin.Context) {
 // @Summary  查询我的积分流水
 // @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    stype    query    string false "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200      {array}  models.GThjuserscorelog
 // @Failure  500      {object} app.Response
 // @Router   /Ferroalloy/QueryUserScoreLog [get]
@@ -57,3 +58,28 @@ func QueryUserScoreLog(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryTHJScoreConfig
+// @Summary  查询积分配置
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    stype query    string false "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置"
+// @Success  200   {array}  models.Thjscoreconfig
+// @Failure  500   {object} app.Response
+// @Router   /Ferroalloy/QueryTHJScoreConfig [get]
+// @Tags     铁合金
+func QueryTHJScoreConfig(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.ThjscoreconfigReq{}
+	if err := a.C.ShouldBind(&m); err != nil {
+		a.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
+		return
+	}
+
+	if rsp, err := m.Get(); err == nil {
+		a.Gin.Response(http.StatusOK, e.SUCCESS, rsp)
+	} else {
+		logger.GetLogger().Errorf("query fail, %v", err)
+		a.Gin.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+	}
+}

+ 92 - 0
docs/docs.go

@@ -7747,6 +7747,47 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryTHJScoreConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询积分配置",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                        "name": "stype",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Thjscoreconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJWrstandard": {
             "get": {
                 "security": [
@@ -7865,6 +7906,12 @@ const docTemplate = `{
                         "required": true
                     },
                     {
+                        "type": "string",
+                        "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                        "name": "stype",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
                         "description": "页码",
                         "name": "page",
@@ -30210,6 +30257,10 @@ const docTemplate = `{
                     "description": "记账时间",
                     "type": "string"
                 },
+                "redpacketvalue": {
+                    "description": "红包值【抽奖】",
+                    "type": "number"
+                },
                 "score": {
                     "description": "变动积分",
                     "type": "number"
@@ -30217,6 +30268,10 @@ const docTemplate = `{
                 "scoreconfigtype": {
                     "description": "配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
                     "type": "integer"
+                },
+                "stype": {
+                    "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                    "type": "string"
                 }
             }
         },
@@ -40384,6 +40439,43 @@ const docTemplate = `{
                 }
             }
         },
+        "models.Thjscoreconfig": {
+            "type": "object",
+            "properties": {
+                "parma1": {
+                    "description": "参数1",
+                    "type": "integer"
+                },
+                "parma2": {
+                    "description": "参数2",
+                    "type": "integer"
+                },
+                "parma3": {
+                    "description": "参数3",
+                    "type": "integer"
+                },
+                "parma4": {
+                    "description": "参数4",
+                    "type": "integer"
+                },
+                "parma5": {
+                    "description": "参数5",
+                    "type": "integer"
+                },
+                "parma6": {
+                    "description": "参数6",
+                    "type": "integer"
+                },
+                "parma7": {
+                    "description": "参数6",
+                    "type": "integer"
+                },
+                "scoreconfigtype": {
+                    "description": "积分配置类型 - 1:注册送红包 2:签到送积分 3:推广送积分 4:下级用户下单送积分 5:自己采购下单送积分 6:自己供求下单送积分 7:抽奖得红包",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdHolderDetailTradeInfo": {
             "type": "object",
             "properties": {

+ 92 - 0
docs/swagger.json

@@ -7738,6 +7738,47 @@
                 }
             }
         },
+        "/Ferroalloy/QueryTHJScoreConfig": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询积分配置",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                        "name": "stype",
+                        "in": "query"
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.Thjscoreconfig"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryTHJWrstandard": {
             "get": {
                 "security": [
@@ -7856,6 +7897,12 @@
                         "required": true
                     },
                     {
+                        "type": "string",
+                        "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                        "name": "stype",
+                        "in": "query"
+                    },
+                    {
                         "type": "integer",
                         "description": "页码",
                         "name": "page",
@@ -30201,6 +30248,10 @@
                     "description": "记账时间",
                     "type": "string"
                 },
+                "redpacketvalue": {
+                    "description": "红包值【抽奖】",
+                    "type": "number"
+                },
                 "score": {
                     "description": "变动积分",
                     "type": "number"
@@ -30208,6 +30259,10 @@
                 "scoreconfigtype": {
                     "description": "配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
                     "type": "integer"
+                },
+                "stype": {
+                    "description": "[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置",
+                    "type": "string"
                 }
             }
         },
@@ -40375,6 +40430,43 @@
                 }
             }
         },
+        "models.Thjscoreconfig": {
+            "type": "object",
+            "properties": {
+                "parma1": {
+                    "description": "参数1",
+                    "type": "integer"
+                },
+                "parma2": {
+                    "description": "参数2",
+                    "type": "integer"
+                },
+                "parma3": {
+                    "description": "参数3",
+                    "type": "integer"
+                },
+                "parma4": {
+                    "description": "参数4",
+                    "type": "integer"
+                },
+                "parma5": {
+                    "description": "参数5",
+                    "type": "integer"
+                },
+                "parma6": {
+                    "description": "参数6",
+                    "type": "integer"
+                },
+                "parma7": {
+                    "description": "参数6",
+                    "type": "integer"
+                },
+                "scoreconfigtype": {
+                    "description": "积分配置类型 - 1:注册送红包 2:签到送积分 3:推广送积分 4:下级用户下单送积分 5:自己采购下单送积分 6:自己供求下单送积分 7:抽奖得红包",
+                    "type": "integer"
+                }
+            }
+        },
         "models.TjmdHolderDetailTradeInfo": {
             "type": "object",
             "properties": {

+ 66 - 0
docs/swagger.yaml

@@ -9690,6 +9690,9 @@ definitions:
       createtime:
         description: 记账时间
         type: string
+      redpacketvalue:
+        description: 红包值【抽奖】
+        type: number
       score:
         description: 变动积分
         type: number
@@ -9697,6 +9700,10 @@ definitions:
         description: 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分
           7:抽奖配置
         type: integer
+      stype:
+        description: '[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分
+          6:自己供求下单积分 7:抽奖配置'
+        type: string
     type: object
   models.GZGoods:
     properties:
@@ -17208,6 +17215,34 @@ definitions:
     required:
     - buyuserid
     type: object
+  models.Thjscoreconfig:
+    properties:
+      parma1:
+        description: 参数1
+        type: integer
+      parma2:
+        description: 参数2
+        type: integer
+      parma3:
+        description: 参数3
+        type: integer
+      parma4:
+        description: 参数4
+        type: integer
+      parma5:
+        description: 参数5
+        type: integer
+      parma6:
+        description: 参数6
+        type: integer
+      parma7:
+        description: 参数6
+        type: integer
+      scoreconfigtype:
+        description: 积分配置类型 - 1:注册送红包 2:签到送积分 3:推广送积分 4:下级用户下单送积分 5:自己采购下单送积分 6:自己供求下单送积分
+          7:抽奖得红包
+        type: integer
+    type: object
   models.TjmdHolderDetailTradeInfo:
     properties:
       agreeunit:
@@ -28602,6 +28637,32 @@ paths:
       summary: 查询我的订单-采购订单
       tags:
       - 铁合金
+  /Ferroalloy/QueryTHJScoreConfig:
+    get:
+      parameters:
+      - description: '[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分
+          6:自己供求下单积分 7:抽奖配置'
+        in: query
+        name: stype
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.Thjscoreconfig'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询积分配置
+      tags:
+      - 铁合金
   /Ferroalloy/QueryTHJWrstandard:
     get:
       parameters:
@@ -28669,6 +28730,11 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: '[格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分
+          6:自己供求下单积分 7:抽奖配置'
+        in: query
+        name: stype
+        type: string
       - description: 页码
         in: query
         name: page

+ 26 - 3
models/ferroalloy.go

@@ -287,7 +287,10 @@ type GThjuserscorelog struct {
 	CURSCORE        float64 `json:"-" xorm:"CURSCORE"`                                // 期末积分(变动后积)
 	CREATETIME      string  `json:"createtime" xorm:"CREATETIME"`                     // 记账时间
 	REMARK          string  `json:"-" xorm:"REMARK"`                                  // 备注
-	RELATEDORDERID  int64   `json:"-" xorm:"RELATEDORDERID"`                          // 关联单号
+	RELATEDORDERID  int64   `json:"-" xorm:"RELATEDORDERID"`                          // 关联单号\推荐人UserID
+	REDPACKETVALUE  float64 `json:"redpacketvalue" xorm:"REDPACKETVALUE"`             // 红包值【抽奖】
+
+	STYPE string `form:"stype"` // [格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置
 
 	PageEx `xorm:"extends"` // 页码信息
 }
@@ -301,12 +304,17 @@ func (r *GThjuserscorelog) buildSql() string {
 	select 
 		t.SCORECONFIGTYPE,
 		t.SCORE,
+		t.REDPACKETVALUE,
 		to_char(t.CREATETIME, 'yyyy-mm-dd hh24:mi:ss') CREATETIME
 	from THJ_USERSCORELOG t
-	where t.USERID = %v
+	where t.USERID = %v and %v 
 	order by t.CREATETIME desc
 `
-	sqlId.FormatParam(r.USERID)
+	param := "1=1"
+	if r.STYPE != "" {
+		param = fmt.Sprintf("t.SCORECONFIGTYPE in (%v)", r.STYPE)
+	}
+	sqlId.FormatParam(r.USERID, param)
 
 	sqlId.Page(r.Page, r.PageSize)
 	return sqlId.String()
@@ -820,3 +828,18 @@ func (r *Thjpurchasetradedetail) GetDataByPage() (interface{}, error, int, int,
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+type ThjscoreconfigReq struct {
+	STYPE string `form:"stype"` // [格式:1,2,3] 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置
+}
+
+func (r *ThjscoreconfigReq) Get() (data []Thjscoreconfig, err error) {
+	data = make([]Thjscoreconfig, 0)
+	engine := db.GetEngine().NewSession()
+	if r.STYPE != "" {
+		engine = engine.Where(fmt.Sprintf("SCORECONFIGTYPE in (%v)", r.STYPE))
+	}
+	err = engine.Find(&data)
+
+	return
+}

+ 3 - 2
models/ori.go

@@ -245,13 +245,14 @@ func (r *Thjuserscore) TableName() string {
 type Thjuserscorelog struct {
 	AUTOID          int64     `json:"autoid" xorm:"AUTOID"`                   // AutoID(SEQ_THJ_USERSCORELOG)
 	USERID          int64     `json:"userid" xorm:"USERID"`                   // 用户ID
-	SCORECONFIGTYPE int32     `json:"scoreconfigtype" xorm:"SCORECONFIGTYPE"` // 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单积分 5:自己采购下单积分 6:自己供求下单积分 7:抽奖配置
+	SCORECONFIGTYPE int32     `json:"scoreconfigtype" xorm:"SCORECONFIGTYPE"` // 配置类型 - 1:注册红包 2:签到积分 3:推广积分 4:下级用户下单 5:采购下单 6:供求下单 7:抽奖
 	SCORE           float64   `json:"score" xorm:"SCORE"`                     // 变动积分
 	ORISCORE        float64   `json:"oriscore" xorm:"ORISCORE"`               // 期初积分(变动前积)
 	CURSCORE        float64   `json:"curscore" xorm:"CURSCORE"`               // 期末积分(变动后积)
 	CREATETIME      time.Time `json:"createtime" xorm:"CREATETIME"`           // 记账时间
 	REMARK          string    `json:"remark" xorm:"REMARK"`                   // 备注
-	RELATEDORDERID  int64     `json:"relatedorderid" xorm:"RELATEDORDERID"`   // 关联单号
+	RELATEDORDERID  int64     `json:"relatedorderid" xorm:"RELATEDORDERID"`   // 关联单号\推荐人UserID
+	REDPACKETVALUE  float64   `json:"redpacketvalue" xorm:"REDPACKETVALUE"`   // 红包值【抽奖】
 }
 
 // TableName is THJ_USERSCORELOG

+ 1 - 0
routers/router.go

@@ -697,6 +697,7 @@ func InitRouter() *gin.Engine {
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandard", ferroalloy.QueryTHJWrstandard)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandardDetail", ferroalloy.QueryTHJWrstandardDetail)
 		ferroalloyR.Use(token.Auth()).GET("QueryTHJPurchaseTradeDetail", ferroalloy.QueryTHJPurchaseTradeDetail)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJScoreConfig", ferroalloy.QueryTHJScoreConfig)
 	}
 
 	return r