完善套餐与账单接口 & 完善支付数据保存,记录实付价格并关联优惠券

This commit is contained in:
2026-03-26 14:39:19 +08:00
parent 5ffa151f58
commit 75ad12efb3
23 changed files with 706 additions and 613 deletions

View File

@@ -47,10 +47,24 @@ func PageBillByAdmin(c *fiber.Ctx) error {
time := u.DateHead(*req.CreatedAtEnd)
do = do.Where(q.Bill.CreatedAt.Lte(time))
}
if req.ProductCode != nil {
do = do.Where(q.Resource.As("Resource").Code.Eq(*req.ProductCode))
}
if req.SkuCode != nil {
do = do.Where(q.Bill.
Where(q.ResourceShort.As("Resource__Short").Code.Eq(*req.SkuCode)).
Or(q.ResourceLong.As("Resource__Long").Code.Eq(*req.SkuCode)))
}
// 查询用户列表
list, total, err := q.Bill.Debug().
Joins(q.Bill.User, q.Bill.Resource, q.Bill.Trade).
Joins(
q.Bill.User,
q.Bill.Resource,
q.Bill.Trade,
q.Bill.Resource.Short,
q.Bill.Resource.Long,
).
Select(
q.Bill.ALL,
q.User.As("User").Phone.As("User__phone"),
@@ -82,6 +96,8 @@ type PageBillByAdminReq struct {
BillNo *string `json:"bill_no,omitempty"`
CreatedAtStart *time.Time `json:"created_at_start,omitempty"`
CreatedAtEnd *time.Time `json:"created_at_end,omitempty"`
ProductCode *string `json:"product_code,omitempty"`
SkuCode *string `json:"sku_code,omitempty"`
}
// ListBill 获取账单列表