mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-11-09 03:50:26 +08:00
优化代码
This commit is contained in:
@@ -95,8 +95,8 @@ func (this *UserBillService) ListUserBills(ctx context.Context, req *pb.ListUser
|
||||
Description: bill.Description,
|
||||
Amount: float32(bill.Amount),
|
||||
Month: bill.Month,
|
||||
CanPay: bill.CanPay == 1,
|
||||
IsPaid: bill.IsPaid == 1,
|
||||
CanPay: bill.CanPay,
|
||||
IsPaid: bill.IsPaid,
|
||||
PaidAt: int64(bill.PaidAt),
|
||||
Code: bill.Code,
|
||||
})
|
||||
@@ -153,8 +153,8 @@ func (this *UserBillService) FindUserBill(ctx context.Context, req *pb.FindUserB
|
||||
Description: bill.Description,
|
||||
Amount: float32(bill.Amount),
|
||||
Month: bill.Month,
|
||||
CanPay: bill.CanPay == 1,
|
||||
IsPaid: bill.IsPaid == 1,
|
||||
CanPay: bill.CanPay,
|
||||
IsPaid: bill.IsPaid,
|
||||
PaidAt: int64(bill.PaidAt),
|
||||
Code: bill.Code,
|
||||
},
|
||||
@@ -188,7 +188,7 @@ func (this *UserBillService) PayUserBill(ctx context.Context, req *pb.PayUserBil
|
||||
userId = int64(bill.UserId)
|
||||
|
||||
// 是否已支付
|
||||
if bill.IsPaid == 1 {
|
||||
if bill.IsPaid {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -197,7 +197,7 @@ func (this *UserBillService) PayUserBill(ctx context.Context, req *pb.PayUserBil
|
||||
return models.SharedUserBillDAO.UpdateUserBillIsPaid(tx, req.UserBillId, true)
|
||||
}
|
||||
|
||||
if bill.CanPay == 0 {
|
||||
if !bill.CanPay {
|
||||
return errors.New("can not pay now")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user