Prechádzať zdrojové kódy

增加接口:查询我的注册红包 & 查询采购列表

zhou.xiaoning 3 rokov pred
rodič
commit
a0863ead24

+ 18 - 3
controllers/ferroalloy/mine.go

@@ -9,18 +9,33 @@ 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 "每页条数"
 // @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{}
 	a.DoBindReq(&m)
 	a.DoGetDataByPage(&m)
 }
+
+// QueryMyRegisterMoney
+// @Summary 查询我的注册红包
+// @Produce  json
+// @Param   accountid query    int true "资金账户"
+// @Success 200       {array}  models.RegisterMoney
+// @Failure  500      {object} app.Response
+// @Router  /Ferroalloy/QueryMyRegisterMoney [get]
+// @Tags     铁合金
+func QueryMyRegisterMoney(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.RegisterMoney{}
+	a.DoBindReq(&m)
+	a.DoGetDataEx(&m)
+}

+ 26 - 0
controllers/ferroalloy/trade.go

@@ -0,0 +1,26 @@
+package ferroalloy
+
+import (
+	"mtp2_if/global/app"
+	"mtp2_if/models"
+
+	"github.com/gin-gonic/gin"
+)
+
+// QueryTHJWrstandard
+// @Summary  查询采购列表
+// @Produce  json
+// @Security ApiKeyAuth
+// @Param    wrstandardname query    string false "现货商品名称(模糊查询)"
+// @Param    page           query    int    false "页码"
+// @Param    pagesize       query    int    false "每页条数"
+// @Success  200            {array}  models.THJWrstandard
+// @Failure  500            {object} app.Response
+// @Router   /Ferroalloy/QueryTHJWrstandard [get]
+// @Tags     铁合金
+func QueryTHJWrstandard(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.THJWrstandard{}
+	a.DoBindReq(&m)
+	a.DoGetDataByPage(&m)
+}

+ 120 - 0
docs/docs.go

@@ -7650,6 +7650,96 @@ const docTemplate = `{
                 }
             }
         },
+        "/Ferroalloy/QueryMyRegisterMoney": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的注册红包",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.RegisterMoney"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ferroalloy/QueryTHJWrstandard": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询采购列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊查询)",
+                        "name": "wrstandardname",
+                        "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.THJWrstandard"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryUserScoreLog": {
             "get": {
                 "security": [
@@ -38643,6 +38733,15 @@ const docTemplate = `{
                 }
             }
         },
