add cancel
This commit is contained in:
parent
06ca99cf73
commit
b3cce0de58
|
@ -30,12 +30,14 @@ func GetById(c *gin.Context) {
|
||||||
if res != nil {
|
if res != nil {
|
||||||
|
|
||||||
response = &proEnt.GetListByIdResp{
|
response = &proEnt.GetListByIdResp{
|
||||||
Id: res.Id,
|
Id: res.Id,
|
||||||
Name: res.Name,
|
Name: res.Name,
|
||||||
Price: res.Price,
|
Price: res.Price,
|
||||||
ProductUrl: res.ProductUrl,
|
ProductUrl: res.ProductUrl,
|
||||||
Status: res.Status,
|
Status: res.Status,
|
||||||
CreatedAt: res.CreatedAt.Format(time.RFC3339),
|
CreatedAt: res.CreatedAt.Format(time.RFC3339),
|
||||||
|
Type: res.Type,
|
||||||
|
ExtendParameter: res.ExtendParameter,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +74,14 @@ func Search(c *gin.Context) {
|
||||||
if len(res) > 0 {
|
if len(res) > 0 {
|
||||||
for _, item := range res {
|
for _, item := range res {
|
||||||
response = append(response, &proEnt.SearchResp{
|
response = append(response, &proEnt.SearchResp{
|
||||||
Id: item.Id,
|
Id: item.Id,
|
||||||
Name: item.Name,
|
Name: item.Name,
|
||||||
Price: item.Price,
|
Price: item.Price,
|
||||||
ProductUrl: item.ProductUrl,
|
ProductUrl: item.ProductUrl,
|
||||||
Status: item.Status,
|
Status: item.Status,
|
||||||
CreatedAt: item.CreatedAt.Format(time.RFC3339),
|
CreatedAt: item.CreatedAt.Format(time.RFC3339),
|
||||||
|
Type: item.Type,
|
||||||
|
ExtendParameter: item.ExtendParameter,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,10 +109,12 @@ func Create(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
product := &proMod.Product{
|
product := &proMod.Product{
|
||||||
Name: request.Name,
|
Name: request.Name,
|
||||||
Price: request.Price,
|
Price: request.Price,
|
||||||
ProductUrl: request.ProductUrl,
|
ProductUrl: request.ProductUrl,
|
||||||
Status: 1, //1.上架 2.下架
|
Status: 1, //1.上架 2.下架
|
||||||
|
Type: request.Type,
|
||||||
|
ExtendParameter: request.ExtendParameter,
|
||||||
}
|
}
|
||||||
|
|
||||||
affected, err := proServ.Create(product)
|
affected, err := proServ.Create(product)
|
||||||
|
@ -133,10 +139,12 @@ func Update(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
product := &proMod.Product{
|
product := &proMod.Product{
|
||||||
Id: request.Id,
|
Id: request.Id,
|
||||||
Name: request.Name,
|
Name: request.Name,
|
||||||
ProductUrl: request.ProductUrl,
|
ProductUrl: request.ProductUrl,
|
||||||
Price: request.Price,
|
Price: request.Price,
|
||||||
|
Type: request.Type,
|
||||||
|
ExtendParameter: request.ExtendParameter,
|
||||||
}
|
}
|
||||||
|
|
||||||
affected, err := proServ.Update(product)
|
affected, err := proServ.Update(product)
|
||||||
|
|
|
@ -5,13 +5,14 @@ type GetListByIdReq struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetListByIdResp struct {
|
type GetListByIdResp struct {
|
||||||
Id int64 `json:"id" example:"1"`
|
Id int64 `json:"id" example:"1"`
|
||||||
Name string `json:"name" example:"snow"`
|
Name string `json:"name" example:"snow"`
|
||||||
Price int64 `json:"price" example:"100"`
|
Price int64 `json:"price" example:"100"`
|
||||||
ProductUrl string `json:"product_url" example:"http://www.baidu.com"`
|
ProductUrl string `json:"product_url" example:"http://www.baidu.com"`
|
||||||
Status int64 `json:"status" example:"1"`
|
Status int64 `json:"status" example:"1"`
|
||||||
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
|
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
|
||||||
Type int64 `json:"type" example:"1"`
|
Type int64 `json:"type" example:"1"`
|
||||||
|
ExtendParameter string `json:"extend_parameter" example:"{}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearcgReq struct {
|
type SearcgReq struct {
|
||||||
|
@ -23,20 +24,22 @@ type SearcgReq struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchResp struct {
|
type SearchResp struct {
|
||||||
Id int64 `json:"id" example:"1"`
|
Id int64 `json:"id" example:"1"`
|
||||||
Name string `json:"name" example:"snow"`
|
Name string `json:"name" example:"snow"`
|
||||||
Price int64 `json:"price" example:"100"`
|
Price int64 `json:"price" example:"100"`
|
||||||
ProductUrl string `json:"product_url" example:"http://www.baidu.com"`
|
ProductUrl string `json:"product_url" example:"http://www.baidu.com"`
|
||||||
Status int64 `json:"status" example:"1"`
|
Status int64 `json:"status" example:"1"`
|
||||||
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
|
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
|
||||||
Type int64 `json:"type" example:"1"`
|
Type int64 `json:"type" example:"1"`
|
||||||
|
ExtendParameter string `json:"extend_parameter" example:"{}"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateReq struct {
|
type CreateReq struct {
|
||||||
Name string `json:"name" validate:"required"`
|
Name string `json:"name" validate:"required"`
|
||||||
Price int64 `json:"price" validate:"required"`
|
Price int64 `json:"price" validate:"required"`
|
||||||
ProductUrl string `json:"product_url" validate:"required"`
|
ProductUrl string `json:"product_url" validate:"required"`
|
||||||
Type int64 `json:"type" validate:"required"`
|
Type int64 `json:"type" validate:"required"`
|
||||||
|
ExtendParameter string `json:"extend_parameter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CreateResp struct {
|
type CreateResp struct {
|
||||||
|
@ -44,10 +47,12 @@ type CreateResp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateReq struct {
|
type UpdateReq struct {
|
||||||
Id int64 `json:"id" validate:"required"`
|
Id int64 `json:"id" validate:"required"`
|
||||||
Name string `json:"name" `
|
Name string `json:"name" `
|
||||||
Price int64 `json:"price" `
|
Price int64 `json:"price" `
|
||||||
ProductUrl string `json:"product_url" `
|
ProductUrl string `json:"product_url" `
|
||||||
|
Type int64 `json:"type" `
|
||||||
|
ExtendParameter string `json:"extend_parameter"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateResp struct {
|
type UpdateResp struct {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package product
|
package product
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -17,14 +16,15 @@ var (
|
||||||
* Product
|
* Product
|
||||||
*/
|
*/
|
||||||
type Product struct {
|
type Product struct {
|
||||||
Id int64 `xorm:"pk autoincr"` //注:使用getOne 或者ID() 需要设置主键
|
Id int64 `xorm:"pk autoincr"` //注:使用getOne 或者ID() 需要设置主键
|
||||||
Name string
|
Name string
|
||||||
Price int64
|
Price int64
|
||||||
ProductUrl string
|
ProductUrl string
|
||||||
Status int64
|
Status int64
|
||||||
CreatedAt time.Time `xorm:"created"`
|
CreatedAt time.Time `xorm:"created"`
|
||||||
|
|
||||||
Type int64
|
Type int64
|
||||||
|
ExtendParameter string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,6 @@ func (m *productModel) Search(id int64, name string, startTime string, endTime s
|
||||||
args = append(args, startTime, endTime)
|
args = append(args, startTime, endTime)
|
||||||
}
|
}
|
||||||
err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&product)
|
err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&product)
|
||||||
fmt.Println(err)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,12 +36,11 @@ func ReadGroup() (order *models.Orders, err error) {
|
||||||
jsonstr := res[key].(string)
|
jsonstr := res[key].(string)
|
||||||
json.Unmarshal([]byte(jsonstr), &order)
|
json.Unmarshal([]byte(jsonstr), &order)
|
||||||
|
|
||||||
|
|
||||||
return order, nil
|
return order, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func WriteOrder() {
|
func WriteOrder() {
|
||||||
fmt.Println("开始执行周期任务:getWxTransferStatus")
|
fmt.Println("开始执行周期任务:WriteOrder")
|
||||||
// 创建分组
|
// 创建分组
|
||||||
err := rdbmq.CreateStreamAndGroup("orders", "orders_one")
|
err := rdbmq.CreateStreamAndGroup("orders", "orders_one")
|
||||||
if err != nil && err.Error() != "BUSYGROUP Consumer Group name already exists" {
|
if err != nil && err.Error() != "BUSYGROUP Consumer Group name already exists" {
|
||||||
|
|
|
@ -40,7 +40,8 @@ create table product (
|
||||||
status tinyint, -- 1.上架 2.下架
|
status tinyint, -- 1.上架 2.下架
|
||||||
created_at timestamp default current_timestamp,
|
created_at timestamp default current_timestamp,
|
||||||
-- v2
|
-- v2
|
||||||
type tinyint-- 1.拼多多 2.多多进宝
|
type tinyint-- 1.拼多多 2.多多进宝 3. 拼多多+多多进宝
|
||||||
|
extend_parameter varchar(1024),
|
||||||
);
|
);
|
||||||
|
|
||||||
--注意不要链式充值
|
--注意不要链式充值
|
||||||
|
|
Loading…
Reference in New Issue