diff --git a/app/admin/svc/order/svc_order_pay.go b/app/admin/svc/order/svc_order_pay.go index bb5891b..19f6b04 100644 --- a/app/admin/svc/order/svc_order_pay.go +++ b/app/admin/svc/order/svc_order_pay.go @@ -11,6 +11,7 @@ import ( "errors" "fmt" "github.com/gin-gonic/gin" + "strings" "time" "xorm.io/xorm" ) @@ -51,6 +52,7 @@ func GoodsPayCreate(c *gin.Context) { BuyPhone: req.BuyInfo.Phone, Amount: utils.Float64ToStr(amount), State: 1, + Date: utils.StrToInt(strings.ReplaceAll(req.BuyInfo.Date, "-", "")), } one, err := sess.InsertOne(&order) if one == 0 || err != nil { diff --git a/app/db/db_order_list.go b/app/db/db_order_list.go index 30095a6..365bd80 100644 --- a/app/db/db_order_list.go +++ b/app/db/db_order_list.go @@ -60,6 +60,10 @@ func GetOrderList(eg *xorm.Engine, param map[string]string) (*[]model.Order, int if param["end_at"] != "" { sess.And("create_at <= ?", param["end_at"]) } + if param["date"] != "" { + param["date"] = strings.ReplaceAll(param["date"], "-", "") + sess.And("date = ?", param["date"]) + } if param["enterprise_name"] != "" { var enterprise []model.Enterprise eg.Where("name like ?", "%"+param["enterprise_name"]+"%").Find(&enterprise) diff --git a/app/db/model/order.go b/app/db/model/order.go index 1c2e460..1e05530 100644 --- a/app/db/model/order.go +++ b/app/db/model/order.go @@ -11,6 +11,7 @@ type Order struct { CreateAt time.Time `json:"create_at" xorm:"comment('下单时间') DATETIME"` CancelAt time.Time `json:"cancel_at" xorm:"comment('取消时间') DATETIME"` EnterpriseId int `json:"enterprise_id" xorm:"default 0 comment('校企id') INT(11)"` + Date int `json:"date" xorm:"default 0 comment('校企id') INT(11)"` BuyInfo string `json:"buy_info" xorm:"comment('购买人信息 json') VARCHAR(2000)"` Amount string `json:"amount" xorm:"default 0.00 comment('付款金额') DECIMAL(20,2)"` BuyPhone string `json:"buy_phone" xorm:"comment('购买人手机') VARCHAR(20)"`