+        "models.RegisterMoney": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "description": "红包",
+                    "type": "number"
+                }
+            }
+        },
         "models.RelatedTaAccount": {
             "type": "object",
             "properties": {
@@ -39547,6 +39646,27 @@ const docTemplate = `{
                 }
             }
         },
+        "models.THJWrstandard": {
+            "type": "object",
+            "properties": {
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.Taaccount": {
             "type": "object",
             "required": [

+ 120 - 0
docs/swagger.json

@@ -7641,6 +7641,96 @@
                 }
             }
         },
+        "/Ferroalloy/QueryMyRegisterMoney": {
+            "get": {
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询我的注册红包",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "资金账户",
+                        "name": "accountid",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.RegisterMoney"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
+        "/Ferroalloy/QueryTHJWrstandard": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "铁合金"
+                ],
+                "summary": "查询采购列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "现货商品名称(模糊查询)",
+                        "name": "wrstandardname",
+                        "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.THJWrstandard"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/Ferroalloy/QueryUserScoreLog": {
             "get": {
                 "security": [
@@ -38634,6 +38724,15 @@
                 }
             }
         },
+        "models.RegisterMoney": {
+            "type": "object",
+            "properties": {
+                "amount": {
+                    "description": "红包",
+                    "type": "number"
+                }
+            }
+        },
         "models.RelatedTaAccount": {
             "type": "object",
             "properties": {
@@ -39538,6 +39637,27 @@
                 }
             }
         },
+        "models.THJWrstandard": {
+            "type": "object",
+            "properties": {
+                "thumurls": {
+                    "description": "缩略图片(1:1)(逗号分隔)",
+                    "type": "string"
+                },
+                "wrstandardcode": {
+                    "description": "现货商品代码",
+                    "type": "string"
+                },
+                "wrstandardid": {
+                    "description": "现货商品ID(自增 SEQ_GOODS 确保不重复)",
+                    "type": "integer"
+                },
+                "wrstandardname": {
+                    "description": "现货商品名称(模糊查询)",
+                    "type": "string"
+                }
+            }
+        },
         "models.Taaccount": {
             "type": "object",
             "required": [

+ 78 - 0
docs/swagger.yaml

@@ -16075,6 +16075,12 @@ definitions:
     required:
     - userid
     type: object
+  models.RegisterMoney:
+    properties:
+      amount:
+        description: 红包
+        type: number
+    type: object
   models.RelatedTaAccount:
     properties:
       accountid:
@@ -16733,6 +16739,21 @@ definitions:
         description: 状态操作标志 1-签到成功 2-当日已签到,不能重复签到
         type: integer
     type: object
+  models.THJWrstandard:
+    properties:
+      thumurls:
+        description: 缩略图片(1:1)(逗号分隔)
+        type: string
+      wrstandardcode:
+        description: 现货商品代码
+        type: string
+      wrstandardid:
+        description: 现货商品ID(自增 SEQ_GOODS 确保不重复)
+        type: integer
+      wrstandardname:
+        description: 现货商品名称(模糊查询)
+        type: string
+    type: object
   models.Taaccount:
     properties:
       accountflag:
@@ -28280,6 +28301,63 @@ paths:
       summary: 查询我的推荐列表
       tags:
       - 铁合金
+  /Ferroalloy/QueryMyRegisterMoney:
+    get:
+      parameters:
+      - description: 资金账户
+        in: query
+        name: accountid
+        required: true
+        type: integer
+      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/QueryTHJWrstandard:
+    get:
+      parameters:
+      - description: 现货商品名称(模糊查询)
+        in: query
+        name: wrstandardname
+        type: string
+      - 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.THJWrstandard'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询采购列表
+      tags:
+      - 铁合金
   /Ferroalloy/QueryUserScoreLog:
     get:
       parameters:

+ 106 - 0
models/ferroalloy.go

@@ -321,3 +321,109 @@ func (r *GThjuserscorelog) GetDataByPage() (interface{}, error, int, int, int) {
 	}
 	return sData, err, r.Page, r.PageSize, total
 }
+
+// THJWrstandard 现货商品表
+type THJWrstandard struct {
+	WRSTANDARDID      int64     `json:"wrstandardid" xorm:"WRSTANDARDID"`                           // 现货商品ID(自增 SEQ_GOODS 确保不重复)
+	WRSTANDARDCODE    string    `json:"wrstandardcode" xorm:"WRSTANDARDCODE"`                       // 现货商品代码
+	WRSTANDARDNAME    string    `json:"wrstandardname" xorm:"WRSTANDARDNAME" form:"wrstandardname"` // 现货商品名称(模糊查询)
+	DELIVERYGOODSID   int32     `json:"-" xorm:"DELIVERYGOODSID"`                                   // 现货品种ID
+	UNITID            int32     `json:"-" xorm:"UNITID"`                                            // 现货商品单位ID
+	MINIVALUE         int64     `json:"-" xorm:"MINIVALUE"`                                         // 最小变动值
+	MINIVALUEDP       int64     `json:"-" xorm:"MINIVALUEDP"`                                       // 最小变动值小数位
+	REALMINIVALUE     int64     `json:"-" xorm:"REALMINIVALUE"`                                     // 实际最小变动值
+	REALMINIVALUEDP   int64     `json:"-" xorm:"REALMINIVALUEDP"`                                   // 实际最小变动值小数位
+	WRSSTATUS         int32     `json:"-" xorm:"WRSSTATUS"`                                         // 状态 - 作废 - 0:未激活 1:正常
+	CREATORID         int64     `json:"-" xorm:"CREATORID"`                                         // 创建人
+	CREATETIME        time.Time `json:"-" xorm:"CREATETIME"`                                        // 创建时间
+	UPDATORID         int64     `json:"-" xorm:"UPDATORID"`                                         // 更新人
+	UPDATETIME        time.Time `json:"-" xorm:"UPDATETIME"`                                        // 更新时间
+	FACTORYITEMJSON   string    `json:"-" xorm:"FACTORYITEMJSON"`                                   // 要素项定义Json[{"DGFactoryItemTypeID": ,"ItemTypeMode": ,"FactoryItemIDs": },{.....},]DGFactoryItemTypeID - 要素项类型ID --DGFactoryItem->DGFactoryItemTypeIDItemTypeMode - 要素项类型模式 --DGFactoryItem->ItemTypeModeFactoryItemIDs - 选择项IDs--DGFactoryItem->DGFactoryItemID, 逗号分隔
+	ISVALID           int32     `json:"-" xorm:"ISVALID"`                                           // 是否有效 - 0:无效 1:有效
+	AREAUSERID        int64     `json:"-" xorm:"AREAUSERID"`                                        // 所属机构
+	REMARK            string    `json:"-" xorm:"REMARK"`                                            // 备注
+	CONVERTFACTOR     float64   `json:"-" xorm:"CONVERTFACTOR"`                                     // 标仓系数
+	VATRATE           float64   `json:"-" xorm:"VATRATE"`                                           // 现货增值税率
+	STORAGEFEE        float64   `json:"-" xorm:"STORAGEFEE"`                                        // 仓储费(固定: 111)
+	THUMURLS          string    `json:"thumurls" xorm:"THUMURLS"`                                   // 缩略图片(1:1)(逗号分隔)
+	PICTUREURLS       string    `json:"-" xorm:"PICTUREURLS"`                                       // 详情图片(逗号分隔)
+	BANNERPICURL      string    `json:"-" xorm:"BANNERPICURL"`                                      // Banner图(逗号分隔)
+	PROVIDERUSERID    int64     `json:"-" xorm:"PROVIDERUSERID"`                                    // 供应链提供商
+	PROVIDERACCOUNTID int64     `json:"-" xorm:"PROVIDERACCOUNTID"`                                 // 供应链提供商资金账户 ID
+
+	PageEx `xorm:"extends"` // 页码信息
+}
+
+func (r *THJWrstandard) calc() {
+
+}
+
+func (r *THJWrstandard) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		wr.*
+	from wrstandard wr
+	where wr.wrstandardid in 
+	(select distinct t.wrstandardid
+	from WR_PresaleInfo t
+	where t.presalestatus = 2
+	and t.marketid = 64201) and %v 
+	order by wr.wrstandardname;
+	`
+	param := "1=1"
+	if r.WRSTANDARDNAME != "" {
+		param = fmt.Sprintf("wr.wrstandardname like '%%%v%%'", r.WRSTANDARDNAME)
+	}
+	sqlId.FormatParam(param)
+
+	sqlId.Page(r.Page, r.PageSize)
+	return sqlId.String()
+}
+
+func (r *THJWrstandard) GetDataByPage() (interface{}, error, int, int, int) {
+	sData := make([]THJWrstandard, 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
+}
+
+// RegisterMoney 注册红包
+type RegisterMoney struct {
+	Amount float64 `json:"amount" xorm:"AMOUNT"` // 红包
+
+	Accountid int64 `json:"-" form:"accountid" binding:"required"` // 资金账户ID
+}
+
+func (r *RegisterMoney) calc() {
+
+}
+
+func (r *RegisterMoney) buildSql() string {
+	var sqlId utils.SQLVal = `
+	select 
+		t.amount 
+	from taaccountlog t 
+	where t.accountid = %v and t.businesscode = '712'
+	`
+	sqlId.FormatParam(r.Accountid)
+
+	return sqlId.String()
+}
+
+// GetDataEx 从数据库中查询数据
+func (r *RegisterMoney) GetDataEx() (interface{}, error) {
+	e := db.GetEngine()
+	s := e.SQL(r.buildSql())
+	sData := make([]RegisterMoney, 0)
+	if err := s.Find(&sData); err != nil {
+		return nil, err
+	}
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, nil
+}

+ 7 - 5
routers/router.go

@@ -687,12 +687,14 @@ func InitRouter() *gin.Engine {
 
 	// **************************上海铁合金*************************
 	ferroalloyR := apiR.Group("Ferroalloy")
-	ferroalloyR.Use(token.Auth())
+	ferroalloyR.Use()
 	{
-		ferroalloyR.GET("GetSpotGoodsPrice", ferroalloy.GetSpotGoodsPrice)
-		ferroalloyR.POST("Signin", ferroalloy.Signin)
-		ferroalloyR.GET("QueryMyRefer", ferroalloy.QueryMyRefer)
-		ferroalloyR.GET("QueryUserScoreLog", ferroalloy.QueryUserScoreLog)
+		ferroalloyR.Use(token.Auth()).GET("GetSpotGoodsPrice", ferroalloy.GetSpotGoodsPrice)
+		ferroalloyR.Use(token.Auth()).POST("Signin", ferroalloy.Signin)
+		ferroalloyR.Use(token.Auth()).GET("QueryMyRefer", ferroalloy.QueryMyRefer)
+		ferroalloyR.Use(token.Auth()).GET("QueryUserScoreLog", ferroalloy.QueryUserScoreLog)
+		ferroalloyR.Use(token.Auth()).GET("QueryTHJWrstandard", ferroalloy.QueryTHJWrstandard)
+		ferroalloyR.Use().GET("QueryMyRegisterMoney", ferroalloy.QueryMyRegisterMoney)
 	}
 
 	return r