瀏覽代碼

1、提货单接口增加完整的地址信息;
2、二级市场商品详情接口增加交易规则信息;
3、修改BUG。

zhou.xiaoning 5 年之前
父節點
當前提交
2d9e4073cb
共有 15 個文件被更改,包括 580 次插入615 次删除
  1. 28 1
      controllers/hsby/hsby.go
  2. 30 16
      docs/docs.go
  3. 30 16
      docs/swagger.json
  4. 24 14
      docs/swagger.yaml
  5. 1 0
      go.mod
  6. 174 0
      models/config.go
  7. 31 18
      models/hsby.go
  8. 4 0
      models/order.go
  9. 242 0
      pb/mtp2.pb.go
  10. 16 0
      pb/mtp2.proto
  11. 0 305
      protocol/student/student.pb.go
  12. 0 20
      protocol/student/student.proto
  13. 0 165
      protocol/testmsg/testmsg.pb.go
  14. 0 10
      protocol/testmsg/testmsg.proto
  15. 0 50
      protocol/testproto.go

+ 28 - 1
controllers/hsby/hsby.go

@@ -5,10 +5,12 @@ import (
 	"mtp2_if/global/e"
 	"mtp2_if/logger"
 	"mtp2_if/models"
+	"mtp2_if/pb"
 	"net/http"
 	"sort"
 
 	"github.com/gin-gonic/gin"
+	"github.com/golang/protobuf/proto"
 )
 
 // QueryHsbyTopGoodsesReq 查询热门商品列表请求参数
