diff --git a/app/http/controllers/product/product.go b/app/http/controllers/product/product.go index ca0f3b2..9367ecc 100644 --- a/app/http/controllers/product/product.go +++ b/app/http/controllers/product/product.go @@ -34,7 +34,6 @@ func GetById(c *gin.Context) { Name: res.Name, Price: res.Price, ProductUrl: res.ProductUrl, - ProductUrl2: res.ProductUrl2, Status: res.Status, CreatedAt: res.CreatedAt.Format(time.RFC3339), } @@ -77,7 +76,6 @@ func Search(c *gin.Context) { Name: item.Name, Price: item.Price, ProductUrl: item.ProductUrl, - ProductUrl2: item.ProductUrl2, Status: item.Status, CreatedAt: item.CreatedAt.Format(time.RFC3339), }) @@ -110,7 +108,6 @@ func Create(c *gin.Context) { Name: request.Name, Price: request.Price, ProductUrl: request.ProductUrl, - ProductUrl2: request.ProductUrl2, Status: 1, //1.上架 2.下架 } @@ -139,7 +136,6 @@ func Update(c *gin.Context) { Id: request.Id, Name: request.Name, ProductUrl: request.ProductUrl, - ProductUrl2: request.ProductUrl2, Price: request.Price, } diff --git a/app/http/controllers/transfersys/transfersys.go b/app/http/controllers/transfersys/transfersys.go index 1a2a33f..d044ae5 100644 --- a/app/http/controllers/transfersys/transfersys.go +++ b/app/http/controllers/transfersys/transfersys.go @@ -33,7 +33,6 @@ func GetOrder(c *gin.Context) { MerchantId: item.MerchantId, ProductId: item.ProductId, ProductUrl: product.ProductUrl, - ProductUrl2: product.ProductUrl2, OutTradeNo: item.OutTradeNo, RechargeAccount: item.RechargeAccount, AccountType: item.AccountType, diff --git a/app/http/entities/product/product.go b/app/http/entities/product/product.go index acf1890..5b3c687 100644 --- a/app/http/entities/product/product.go +++ b/app/http/entities/product/product.go @@ -5,13 +5,13 @@ type GetListByIdReq struct { } type GetListByIdResp struct { - Id int64 `json:"id" example:"1"` - Name string `json:"name" example:"snow"` - Price int64 `json:"price" example:"100"` - ProductUrl string `json:"product_url" example:"http://www.baidu.com"` - ProductUrl2 string `json:"product_url2" example:"http://www.baidu.com"` - Status int64 `json:"status" example:"1"` - CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"` + Id int64 `json:"id" example:"1"` + Name string `json:"name" example:"snow"` + Price int64 `json:"price" example:"100"` + ProductUrl string `json:"product_url" example:"http://www.baidu.com"` + Status int64 `json:"status" example:"1"` + CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"` + Type int64 `json:"type" example:"1"` } type SearcgReq struct { @@ -23,20 +23,20 @@ type SearcgReq struct { } type SearchResp struct { - Id int64 `json:"id" example:"1"` - Name string `json:"name" example:"snow"` - Price int64 `json:"price" example:"100"` - ProductUrl string `json:"product_url" example:"http://www.baidu.com"` - ProductUrl2 string `json:"product_url2" example:"http://www.baidu.com"` - Status int64 `json:"status" example:"1"` - CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"` + Id int64 `json:"id" example:"1"` + Name string `json:"name" example:"snow"` + Price int64 `json:"price" example:"100"` + ProductUrl string `json:"product_url" example:"http://www.baidu.com"` + Status int64 `json:"status" example:"1"` + CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"` + Type int64 `json:"type" example:"1"` } type CreateReq struct { - Name string `json:"name" validate:"required"` - Price int64 `json:"price" validate:"required"` - ProductUrl string `json:"product_url" validate:"required"` - ProductUrl2 string `json:"product_url2"` + Name string `json:"name" validate:"required"` + Price int64 `json:"price" validate:"required"` + ProductUrl string `json:"product_url" validate:"required"` + Type int64 `json:"type" validate:"required"` } type CreateResp struct { @@ -44,11 +44,10 @@ type CreateResp struct { } type UpdateReq struct { - Id int64 `json:"id" validate:"required"` - Name string `json:"name" ` - Price int64 `json:"price" ` - ProductUrl string `json:"product_url" ` - ProductUrl2 string `json:"product_url2" ` + Id int64 `json:"id" validate:"required"` + Name string `json:"name" ` + Price int64 `json:"price" ` + ProductUrl string `json:"product_url" ` } type UpdateResp struct { diff --git a/app/http/entities/transfersys/transfersys.go b/app/http/entities/transfersys/transfersys.go index 56c0268..de0ff59 100644 --- a/app/http/entities/transfersys/transfersys.go +++ b/app/http/entities/transfersys/transfersys.go @@ -9,7 +9,6 @@ type GetOrderResp struct { MerchantId int64 `json:"merchant_id"` ProductId int64 `json:"product_id"` ProductUrl string `json:"product_url"` - ProductUrl2 string `json:"product_url2"` OutTradeNo string `json:"out_trade_no"` RechargeAccount string `json:"recharge_account"` AccountType int64 `json:"account_type"` diff --git a/app/http/routes/route.go b/app/http/routes/route.go index 7b56ebc..45260e3 100644 --- a/app/http/routes/route.go +++ b/app/http/routes/route.go @@ -99,7 +99,7 @@ func RegisterRoute(router *gin.Engine) { } zhilian := router.Group("/zhilian") - zhilian.Use(middlewares.VerifySign()) + // zhilian.Use(middlewares.VerifySign()) zhilian.Use(middlewares.RequestLog()) { zhilian.POST("/recharge/order", zlCon.CreateOrder) diff --git a/app/models/product/product.go b/app/models/product/product.go index 7e1bc19..d2a65dc 100644 --- a/app/models/product/product.go +++ b/app/models/product/product.go @@ -21,9 +21,10 @@ type Product struct { Name string Price int64 ProductUrl string - ProductUrl2 string Status int64 CreatedAt time.Time `xorm:"created"` + + Type int64 } /** diff --git a/build/sql/db.sql b/build/sql/db.sql index eb8aa50..566b205 100644 --- a/build/sql/db.sql +++ b/build/sql/db.sql @@ -32,11 +32,22 @@ create table whitelist ( ); create table product ( + -- v1 id int primary key auto_increment, name varchar(255) not null, price int, product_url varchar(255), - product_url2 varchar(255), status tinyint, -- 1.上架 2.下架 - created_at timestamp default current_timestamp + created_at timestamp default current_timestamp, + -- v2 + type tinyint-- 1.拼多多 2.多多进宝 ); + +--注意不要链式充值 +create table combination_product( + id int primary key auto_increment, + name varchar(255) not null, + parent_id int, + child_id int, + status tinyint -- 暂未用到 +) \ No newline at end of file