fix: stats
This commit is contained in:
@@ -227,7 +227,7 @@ func (m *ordersModel) Count(ctx context.Context, cond BoolExpression) (int64, er
|
||||
func (m *ordersModel) SumAmount(ctx context.Context) (int64, error) {
|
||||
tbl := table.Orders
|
||||
stmt := SELECT(SUM(tbl.Price).AS("cnt")).FROM(tbl).WHERE(
|
||||
tbl.Status.EQ(Int(int64(fields.OrderStatusPaid))),
|
||||
tbl.Status.EQ(Int(int64(fields.OrderStatusCompleted))),
|
||||
)
|
||||
m.log.Infof("sql: %s", stmt.DebugSql())
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ func (m *postsModel) Bought(ctx context.Context, userId int64, pagination *reque
|
||||
tbl.INNER_JOIN(table.Posts, table.Posts.ID.EQ(tbl.PostID)),
|
||||
).
|
||||
WHERE(
|
||||
tbl.UserID.EQ(Int64(1)),
|
||||
tbl.UserID.EQ(Int64(userId)),
|
||||
).
|
||||
ORDER_BY(tbl.ID.DESC()).
|
||||
LIMIT(pagination.Limit).
|
||||
|
||||
Reference in New Issue
Block a user