add cancel

This commit is contained in:
duyu 2024-07-26 17:56:54 +08:00
parent 06ca99cf73
commit b3cce0de58
5 changed files with 66 additions and 54 deletions

View File

@ -36,6 +36,8 @@ func GetById(c *gin.Context) {
ProductUrl: res.ProductUrl,
Status: res.Status,
CreatedAt: res.CreatedAt.Format(time.RFC3339),
Type: res.Type,
ExtendParameter: res.ExtendParameter,
}
}
@ -78,6 +80,8 @@ func Search(c *gin.Context) {
ProductUrl: item.ProductUrl,
Status: item.Status,
CreatedAt: item.CreatedAt.Format(time.RFC3339),
Type: item.Type,
ExtendParameter: item.ExtendParameter,
})
}
}
@ -109,6 +113,8 @@ func Create(c *gin.Context) {
Price: request.Price,
ProductUrl: request.ProductUrl,
Status: 1, //1.上架 2.下架
Type: request.Type,
ExtendParameter: request.ExtendParameter,
}
affected, err := proServ.Create(product)
@ -137,6 +143,8 @@ func Update(c *gin.Context) {
Name: request.Name,
ProductUrl: request.ProductUrl,
Price: request.Price,
Type: request.Type,
ExtendParameter: request.ExtendParameter,
}
affected, err := proServ.Update(product)

View File

@ -12,6 +12,7 @@ type GetListByIdResp struct {
Status int64 `json:"status" example:"1"`
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
Type int64 `json:"type" example:"1"`
ExtendParameter string `json:"extend_parameter" example:"{}"`
}
type SearcgReq struct {
@ -30,6 +31,7 @@ type SearchResp struct {
Status int64 `json:"status" example:"1"`
CreatedAt string `json:"created_at" example:"2020-01-01 00:00:00"`
Type int64 `json:"type" example:"1"`
ExtendParameter string `json:"extend_parameter" example:"{}"`
}
type CreateReq struct {
@ -37,6 +39,7 @@ type CreateReq struct {
Price int64 `json:"price" validate:"required"`
ProductUrl string `json:"product_url" validate:"required"`
Type int64 `json:"type" validate:"required"`
ExtendParameter string `json:"extend_parameter"`
}
type CreateResp struct {
@ -48,6 +51,8 @@ type UpdateReq struct {
Name string `json:"name" `
Price int64 `json:"price" `
ProductUrl string `json:"product_url" `
Type int64 `json:"type" `
ExtendParameter string `json:"extend_parameter"`
}
type UpdateResp struct {

View File

@ -1,7 +1,6 @@
package product
import (
"fmt"
"sync"
"time"
@ -25,6 +24,7 @@ type Product struct {
CreatedAt time.Time `xorm:"created"`
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)
}
err = m.GetDb().Where(sql, args...).OrderBy("created_at desc").Limit(limit, page).Find(&product)
fmt.Println(err)
return
}

View File

@ -36,12 +36,11 @@ func ReadGroup() (order *models.Orders, err error) {
jsonstr := res[key].(string)
json.Unmarshal([]byte(jsonstr), &order)
return order, nil
}
func WriteOrder() {
fmt.Println("开始执行周期任务:getWxTransferStatus")
fmt.Println("开始执行周期任务:WriteOrder")
// 创建分组
err := rdbmq.CreateStreamAndGroup("orders", "orders_one")
if err != nil && err.Error() != "BUSYGROUP Consumer Group name already exists" {

View File

@ -40,7 +40,8 @@ create table product (
status tinyint, -- 1.上架 2.下架
created_at timestamp default current_timestamp,
-- v2
type tinyint-- 1.拼多多 2.多多进宝
type tinyint-- 1.拼多多 2.多多进宝 3. 拼多多+多多进宝
extend_parameter varchar(1024),
);
--