From 0d1631cbb9ca01d9b75ed0f8cffb7462edce6ddc Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Wed, 22 Dec 2021 16:46:51 +0800 Subject: [PATCH] settter --- app/repository/BillRepository.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/repository/BillRepository.php b/app/repository/BillRepository.php index 5a74f1d..3fb5163 100644 --- a/app/repository/BillRepository.php +++ b/app/repository/BillRepository.php @@ -225,8 +225,9 @@ class BillRepository extends Repository */ public function getAgencyMoneySum($field, $keyword = null, $start_time = null, $end_time = null) { + return CouponBill::alias("a") - ->join("business b", "a.business_code = b.code", "left") + ->join("business b", "a.business_code = b.code") ->join("business e", "a.agency_code = e.code", "left") ->join("account c", "a.user_code = c.user_code") ->join("coupon_main d", "a.coupon_main_id = d.id") @@ -240,7 +241,7 @@ class BillRepository extends Repository $q->whereTime("a.create_time", "<=", $end_time); }) ->when(MemberModel::is_agency(session("auth")['roles']), function ($q) { - $q->where("a.agency_code", "=", session("auth")['business_code']); + $q->where("b.agency_code", "=", session("auth")['business_code']); }) ->sum("a." . $field); } @@ -281,6 +282,7 @@ class BillRepository extends Repository ->join("business c", "a.business_code = c.code") ->join("member d", "a.member_id = d.id", "left") ->join("business e", "c.agency_code = e.code", "left") + ->where("a.state",Recharge::state_on) ->when(!empty($keyword), function ($q) use ($keyword) { $q->whereTime("c.business_name|e.business_name", "like", "%" . $keyword . "%"); })