@@ -92,7 +94,8 @@ func QueryHsbyTopGoodses(c *gin.Context) {
 
 // QueryHsbyListingGoodsDetailReq 查询二级市场(挂牌点选)商品信息详情请求参数
 type QueryHsbyListingGoodsDetailReq struct {
-	GoodsID int `form:"goodsID" binding:"required"`
+	GoodsID   int `form:"goodsID" binding:"required"`
+	AccountID int `form:"accountID"`
 }
 
 // QueryHsbyListingGoodsDetail 查询二级市场(挂牌点选)商品信息详情
@@ -100,6 +103,7 @@ type QueryHsbyListingGoodsDetailReq struct {
 // @Produce json
 // @Security ApiKeyAuth
 // @Param goodsID query int true "商品ID"
+// @Param AccountID query int false "资金账户,主要用于获取交易规则。不传则获取通用规则。"
 // @Success 200 {object} models.HsbyListingGoodsDetail
 // @Failure 500 {object} app.Response
 // @Router /HSBY/QueryHsbyListingGoodsDetail [get]
@@ -124,6 +128,29 @@ func QueryHsbyListingGoodsDetail(c *gin.Context) {
 		return
 	}
 
+	// 获取交易规则
+	rule, err := models.GetTodayAccountTradeRule(req.AccountID, req.GoodsID)
+	if err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryHsbyListingGoodsDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	tradeRuleInfoStruct := &pb.TradeRuleInfoStruct{}
+	if err := proto.Unmarshal([]byte(rule.Infocontent), tradeRuleInfoStruct); err != nil {
+		// 查询失败
+		logger.GetLogger().Errorf("QueryHsbyListingGoodsDetail failed: %s", err.Error())
+		appG.Response(http.StatusBadRequest, e.ERROR_QUERY_FAIL, nil)
+		return
+	}
+	// INSERT INTO TRADERULEDESCRIPTION (RULEID, RULENAME, REGEXPRESS, DEFAULTVALUE, REMARK) VALUES (103, '单笔最小交易量', '^[1-9]\d*$', 1, '请输入正整数!');
+	for _, v := range tradeRuleInfoStruct.TradeRules {
+		if int(*v.RuleID) == 103 {
+			goodsInfo.LotSize = int(*v.ParamValue)
+			break
+		}
+	}
+
 	// 查询成功返回
 	logger.GetLogger().Debugln("QueryHsbyListingGoodsDetail successed: %v", goodsInfo)
 	appG.Response(http.StatusOK, e.SUCCESS, goodsInfo)

+ 30 - 16
docs/docs.go

@@ -926,6 +926,12 @@ var doc = `{
                         "name": "goodsID",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账户,主要用于获取交易规则。不传则获取通用规则。",
+                        "name": "AccountID",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -4398,8 +4404,12 @@ var doc = `{
                     "description": "单号(成交单号)",
                     "type": "string"
                 },
-                "picurls": {
-                    "description": "介绍图片[多张用逗号分隔]",
+                "picurls1": {
+                    "description": "预售商品介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "picurls2": {
+                    "description": "挂牌商品介绍图片[多张用逗号分隔]",
                     "type": "string"
                 },
                 "price": {
@@ -4418,8 +4428,12 @@ var doc = `{
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
                 },
-                "vendorname": {
-                    "description": "供应商名称",
+                "vendorname1": {
+                    "description": "预售商品供应商名称",
+                    "type": "string"
+                },
+                "vendorname2": {
+                    "description": "挂牌商品供应商名称",
                     "type": "string"
                 }
             }
@@ -4533,8 +4547,8 @@ var doc = `{
                     "type": "number"
                 },
                 "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
+                    "description": "手数最小变动单位",
+                    "type": "integer"
                 },
                 "marketid": {
                     "description": "所属市场ID",
@@ -4548,6 +4562,10 @@ var doc = `{
                     "description": "行情最小变动单位 [整数,报价小数位一起使用]",
                     "type": "integer"
                 },
+                "stepvalue": {
+                    "description": "价格最小变动单位",
+                    "type": "number"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
@@ -4809,10 +4827,6 @@ var doc = `{
                     "description": "商品状态- 2:未上市 3:上市",
                     "type": "integer"
                 },
-                "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
-                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"
@@ -4930,8 +4944,8 @@ var doc = `{
                     "type": "string"
                 },
                 "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
+                    "description": "手数最小变动单位",
+                    "type": "integer"
                 },
                 "marketid": {
                     "description": "所属市场ID",
@@ -4965,6 +4979,10 @@ var doc = `{
                     "description": "预售开始时间",
                     "type": "string"
                 },
+                "stepvalue": {
+                    "description": "价格最小变动单位",
+                    "type": "number"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
@@ -5122,10 +5140,6 @@ var doc = `{
                     "description": "现价",
                     "type": "number"
                 },
-                "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
-                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"

+ 30 - 16
docs/swagger.json

@@ -910,6 +910,12 @@
                         "name": "goodsID",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "资金账户,主要用于获取交易规则。不传则获取通用规则。",
+                        "name": "AccountID",
+                        "in": "query"
                     }
                 ],
                 "responses": {
@@ -4382,8 +4388,12 @@
                     "description": "单号(成交单号)",
                     "type": "string"
                 },
-                "picurls": {
-                    "description": "介绍图片[多张用逗号分隔]",
+                "picurls1": {
+                    "description": "预售商品介绍图片[多张用逗号分隔]",
+                    "type": "string"
+                },
+                "picurls2": {
+                    "description": "挂牌商品介绍图片[多张用逗号分隔]",
                     "type": "string"
                 },
                 "price": {
@@ -4402,8 +4412,12 @@
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
                 },
-                "vendorname": {
-                    "description": "供应商名称",
+                "vendorname1": {
+                    "description": "预售商品供应商名称",
+                    "type": "string"
+                },
+                "vendorname2": {
+                    "description": "挂牌商品供应商名称",
                     "type": "string"
                 }
             }
@@ -4517,8 +4531,8 @@
                     "type": "number"
                 },
                 "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
+                    "description": "手数最小变动单位",
+                    "type": "integer"
                 },
                 "marketid": {
                     "description": "所属市场ID",
@@ -4532,6 +4546,10 @@
                     "description": "行情最小变动单位 [整数,报价小数位一起使用]",
                     "type": "integer"
                 },
+                "stepvalue": {
+                    "description": "价格最小变动单位",
+                    "type": "number"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
@@ -4793,10 +4811,6 @@
                     "description": "商品状态- 2:未上市 3:上市",
                     "type": "integer"
                 },
-                "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
-                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"
@@ -4914,8 +4928,8 @@
                     "type": "string"
                 },
                 "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
+                    "description": "手数最小变动单位",
+                    "type": "integer"
                 },
                 "marketid": {
                     "description": "所属市场ID",
@@ -4949,6 +4963,10 @@
                     "description": "预售开始时间",
                     "type": "string"
                 },
+                "stepvalue": {
+                    "description": "价格最小变动单位",
+                    "type": "number"
+                },
                 "trademode": {
                     "description": "交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价",
                     "type": "integer"
@@ -5106,10 +5124,6 @@
                     "description": "现价",
                     "type": "number"
                 },
-                "lotsize": {
-                    "description": "最小变动单位",
-                    "type": "number"
-                },
                 "marketid": {
                     "description": "所属市场ID",
                     "type": "integer"

+ 24 - 14
docs/swagger.yaml

@@ -1285,8 +1285,11 @@ definitions:
       orderid:
         description: 单号(成交单号)
         type: string
-      picurls:
-        description: 介绍图片[多张用逗号分隔]
+      picurls1:
+        description: 预售商品介绍图片[多张用逗号分隔]
+        type: string
+      picurls2:
+        description: 挂牌商品介绍图片[多张用逗号分隔]
         type: string
       price:
         description: 价格
@@ -1301,8 +1304,11 @@ definitions:
         description: 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式
           21:竞拍-大宗式 22:受托竞价
         type: integer
-      vendorname:
-        description: 供应商名称
+      vendorname1:
+        description: 预售商品供应商名称
+        type: string
+      vendorname2:
+        description: 挂牌商品供应商名称
         type: string
     required:
     - accountid
@@ -1392,8 +1398,8 @@ definitions:
         description: 涨停价
         type: number
       lotsize:
-        description: 最小变动单位
-        type: number
+        description: 手数最小变动单位
+        type: integer
       marketid:
         description: 所属市场ID
         type: integer
@@ -1403,6 +1409,9 @@ definitions:
       quoteminunit:
         description: 行情最小变动单位 [整数,报价小数位一起使用]
         type: integer
+      stepvalue:
+        description: 价格最小变动单位
+        type: number
       trademode:
         description: 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式
           21:竞拍-大宗式 22:受托竞价
@@ -1599,9 +1608,6 @@ definitions:
       goodsstatus:
         description: 商品状态- 2:未上市 3:上市
         type: integer
-      lotsize:
-        description: 最小变动单位
-        type: number
       marketid:
         description: 所属市场ID
         type: integer
@@ -1691,8 +1697,8 @@ definitions:
         description: 报价单位
         type: string
       lotsize:
-        description: 最小变动单位
-        type: number
+        description: 手数最小变动单位
+        type: integer
       marketid:
         description: 所属市场ID
         type: integer
@@ -1717,6 +1723,9 @@ definitions:
       starttime:
         description: 预售开始时间
         type: string
+      stepvalue:
+        description: 价格最小变动单位
+        type: number
       trademode:
         description: 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式
           21:竞拍-大宗式 22:受托竞价
@@ -1838,9 +1847,6 @@ definitions:
       last:
         description: 现价
         type: number
-      lotsize:
-        description: 最小变动单位
-        type: number
       marketid:
         description: 所属市场ID
         type: integer
@@ -4287,6 +4293,10 @@ paths:
         name: goodsID
         required: true
         type: integer
+      - description: 资金账户,主要用于获取交易规则。不传则获取通用规则。
+        in: query
+        name: AccountID
+        type: integer
       produces:
       - application/json
       responses:

+ 1 - 0
go.mod

@@ -43,6 +43,7 @@ require (
 	github.com/xormplus/xorm v0.0.0-20200912034818-5d90dcd4e3d6
 	golang.org/x/net v0.0.0-20200927032502-5d4f70055728 // indirect
 	golang.org/x/tools v0.0.0-20200928201943-a0ef9b62deab // indirect
+	google.golang.org/protobuf v1.22.0
 	gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 // indirect
 	gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
 	gopkg.in/yaml.v2 v2.3.0 // indirect

+ 174 - 0
models/config.go

@@ -0,0 +1,174 @@
+package models
+
+import (
+	"mtp2_if/db"
+	"time"
+)
+
+// Accounttradeconfig 账户交易参数配置表
+type Accounttradeconfig struct {
+	Autoid       int64     `json:"autoid"  xorm:"'AUTOID'" binding:"required"`       // 自增ID
+	Accountid    int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"` // 资金账号
+	Userid       int64     `json:"userid"  xorm:"'USERID'"`                          // 用户ID
+	Memberuserid int64     `json:"memberuserid"  xorm:"'MEMBERUSERID'"`              // 所属会员ID
+	Goodsid      int32     `json:"goodsid"  xorm:"'GOODSID'"`                        // 商品ID
+	Marketid     int32     `json:"marketid"  xorm:"'MARKETID'"`                      // 市场ID
+	Ruletype     int32     `json:"ruletype"  xorm:"'RULETYPE'"`                      // 参数类型 -1.保证金类 2.交易规则 3.交易费用
+	Paramid      int32     `json:"paramid"  xorm:"'PARAMID'"`                        // 个性化参数ID - 1. 参照"交易模式规则费用对应-参考表" 可个性化类型 2.保证金类保存交易所创建的投资者客户类别ID
+	Feealgorithm int32     `json:"feealgorithm"  xorm:"'FEEALGORITHM'"`              // 费用算法 - 1:比率 2:固定
+	Paramvalue   float64   `json:"paramvalue"  xorm:"'PARAMVALUE'"`                  // 参数值(保证金类此项为空)
+	Createtime   time.Time `json:"createtime"  xorm:"'CREATETIME'"`                  // 创建时间
+	Creatorid    int64     `json:"creatorid"  xorm:"'CREATORID'"`                    // 创建人
+	Tradetype    int32     `json:"tradetype"  xorm:"'TRADETYPE'"`                    // 交易类型[交易费用] - 1:投资者\自营 2:做市
+}
+
+// TableName is ACCOUNTTRADECONFIG
+func (Accounttradeconfig) TableName() string {
+	return "ACCOUNTTRADECONFIG"
+}
+
+// Usergrouptradeconfig 用户分组交易参数配置表 (个性化到用户分组或资金账号)
+type Usergrouptradeconfig struct {
+	Autoid       int64     `json:"autoid"  xorm:"'AUTOID'" binding:"required"`           // 自增ID
+	Usergroupid  int64     `json:"usergroupid"  xorm:"'USERGROUPID'" binding:"required"` // 用户分组ID(0的为会员默认设置)
+	Memberuserid int64     `json:"memberuserid"  xorm:"'MEMBERUSERID'"`                  // 所属会员ID
+	Goodsid      int32     `json:"goodsid"  xorm:"'GOODSID'"`                            // 商品ID
+	Marketid     int32     `json:"marketid"  xorm:"'MARKETID'"`                          // 市场ID
+	Ruletype     int32     `json:"ruletype"  xorm:"'RULETYPE'"`                          // 参数类型 -1.保证金类 2.交易规则 3.交易费用
+	Paramid      int32     `json:"paramid"  xorm:"'PARAMID'"`                            // 个性化参数ID - 1. 参照"交易模式规则费用对应-参考表" 可个性化类型 2.保证金类保存交易所创建的投资者客户类别ID
+	Feealgorithm int32     `json:"feealgorithm"  xorm:"'FEEALGORITHM'"`                  // 费用算法 - 1:比率 2:固定
+	Paramvalue   float64   `json:"paramvalue"  xorm:"'PARAMVALUE'"`                      // 参数值(保证金类此项为空)
+	Createtime   time.Time `json:"createtime"  xorm:"'CREATETIME'"`                      // 创建时间
+	Creatorid    int64     `json:"creatorid"  xorm:"'CREATORID'"`                        // 创建人
+}
+
+// TableName is USERGROUPTRADECONFIG
+func (Usergrouptradeconfig) TableName() string {
+	return "USERGROUPTRADECONFIG"
+}
+
+// Goodstraderule 商品交易规则表
+type Goodstraderule struct {
+	Goodsid    int32   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`       // 商品ID
+	Ruleid     int32   `json:"ruleid"  xorm:"'RULEID'" binding:"required"`         // 交易规则 - 101 最大买持仓量  102 最大卖持仓量 103 单笔最小建仓量 104 单笔最大建仓量 105 手续费收费规则 106 交易T+N 107 上市首日涨停 108 上市首日跌停 109 上市首日参考价 110 涨停 111 跌停 112 市价最大偏移范围 113 止损点差 114 止盈点差 115 单笔最小交割数量 116 单笔最大交割数量
+	Paramvalue float64 `json:"paramvalue"  xorm:"'PARAMVALUE'" binding:"required"` // 参数值
+	Marketid   int32   `json:"marketid"  xorm:"'MARKETID'"`                        // 市场ID
+}
+
+// TableName is GOODSTRADERULE
+func (Goodstraderule) TableName() string {
+	return "GOODSTRADERULE"
+}
+
+// Goodstradefee 商品交易费用表
+type Goodstradefee struct {
+	Goodsid            int32   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`                       // 商品ID
+	Tradefeeid         int32   `json:"tradefeeid"  xorm:"'TRADEFEEID'" binding:"required"`                 // 交易费用ID - 101建仓(买)手续费 102平仓(卖)手续费 103买递延费(仓储费) 103卖递延费 104买交割手续费 105卖交割手续费
+	Feealgorithm       int32   `json:"feealgorithm"  xorm:"'FEEALGORITHM'" binding:"required"`             // 费用算法 - 1:比率 2:固定
+	Exchangevalue      float64 `json:"exchangevalue"  xorm:"'EXCHANGEVALUE'" binding:"required"`           // 交易所费用值
+	Memberdefaultvalue float64 `json:"memberdefaultvalue"  xorm:"'MEMBERDEFAULTVALUE'" binding:"required"` // 会员费用默认值
+	Memberminvalue     float64 `json:"memberminvalue"  xorm:"'MEMBERMINVALUE'"`                            // 会员费用最小值
+	Membermaxvalue     float64 `json:"membermaxvalue"  xorm:"'MEMBERMAXVALUE'"`                            // 会员费用最大值
+	Marketid           int32   `json:"marketid"  xorm:"'MARKETID'"`                                        // 市场ID
+}
+
+// TableName is GOODSTRADEFEE
+func (Goodstradefee) TableName() string {
+	return "GOODSTRADEFEE"
+}
+
+// Goodsgrouptraderule 商品组交易规则表
+type Goodsgrouptraderule struct {
+	Goodsgroupid int32   `json:"goodsgroupid"  xorm:"'GOODSGROUPID'" binding:"required"` // 商品组ID
+	Ruleid       int32   `json:"ruleid"  xorm:"'RULEID'" binding:"required"`             // 交易规则 - 101 最大买持仓量  102 最大卖持仓量 103 单笔最小建仓量 104 单笔最大建仓量 105 手续费收费规则 106 交易T+N 107 上市首日涨停 108 上市首日跌停 109 上市首日参考价 110 涨停 111 跌停 112 市价最大偏移范围 113 止损点差 114 止盈点差 115 单笔最小交割数量 116 单笔最大交割数量
+	Paramvalue   float64 `json:"paramvalue"  xorm:"'PARAMVALUE'" binding:"required"`     // 参数值
+	Marketid     int32   `json:"marketid"  xorm:"'MARKETID'"`                            // 市场ID
+}
+
+// TableName is GOODSGROUPTRADERULE
+func (Goodsgrouptraderule) TableName() string {
+	return "GOODSGROUPTRADERULE"
+}
+
+// Goodsgrouptradefee 商品组交易费用表
+type Goodsgrouptradefee struct {
+	Goodsgroupid       int32   `json:"goodsgroupid"  xorm:"'GOODSGROUPID'" binding:"required"`             // 商品组ID
+	Tradefeeid         int32   `json:"tradefeeid"  xorm:"'TRADEFEEID'" binding:"required"`                 // 交易费用ID - 101建仓(买)手续费 102平仓(卖)手续费 103买递延费(仓储费) 103卖递延费 104买交割手续费 105卖交割手续费
+	Feealgorithm       int32   `json:"feealgorithm"  xorm:"'FEEALGORITHM'" binding:"required"`             // 费用算法 - 1:比率 2:固定
+	Exchangevalue      float64 `json:"exchangevalue"  xorm:"'EXCHANGEVALUE'" binding:"required"`           // 交易所费用值
+	Memberdefaultvalue float64 `json:"memberdefaultvalue"  xorm:"'MEMBERDEFAULTVALUE'" binding:"required"` // 会员费用默认值
+	Memberminvalue     float64 `json:"memberminvalue"  xorm:"'MEMBERMINVALUE'"`                            // 会员费用最小值
+	Membermaxvalue     float64 `json:"membermaxvalue"  xorm:"'MEMBERMAXVALUE'"`                            // 会员费用最大值
+	Marketid           int32   `json:"marketid"  xorm:"'MARKETID'"`                                        // 市场ID
+}
+
+// TableName is GOODSGROUPTRADEFEE
+func (Goodsgrouptradefee) TableName() string {
+	return "GOODSGROUPTRADEFEE"
+}
+
+// Goodsmarginconfig 商品保证金配置表
+type Goodsmarginconfig struct {
+	Goodsid             int32   `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`               // 商品ID
+	Customertypeid      int64   `json:"customertypeid"  xorm:"'CUSTOMERTYPEID'" binding:"required"` // 投资者客户类别(枚举项的值)
+	Marginalgorithm     int32   `json:"marginalgorithm"  xorm:"'MARGINALGORITHM'"`                  // 保证金计算方式 - 1:比率 2.固定
+	Marketmarginvalue   float64 `json:"marketmarginvalue"  xorm:"'MARKETMARGINVALUE'"`              // 即市保证金值
+	Reckonmarginvalue   float64 `json:"reckonmarginvalue"  xorm:"'RECKONMARGINVALUE'"`              // 结算保证金值
+	Lockmarginvalue     float64 `json:"lockmarginvalue"  xorm:"'LOCKMARGINVALUE'"`                  // 锁仓保证金
+	Isdefault           int32   `json:"isdefault"  xorm:"'ISDEFAULT'"`                              // 是否默认 - 0:非默认  1:默认
+	Marketid            int32   `json:"marketid"  xorm:"'MARKETID'"`                                // 市场ID
+	Realmarginvalue     float64 `json:"realmarginvalue"  xorm:"'REALMARGINVALUE'"`                  // 实付保证金值[做市收益权市场“是否交易授信” = 1 ]
+	Realmarginalgorithm int32   `json:"realmarginalgorithm"  xorm:"'REALMARGINALGORITHM'"`          // 实付保证金计算方式 - 1:比率 2.固定
+}
+
+// TableName is GOODSMARGINCONFIG
+func (Goodsmarginconfig) TableName() string {
+	return "GOODSMARGINCONFIG"
+}
+
+// Todayaccounttraderule 今日账户交易规则信表 控制服务在待开市时清空表,然后从基础数表生成数据,各服务使用此表数据做为当天交易参数,当日修改的数据隔日生效
+type Todayaccounttraderule struct {
+	Accountid   int64     `json:"accountid"  xorm:"'ACCOUNTID'" binding:"required"` // 账号ID
+	Goodsid     int32     `json:"goodsid"  xorm:"'GOODSID'" binding:"required"`     // 商品ID
+	Infocontent string    `json:"infocontent"  xorm:"'INFOCONTENT'"`                // 交易规则信息(存储配置的Protobuffer串)
+	Marketid    int32     `json:"marketid"  xorm:"'MARKETID'"`                      // 市场ID
+	Createdate  time.Time `json:"createdate"  xorm:"'CREATEDATE'"`                  // 创建时间
+	Tradetype   int32     `json:"tradetype"  xorm:"'TRADETYPE'" binding:"required"` // 交易类型 - 1:投资者\自营 2:做市
+}
+
+// TableName is TODAY_ACCOUNTTRADERULE
+func (Todayaccounttraderule) TableName() string {
+	return "TODAY_ACCOUNTTRADERULE"
+}
+
+// GetTodayAccountTradeRule 获取今日账户交易规则信息
+func GetTodayAccountTradeRule(accountID, goodsID int) (*Todayaccounttraderule, error) {
+	engine := db.GetEngine()
+
+	var rule Todayaccounttraderule
+	var has bool
+	var err error
+
+	// 先尝试获取账户定制配置
+	if accountID > 0 {
+		has, err = engine.Where("ACCOUNTID = ?", accountID).And("TRADETYPE = 1 and GOODSID = ?", goodsID).Get(&rule)
+		if err != nil {
+			return nil, err
+		}
+	}
+
+	// 完定制配置则取通用配置(accountID = 0)
+	if !has {
+		has, err = engine.Where("TRADETYPE = 1 and GOODSID = ?", goodsID).Get(&rule)
+		if err != nil {
+			return nil, err
+		}
+	}
+
+	if !has {
+		// 无配置信息
+		return nil, nil
+	}
+
+	return &rule, nil
+}

+ 31 - 18
models/hsby.go

@@ -176,6 +176,8 @@ type HsbyListingGoodsDetail struct {
 	Last      float64 `json:"last" xorm:"-"`      // 现价
 	Limitup   float64 `json:"limitup" xorm:"-"`   // 涨停价
 	Limitdown float64 `json:"limitdown" xorm:"-"` // 跌停价
+	StepValue float64 `json:"stepvalue" xorm:"-"` // 价格最小变动单位
+	LotSize   int     `json:"lotsize" xorm:"-"`   // 手数最小变动单位
 }
 
 // GetHsbyListingGoodsDetail 获取二级市场(挂牌点选)商品信息详情
@@ -229,10 +231,12 @@ func GetHsbyListingGoodsDetail(goodsID int) (*HsbyListingGoodsDetail, error) {
 		}
 	}
 
-	// FIXME: - 这里应该使用 Duck Typing,后期再处理
-	// 计算最小变动单位
-	// lotSize := float64(hsbyListingGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(hsbyListingGoodsDetail.Decimalplace))
-	// hsbyListingGoodsDetail.LotSize, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(hsbyListingGoodsDetail.Decimalplace)), 64)
+	// 计算价格最小变动单位
+	stepValue := float64(hsbyListingGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(hsbyListingGoodsDetail.Decimalplace))
+	hsbyListingGoodsDetail.StepValue, _ = strconv.ParseFloat(utils.FormatFloat(stepValue, int(hsbyListingGoodsDetail.Decimalplace)), 64)
+
+	// 计算手数最小变动单位
+	hsbyListingGoodsDetail.LotSize = 1
 
 	return &hsbyListingGoodsDetail, nil
 }
@@ -629,7 +633,7 @@ type HsbyPreGoodsDetail struct {
 
 	Customername string `json:"customername" xorm:"'CUSTOMERNAME'"` // 发行单位
 
-	StepValue float64 `json:"stepValue" xorm:"-"`    // 价格最小变动单位
+	StepValue float64 `json:"stepvalue" xorm:"-"`    // 价格最小变动单位
 	LotSize   int     `json:"lotsize" xorm:"-"`      // 手数最小变动单位
 	Buymaxqty int     `json:"buymaxqty"  xorm:"'-'"` // 购买上限 [71] - 0为不限
 }
@@ -674,8 +678,8 @@ func GetHsbyPreGoodsDetail(goodsID, accountID int) (*HsbyPreGoodsDetail, error)
 
 	// FIXME: - 这里应该使用 Duck Typing,后期再处理
 	// 计算价格最小变动单位
-	lotSize := float64(preGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(preGoodsDetail.Decimalplace))
-	preGoodsDetail.StepValue, _ = strconv.ParseFloat(utils.FormatFloat(lotSize, int(preGoodsDetail.Decimalplace)), 64)
+	stepValue := float64(preGoodsDetail.Quoteminunit) * math.Pow(0.1, float64(preGoodsDetail.Decimalplace))
+	preGoodsDetail.StepValue, _ = strconv.ParseFloat(utils.FormatFloat(stepValue, int(preGoodsDetail.Decimalplace)), 64)
 
 	// 计算手数最小变动单位,一级市场固定为1
 	preGoodsDetail.LotSize = 1
@@ -898,7 +902,7 @@ func GetHsbyMyPackages(accountIDs string, takeOrderStatus int) ([]HsbyMyPackage,
 
 	myPackages := make([]HsbyMyPackage, 0)
 	session := engine.Table("TRADE_GOODSPICKUP").
-		Select(`to_char(TRADE_GOODSPICKUP.TAKEORDERID) TAKEORDERID, TRADE_GOODSPICKUP.*, 
+		Select(`to_char(TRADE_GOODSPICKUP.TAKEORDERID) TAKEORDERID, (DIVISION.PATHNAME || TRADE_GOODSPICKUP.ADDRESS) ADDRESS, TRADE_GOODSPICKUP.*, 
 				(TRADE_GOODSPICKUP.AMOUNT/TRADE_GOODSPICKUP.QTY/GOODS.AGREEUNIT) AVERAGEPRICE, 
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT, 
 				HSBY_GOODSEX.PICURLS, 
@@ -908,6 +912,7 @@ func GetHsbyMyPackages(accountIDs string, takeOrderStatus int) ([]HsbyMyPackage,
 		Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
 		Join("LEFT", "HSBY_SUPPLIERINFO", "HSBY_SUPPLIERINFO.VENDORID = HSBY_GOODSEX.VENDORID").
+		Join("LEFT", "DIVISION", "DIVISION.AUTOID = TRADE_GOODSPICKUP.DISTRICTID").
 		Where(fmt.Sprintf("TRADE_GOODSPICKUP.ACCOUNTID in (%s)", accountIDs))
 	if takeOrderStatus > 0 {
 		session = session.And("TAKEORDERSTATUS = ?", takeOrderStatus)
@@ -979,13 +984,15 @@ type HsbyBuyMyTradeDetail struct {
 	Decimalplace int64   `json:"decimalplace"  xorm:"'DECIMALPLACE'"`              // 报价小数位
 	Agreeunit    float64 `json:"agreeunit"  xorm:"'AGREEUNIT'"`                    // 合约单位
 
-	Picurls string `json:"picurls"  xorm:"'PICURLS'"` // 介绍图片[多张用逗号分隔]
+	Picurls1 string `json:"picurls1"  xorm:"'PICURLS1'"` // 预售商品介绍图片[多张用逗号分隔]
+	Picurls2 string `json:"picurls2"  xorm:"'PICURLS2'"` // 挂牌商品介绍图片[多张用逗号分隔]
 
 	Trademode uint32 `json:"trademode"  xorm:"'TRADEMODE'" binding:"required"` // 交易模式 - 10:做市 13:竞价 15:通道交易 16:挂牌点选 17:仓单贸易 18:期权 19:竞拍-降价式 20:竞拍-竞价式 21:竞拍-大宗式 22:受托竞价
 
 	Currencysign string `json:"currencysign" xorm:"'CURRENCYSIGN'"` // 货币符号
 
-	Vendorname string `json:"vendorname"  xorm:"'VENDORNAME'"` // 供应商名称
+	Vendorname1 string `json:"vendorname1"  xorm:"'VENDORNAME1'"` // 预售商品供应商名称
+	Vendorname2 string `json:"vendorname2"  xorm:"'VENDORNAME2'"` // 挂牌商品供应商名称
 }
 
 // GetHsbyBuyMyTradeDetails 获取"我的订单 - 已完成"单据信息(一二级市场成交单,包括历史数据)
@@ -1021,15 +1028,18 @@ func GetHsbyBuyMyTradeDetails(accountIDs string) ([]HsbyBuyMyTradeDetail, error)
 				TRADE_TRADEDETAIL.MARKETID, TRADE_TRADEDETAIL.GOODSID, TRADE_TRADEDETAIL.ACCOUNTID, TRADE_TRADEDETAIL.BUYORSELL,
 				TRADE_TRADEDETAIL.TRADEPRICE PRICE, TRADE_TRADEDETAIL.TRADEQTY QTY, TRADE_TRADEDETAIL.TRADETIME TIME, TRADE_TRADEDETAIL.TRADEAMOUNT AMOUNT, 
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT, 
-				HSBY_GOODSEX.PICURLS, 
+				HG1.PICURLS PICURLS1, HG2.PICURLS PICURLS2, 
 				MARKET.TRADEMODE, 
 				ENUMDICITEM.PARAM2 CURRENCYSIGN, 
-				HSBY_SUPPLIERINFO.VENDORNAME`).
+				HS1.VENDORNAME VENDORNAME1, HS2.VENDORNAME VENDORNAME2`).
 		Join("LEFT", "GOODS", "GOODS.GOODSID = TRADE_TRADEDETAIL.GOODSID").
-		Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
+		Join("LEFT", "CPTRADE_PRESALEGOODSEX", "CPTRADE_PRESALEGOODSEX.GOODSID = TRADE_TRADEDETAIL.GOODSID").
+		Join("LEFT", "HSBY_GOODSEX HG1", "HG1.GOODSID = CPTRADE_PRESALEGOODSEX.RELATEDGOODSID").
+		Join("LEFT", "HSBY_GOODSEX HG2", "HG2.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
 		Join("LEFT", "MARKET", "MARKET.MARKETID = TRADE_TRADEDETAIL.MARKETID").
-		Join("LEFT", "HSBY_SUPPLIERINFO", "HSBY_SUPPLIERINFO.VENDORID = HSBY_GOODSEX.VENDORID").
+		Join("LEFT", "HSBY_SUPPLIERINFO HS1", "HS1.VENDORID = HG1.VENDORID").
+		Join("LEFT", "HSBY_SUPPLIERINFO HS2", "HS2.VENDORID = HG2.VENDORID").
 		Where(fmt.Sprintf(`TRADE_TRADEDETAIL.BUYORSELL = 0 
 						   and TRADE_TRADEDETAIL.ACCOUNTID in (%s)`, accountIDs)).
 		And(fmt.Sprintf("TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs)).Find(&curOrders); err != nil {
@@ -1046,15 +1056,18 @@ func GetHsbyBuyMyTradeDetails(accountIDs string) ([]HsbyBuyMyTradeDetail, error)
 				HIS_TRADE_TRADEDETAIL.MARKETID, HIS_TRADE_TRADEDETAIL.GOODSID, HIS_TRADE_TRADEDETAIL.ACCOUNTID, HIS_TRADE_TRADEDETAIL.BUYORSELL,
 				HIS_TRADE_TRADEDETAIL.TRADEPRICE PRICE, HIS_TRADE_TRADEDETAIL.TRADEQTY QTY, HIS_TRADE_TRADEDETAIL.TRADETIME TIME, HIS_TRADE_TRADEDETAIL.TRADEAMOUNT AMOUNT, 
 				GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.DECIMALPLACE, GOODS.AGREEUNIT, 
-				HSBY_GOODSEX.PICURLS, 
+				HG1.PICURLS PICURLS1, HG2.PICURLS PICURLS2, 
 				MARKET.TRADEMODE, 
 				ENUMDICITEM.PARAM2 CURRENCYSIGN, 
-				HSBY_SUPPLIERINFO.VENDORNAME`).
+				HS1.VENDORNAME VENDORNAME1, HS2.VENDORNAME VENDORNAME2`).
 		Join("LEFT", "GOODS", "GOODS.GOODSID = HIS_TRADE_TRADEDETAIL.GOODSID").
-		Join("LEFT", "HSBY_GOODSEX", "HSBY_GOODSEX.GOODSID = GOODS.GOODSID").
+		Join("LEFT", "CPTRADE_PRESALEGOODSEX", "CPTRADE_PRESALEGOODSEX.GOODSID = HIS_TRADE_TRADEDETAIL.GOODSID").
+		Join("LEFT", "HSBY_GOODSEX HG1", "HG1.GOODSID = CPTRADE_PRESALEGOODSEX.RELATEDGOODSID").
+		Join("LEFT", "HSBY_GOODSEX HG2", "HG2.GOODSID = GOODS.GOODSID").
 		Join("LEFT", "ENUMDICITEM", "GOODS.CURRENCYID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'currency'").
 		Join("LEFT", "MARKET", "MARKET.MARKETID = HIS_TRADE_TRADEDETAIL.MARKETID").
-		Join("LEFT", "HSBY_SUPPLIERINFO", "HSBY_SUPPLIERINFO.VENDORID = HSBY_GOODSEX.VENDORID").
+		Join("LEFT", "HSBY_SUPPLIERINFO HS1", "HS1.VENDORID = HG1.VENDORID").
+		Join("LEFT", "HSBY_SUPPLIERINFO HS2", "HS2.VENDORID = HG2.VENDORID").
 		Where(fmt.Sprintf(`HIS_TRADE_TRADEDETAIL.BUYORSELL = 0 and HIS_TRADE_TRADEDETAIL.ISVALIDDATA = 1 
 						   and HIS_TRADE_TRADEDETAIL.ACCOUNTID in (%s)`, accountIDs)).
 		And(fmt.Sprintf("HIS_TRADE_TRADEDETAIL.MARKETID in (%s)", marketIDs)).Find(&hisOrders); err != nil {

+ 4 - 0
models/order.go

@@ -347,6 +347,10 @@ type Tradegoodspickup struct {
 	Marketid        int32     `json:"marketid"  xorm:"'MARKETID'"`                          // 市场ID
 	Handlestatus    int32     `json:"handlestatus"  xorm:"'HANDLESTATUS'"`                  // 处理状态
 	Amount          float64   `json:"amount"  xorm:"'AMOUNT'"`                              // 提货金额
+	Countryid       int32     `json:"countryid"  xorm:"'COUNTRYID'"`                        // 国家
+	Provinceid      int32     `json:"provinceid"  xorm:"'PROVINCEID'"`                      // 省
+	Cityid          int32     `json:"cityid"  xorm:"'CITYID'"`                              // 市
+	Districtid      int32     `json:"districtid"  xorm:"'DISTRICTID'"`                      // 地区
 }
 
 // TableName is TRADE_GOODSPICKUP

+ 242 - 0
pb/mtp2.pb.go

@@ -0,0 +1,242 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// 	protoc-gen-go v1.25.0
+// 	protoc        v3.14.0
+// source: mtp2.proto
+
+package pb
+
+import (
+	proto "github.com/golang/protobuf/proto"
+	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	reflect "reflect"
+	sync "sync"
+)
+
+const (
+	// Verify that this generated code is sufficiently up-to-date.
+	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+	// Verify that runtime/protoimpl is sufficiently up-to-date.
+	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// This is a compile-time assertion that a sufficiently up-to-date version
+// of the legacy proto package is being used.
+const _ = proto.ProtoPackageIsVersion4
+
+//交易规则信息子集
+type TradeRule struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	RuleID     *uint32  `protobuf:"varint,1,opt,name=RuleID" json:"RuleID,omitempty"`          // 交易规则ID
+	ParamValue *float64 `protobuf:"fixed64,2,opt,name=ParamValue" json:"ParamValue,omitempty"` // 参数值
+}
+
+func (x *TradeRule) Reset() {
+	*x = TradeRule{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[0]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *TradeRule) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TradeRule) ProtoMessage() {}
+
+func (x *TradeRule) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[0]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use TradeRule.ProtoReflect.Descriptor instead.
+func (*TradeRule) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *TradeRule) GetRuleID() uint32 {
+	if x != nil && x.RuleID != nil {
+		return *x.RuleID
+	}
+	return 0
+}
+
+func (x *TradeRule) GetParamValue() float64 {
+	if x != nil && x.ParamValue != nil {
+		return *x.ParamValue
+	}
+	return 0
+}
+
+//交易规则信息
+type TradeRuleInfoStruct struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	AccountID  *uint64      `protobuf:"varint,1,opt,name=AccountID" json:"AccountID,omitempty"`  // 资金账号
+	GoodsID    *uint32      `protobuf:"varint,2,opt,name=GoodsID" json:"GoodsID,omitempty"`      // 商品id
+	TradeRules []*TradeRule `protobuf:"bytes,3,rep,name=TradeRules" json:"TradeRules,omitempty"` // 交易规则
+}
+
+func (x *TradeRuleInfoStruct) Reset() {
+	*x = TradeRuleInfoStruct{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_mtp2_proto_msgTypes[1]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *TradeRuleInfoStruct) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TradeRuleInfoStruct) ProtoMessage() {}
+
+func (x *TradeRuleInfoStruct) ProtoReflect() protoreflect.Message {
+	mi := &file_mtp2_proto_msgTypes[1]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use TradeRuleInfoStruct.ProtoReflect.Descriptor instead.
+func (*TradeRuleInfoStruct) Descriptor() ([]byte, []int) {
+	return file_mtp2_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *TradeRuleInfoStruct) GetAccountID() uint64 {
+	if x != nil && x.AccountID != nil {
+		return *x.AccountID
+	}
+	return 0
+}
+
+func (x *TradeRuleInfoStruct) GetGoodsID() uint32 {
+	if x != nil && x.GoodsID != nil {
+		return *x.GoodsID
+	}
+	return 0
+}
+
+func (x *TradeRuleInfoStruct) GetTradeRules() []*TradeRule {
+	if x != nil {
+		return x.TradeRules
+	}
+	return nil
+}
+
+var File_mtp2_proto protoreflect.FileDescriptor
+
+var file_mtp2_proto_rawDesc = []byte{
+	0x0a, 0x0a, 0x6d, 0x74, 0x70, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62,
+	0x22, 0x43, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x12, 0x16, 0x0a,
+	0x06, 0x52, 0x75, 0x6c, 0x65, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x52,
+	0x75, 0x6c, 0x65, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x56, 0x61,
+	0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0a, 0x50, 0x61, 0x72, 0x61, 0x6d,
+	0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x7c, 0x0a, 0x13, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75,
+	0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x1c, 0x0a, 0x09,
+	0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52,
+	0x09, 0x41, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x18, 0x0a, 0x07, 0x47, 0x6f,
+	0x6f, 0x64, 0x73, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x47, 0x6f, 0x6f,
+	0x64, 0x73, 0x49, 0x44, 0x12, 0x2d, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75, 0x6c,
+	0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x72,
+	0x61, 0x64, 0x65, 0x52, 0x75, 0x6c, 0x65, 0x52, 0x0a, 0x54, 0x72, 0x61, 0x64, 0x65, 0x52, 0x75,
+	0x6c, 0x65, 0x73,
+}
+
+var (
+	file_mtp2_proto_rawDescOnce sync.Once
+	file_mtp2_proto_rawDescData = file_mtp2_proto_rawDesc
+)
+
+func file_mtp2_proto_rawDescGZIP() []byte {
+	file_mtp2_proto_rawDescOnce.Do(func() {
+		file_mtp2_proto_rawDescData = protoimpl.X.CompressGZIP(file_mtp2_proto_rawDescData)
+	})
+	return file_mtp2_proto_rawDescData
+}
+
+var file_mtp2_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_mtp2_proto_goTypes = []interface{}{
+	(*TradeRule)(nil),           // 0: pb.TradeRule
+	(*TradeRuleInfoStruct)(nil), // 1: pb.TradeRuleInfoStruct
+}
+var file_mtp2_proto_depIdxs = []int32{
+	0, // 0: pb.TradeRuleInfoStruct.TradeRules:type_name -> pb.TradeRule
+	1, // [1:1] is the sub-list for method output_type
+	1, // [1:1] is the sub-list for method input_type
+	1, // [1:1] is the sub-list for extension type_name
+	1, // [1:1] is the sub-list for extension extendee
+	0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_mtp2_proto_init() }
+func file_mtp2_proto_init() {
+	if File_mtp2_proto != nil {
+		return
+	}
+	if !protoimpl.UnsafeEnabled {
+		file_mtp2_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*TradeRule); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_mtp2_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*TradeRuleInfoStruct); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+	}
+	type x struct{}
+	out := protoimpl.TypeBuilder{
+		File: protoimpl.DescBuilder{
+			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+			RawDescriptor: file_mtp2_proto_rawDesc,
+			NumEnums:      0,
+			NumMessages:   2,
+			NumExtensions: 0,
+			NumServices:   0,
+		},
+		GoTypes:           file_mtp2_proto_goTypes,
+		DependencyIndexes: file_mtp2_proto_depIdxs,
+		MessageInfos:      file_mtp2_proto_msgTypes,
+	}.Build()
+	File_mtp2_proto = out.File
+	file_mtp2_proto_rawDesc = nil
+	file_mtp2_proto_goTypes = nil
+	file_mtp2_proto_depIdxs = nil
+}

+ 16 - 0
pb/mtp2.proto

@@ -0,0 +1,16 @@
+syntax = "proto2";
+
+package pb;
+
+//交易规则信息子集
+message TradeRule{
+    optional uint32 RuleID = 1;                   // 交易规则ID
+    optional double ParamValue = 2;               // 参数值
+}
+
+//交易规则信息
+message TradeRuleInfoStruct{
+    optional uint64 AccountID = 1;                // 资金账号
+    optional uint32 GoodsID = 2;                  // 商品id 
+    repeated TradeRule TradeRules = 3;            // 交易规则
+}

+ 0 - 305
protocol/student/student.pb.go

@@ -1,305 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// 	protoc-gen-go v1.24.0
-// 	protoc        v3.12.1
-// source: student.proto
-
-package student
-
-import (
-	proto "github.com/golang/protobuf/proto"
-	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
-)
-
-const (
-	// Verify that this generated code is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
-	// Verify that runtime/protoimpl is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// This is a compile-time assertion that a sufficiently up-to-date version
-// of the legacy proto package is being used.
-const _ = proto.ProtoPackageIsVersion4
-
-type ClassName int32
-
-const (
-	ClassName_class1 ClassName = 0 //标号 必须从 0开始
-	ClassName_class2 ClassName = 1
-	ClassName_class3 ClassName = 2
-)
-
-// Enum value maps for ClassName.
-var (
-	ClassName_name = map[int32]string{
-		0: "class1",
-		1: "class2",
-		2: "class3",
-	}
-	ClassName_value = map[string]int32{
-		"class1": 0,
-		"class2": 1,
-		"class3": 2,
-	}
-)
-
-func (x ClassName) Enum() *ClassName {
-	p := new(ClassName)
-	*p = x
-	return p
-}
-
-func (x ClassName) String() string {
-	return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (ClassName) Descriptor() protoreflect.EnumDescriptor {
-	return file_student_proto_enumTypes[0].Descriptor()
-}
-
-func (ClassName) Type() protoreflect.EnumType {
-	return &file_student_proto_enumTypes[0]
-}
-
-func (x ClassName) Number() protoreflect.EnumNumber {
-	return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use ClassName.Descriptor instead.
-func (ClassName) EnumDescriptor() ([]byte, []int) {
-	return file_student_proto_rawDescGZIP(), []int{0}
-}
-
-type Student struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	Name    string    `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` //1:标号,唯一 即可(相当于数据库中的Id,不一定要从1 ,2的顺序依次排列。)
-	Age     int32     `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`  //必须指定整型的范围,如int32,int64
-	Address string    `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
-	Cn      ClassName `protobuf:"varint,4,opt,name=cn,proto3,enum=student.ClassName" json:"cn,omitempty"`
-}
-
-func (x *Student) Reset() {
-	*x = Student{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_student_proto_msgTypes[0]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *Student) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Student) ProtoMessage() {}
-
-func (x *Student) ProtoReflect() protoreflect.Message {
-	mi := &file_student_proto_msgTypes[0]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use Student.ProtoReflect.Descriptor instead.
-func (*Student) Descriptor() ([]byte, []int) {
-	return file_student_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Student) GetName() string {
-	if x != nil {
-		return x.Name
-	}
-	return ""
-}
-
-func (x *Student) GetAge() int32 {
-	if x != nil {
-		return x.Age
-	}
-	return 0
-}
-
-func (x *Student) GetAddress() string {
-	if x != nil {
-		return x.Address
-	}
-	return ""
-}
-
-func (x *Student) GetCn() ClassName {
-	if x != nil {
-		return x.Cn
-	}
-	return ClassName_class1
-}
-
-type Students struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	Person []*Student `protobuf:"bytes,1,rep,name=person,proto3" json:"person,omitempty"` // repeated 修饰,相当于Go中切片
-	School string     `protobuf:"bytes,2,opt,name=school,proto3" json:"school,omitempty"`
-}
-
-func (x *Students) Reset() {
-	*x = Students{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_student_proto_msgTypes[1]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *Students) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Students) ProtoMessage() {}
-
-func (x *Students) ProtoReflect() protoreflect.Message {
-	mi := &file_student_proto_msgTypes[1]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use Students.ProtoReflect.Descriptor instead.
-func (*Students) Descriptor() ([]byte, []int) {
-	return file_student_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *Students) GetPerson() []*Student {
-	if x != nil {
-		return x.Person
-	}
-	return nil
-}
-
-func (x *Students) GetSchool() string {
-	if x != nil {
-		return x.School
-	}
-	return ""
-}
-
-var File_student_proto protoreflect.FileDescriptor
-
-var file_student_proto_rawDesc = []byte{
-	0x0a, 0x0d, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
-	0x07, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x22, 0x6d, 0x0a, 0x07, 0x53, 0x74, 0x75, 0x64,
-	0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
-	0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x67, 0x65, 0x18, 0x02,
-	0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64,
-	0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72,
-	0x65, 0x73, 0x73, 0x12, 0x22, 0x0a, 0x02, 0x63, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32,
-	0x12, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x2e, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4e,
-	0x61, 0x6d, 0x65, 0x52, 0x02, 0x63, 0x6e, 0x22, 0x4c, 0x0a, 0x08, 0x53, 0x74, 0x75, 0x64, 0x65,
-	0x6e, 0x74, 0x73, 0x12, 0x28, 0x0a, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20,
-	0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x73, 0x74, 0x75, 0x64, 0x65, 0x6e, 0x74, 0x2e, 0x53, 0x74,
-	0x75, 0x64, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x70, 0x65, 0x72, 0x73, 0x6f, 0x6e, 0x12, 0x16, 0x0a,
-	0x06, 0x73, 0x63, 0x68, 0x6f, 0x6f, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
-	0x63, 0x68, 0x6f, 0x6f, 0x6c, 0x2a, 0x2f, 0x0a, 0x09, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x4e, 0x61,
-	0x6d, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x31, 0x10, 0x00, 0x12, 0x0a,
-	0x0a, 0x06, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x32, 0x10, 0x01, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x6c,
-	0x61, 0x73, 0x73, 0x33, 0x10, 0x02, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x73, 0x74, 0x75, 0x64,
-	0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
-	file_student_proto_rawDescOnce sync.Once
-	file_student_proto_rawDescData = file_student_proto_rawDesc
-)
-
-func file_student_proto_rawDescGZIP() []byte {
-	file_student_proto_rawDescOnce.Do(func() {
-		file_student_proto_rawDescData = protoimpl.X.CompressGZIP(file_student_proto_rawDescData)
-	})
-	return file_student_proto_rawDescData
-}
-
-var file_student_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_student_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
-var file_student_proto_goTypes = []interface{}{
-	(ClassName)(0),   // 0: student.ClassName
-	(*Student)(nil),  // 1: student.Student
-	(*Students)(nil), // 2: student.Students
-}
-var file_student_proto_depIdxs = []int32{
-	0, // 0: student.Student.cn:type_name -> student.ClassName
-	1, // 1: student.Students.person:type_name -> student.Student
-	2, // [2:2] is the sub-list for method output_type
-	2, // [2:2] is the sub-list for method input_type
-	2, // [2:2] is the sub-list for extension type_name
-	2, // [2:2] is the sub-list for extension extendee
-	0, // [0:2] is the sub-list for field type_name
-}
-
-func init() { file_student_proto_init() }
-func file_student_proto_init() {
-	if File_student_proto != nil {
-		return
-	}
-	if !protoimpl.UnsafeEnabled {
-		file_student_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*Student); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-		file_student_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*Students); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-	}
-	type x struct{}
-	out := protoimpl.TypeBuilder{
-		File: protoimpl.DescBuilder{
-			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
-			RawDescriptor: file_student_proto_rawDesc,
-			NumEnums:      1,
-			NumMessages:   2,
-			NumExtensions: 0,
-			NumServices:   0,
-		},
-		GoTypes:           file_student_proto_goTypes,
-		DependencyIndexes: file_student_proto_depIdxs,
-		EnumInfos:         file_student_proto_enumTypes,
-		MessageInfos:      file_student_proto_msgTypes,
-	}.Build()
-	File_student_proto = out.File
-	file_student_proto_rawDesc = nil
-	file_student_proto_goTypes = nil
-	file_student_proto_depIdxs = nil
-}

+ 0 - 20
protocol/student/student.proto

@@ -1,20 +0,0 @@
-syntax="proto3"; //版本号
-package student;  //包名
-
-option go_package = ".;student";
-
-enum ClassName{   //枚举
-    class1=0;  //标号 必须从 0开始
-    class2=1;
-    class3=2;
-}
-message Student{ //消息,对应于Go的结构体
-  string name=1; //1:标号,唯一 即可(相当于数据库中的Id,不一定要从1 ,2的顺序依次排列。)
-  int32 age=2;  //必须指定整型的范围,如int32,int64
-  string address=3;
-  ClassName cn=4;
-}
-message Students{
-   repeated Student person=1;  // repeated 修饰,相当于Go中切片
-   string school=2;
-}

+ 0 - 165
protocol/testmsg/testmsg.pb.go

@@ -1,165 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// 	protoc-gen-go v1.24.0
-// 	protoc        v3.12.1
-// source: testmsg.proto
-
-package testmsg
-
-import (
-	proto "github.com/golang/protobuf/proto"
-	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
-	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
-	reflect "reflect"
-	sync "sync"
-)
-
-const (
-	// Verify that this generated code is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
-	// Verify that runtime/protoimpl is sufficiently up-to-date.
-	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-// This is a compile-time assertion that a sufficiently up-to-date version
-// of the legacy proto package is being used.
-const _ = proto.ProtoPackageIsVersion4
-
-type TestMessage struct {
-	state         protoimpl.MessageState
-	sizeCache     protoimpl.SizeCache
-	unknownFields protoimpl.UnknownFields
-
-	Name    string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
-	Age     int32  `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
-	Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address,omitempty"`
-}
-
-func (x *TestMessage) Reset() {
-	*x = TestMessage{}
-	if protoimpl.UnsafeEnabled {
-		mi := &file_testmsg_proto_msgTypes[0]
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		ms.StoreMessageInfo(mi)
-	}
-}
-
-func (x *TestMessage) String() string {
-	return protoimpl.X.MessageStringOf(x)
-}
-
-func (*TestMessage) ProtoMessage() {}
-
-func (x *TestMessage) ProtoReflect() protoreflect.Message {
-	mi := &file_testmsg_proto_msgTypes[0]
-	if protoimpl.UnsafeEnabled && x != nil {
-		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
-		if ms.LoadMessageInfo() == nil {
-			ms.StoreMessageInfo(mi)
-		}
-		return ms
-	}
-	return mi.MessageOf(x)
-}
-
-// Deprecated: Use TestMessage.ProtoReflect.Descriptor instead.
-func (*TestMessage) Descriptor() ([]byte, []int) {
-	return file_testmsg_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *TestMessage) GetName() string {
-	if x != nil {
-		return x.Name
-	}
-	return ""
-}
-
-func (x *TestMessage) GetAge() int32 {
-	if x != nil {
-		return x.Age
-	}
-	return 0
-}
-
-func (x *TestMessage) GetAddress() string {
-	if x != nil {
-		return x.Address
-	}
-	return ""
-}
-
-var File_testmsg_proto protoreflect.FileDescriptor
-
-var file_testmsg_proto_rawDesc = []byte{
-	0x0a, 0x0d, 0x74, 0x65, 0x73, 0x74, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
-	0x07, 0x74, 0x65, 0x73, 0x74, 0x6d, 0x73, 0x67, 0x22, 0x4d, 0x0a, 0x0b, 0x54, 0x65, 0x73, 0x74,
-	0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61,
-	0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x61, 0x67, 0x65, 0x12, 0x18, 0x0a,
-	0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
-	0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x3b, 0x74, 0x65, 0x73,
-	0x74, 0x6d, 0x73, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
-	file_testmsg_proto_rawDescOnce sync.Once
-	file_testmsg_proto_rawDescData = file_testmsg_proto_rawDesc
-)
-
-func file_testmsg_proto_rawDescGZIP() []byte {
-	file_testmsg_proto_rawDescOnce.Do(func() {
-		file_testmsg_proto_rawDescData = protoimpl.X.CompressGZIP(file_testmsg_proto_rawDescData)
-	})
-	return file_testmsg_proto_rawDescData
-}
-
-var file_testmsg_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
-var file_testmsg_proto_goTypes = []interface{}{
-	(*TestMessage)(nil), // 0: testmsg.TestMessage
-}
-var file_testmsg_proto_depIdxs = []int32{
-	0, // [0:0] is the sub-list for method output_type
-	0, // [0:0] is the sub-list for method input_type
-	0, // [0:0] is the sub-list for extension type_name
-	0, // [0:0] is the sub-list for extension extendee
-	0, // [0:0] is the sub-list for field type_name
-}
-
-func init() { file_testmsg_proto_init() }
-func file_testmsg_proto_init() {
-	if File_testmsg_proto != nil {
-		return
-	}
-	if !protoimpl.UnsafeEnabled {
-		file_testmsg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*TestMessage); i {
-			case 0:
-				return &v.state
-			case 1:
-				return &v.sizeCache
-			case 2:
-				return &v.unknownFields
-			default:
-				return nil
-			}
-		}
-	}
-	type x struct{}
-	out := protoimpl.TypeBuilder{
-		File: protoimpl.DescBuilder{
-			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
-			RawDescriptor: file_testmsg_proto_rawDesc,
-			NumEnums:      0,
-			NumMessages:   1,
-			NumExtensions: 0,
-			NumServices:   0,
-		},
-		GoTypes:           file_testmsg_proto_goTypes,
-		DependencyIndexes: file_testmsg_proto_depIdxs,
-		MessageInfos:      file_testmsg_proto_msgTypes,
-	}.Build()
-	File_testmsg_proto = out.File
-	file_testmsg_proto_rawDesc = nil
-	file_testmsg_proto_goTypes = nil
-	file_testmsg_proto_depIdxs = nil
-}

+ 0 - 10
protocol/testmsg/testmsg.proto

@@ -1,10 +0,0 @@
-syntax="proto3"; //版本号
-package testmsg;  //包名
-
-option go_package = ".;testmsg";
-
-message TestMessage{
-  string name=1;
-  int32 age=2;
-  string address=3;
-}

+ 0 - 50
protocol/testproto.go

@@ -1,50 +0,0 @@
-package protocol
-
-import (
-	"fmt"
-	"mtp2_if/protocol/student"
-	"mtp2_if/protocol/testmsg"
-
-	"github.com/golang/protobuf/proto"
-)
-
-// protobuf测试接口
-func TestProto() {
-	s1 := &student.Student{} //第一个学生信息
-	s1.Name = "jz01"
-	s1.Age = 23
-	s1.Address = "cq"
-	s1.Cn = student.ClassName_class2 //枚举类型赋值
-	ss := &student.Students{}
-	ss.Person = append(ss.Person, s1) //将第一个学生信息添加到Students对应的切片中
-	s2 := &student.Student{}          //第二个学生信息
-	s2.Name = "jz02"
-	s2.Age = 25
-	s2.Address = "cd"
-	s2.Cn = student.ClassName_class3
-	ss.Person = append(ss.Person, s2) //将第二个学生信息添加到Students对应的切片中
-	ss.School = "cqu"
-	fmt.Println("Students信息为:", ss)
-
-	// Marshal takes a protocol buffer message
-	// and encodes it into the wire format, returning the data.
-	buffer, _ := proto.Marshal(ss)
-	fmt.Println("序列化之后的信息为:", buffer)
-	// 	Use UnmarshalMerge to preserve and append to existing data.
-	data := &student.Students{}
-	proto.Unmarshal(buffer, data)
-	fmt.Println("反序列化之后的信息为:", data)
-
-	msg := &testmsg.TestMessage{}
-	msg.Name = "HU.XINYU"
-	msg.Age = 40
-	msg.Address = "123456"
-	fmt.Println("信息为:", msg)
-
-	buffer, _ = proto.Marshal(msg)
-	fmt.Println("序列化之后的信息为:", buffer)
-
-	msg1 := &testmsg.TestMessage{}
-	proto.Unmarshal(buffer, msg1)
-	fmt.Println("反序列化之后的信息为:", msg1)
-}