From de9a758c22da98a6141c3565f279a47f30e96823 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Thu, 21 Mar 2024 16:46:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=A1=A5=E8=B4=B4=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/coupon/StoreCouponRepository.php | 18 ++++++++++++++++++ .../admin/system/financial/Subsidy.php | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/app/common/repositories/store/coupon/StoreCouponRepository.php b/app/common/repositories/store/coupon/StoreCouponRepository.php index 698fe730..e4a04c56 100644 --- a/app/common/repositories/store/coupon/StoreCouponRepository.php +++ b/app/common/repositories/store/coupon/StoreCouponRepository.php @@ -744,4 +744,22 @@ class StoreCouponRepository extends BaseRepository return $merchantCart; } + /** + * 获取补贴类型 + * @param $type + * @return string + */ + public static function getTypename($type) + { + if ($type == self::TYPE_STORE_COUPON) { + return '春耕采购补贴'; + } elseif ($type == self::TYPE_SALE_SUBSIDY) { + return '增收补贴'; + } elseif ($type == self::TYPE_PLATFORM_CARD) { + return '春耕采购余额'; + } else { + return ''; + } + } + } diff --git a/app/controller/admin/system/financial/Subsidy.php b/app/controller/admin/system/financial/Subsidy.php index bd1bb58a..1a2d4519 100644 --- a/app/controller/admin/system/financial/Subsidy.php +++ b/app/controller/admin/system/financial/Subsidy.php @@ -26,6 +26,8 @@ class Subsidy extends BaseController $query->with(['merchant' => function (Query $query) { $query->field('mer_id,uid,mer_name'); }])->field('uid,nickname,avatar'); + }, 'coupon' => function (Query $query) { + $query->field('coupon_id,type'); }]) ->where('status', StoreCouponDetail::STATUS_INVALID) ->where('type', StoreCouponDetail::TYPE_INCOME); @@ -48,6 +50,10 @@ class Subsidy extends BaseController $list = $query->page($page, $limit)->order('send_status asc')->order('id desc')->select()->toArray(); $append = ['field' => 'send_status', 'value' => 'send_status_name', 'relation' => StoreCouponDetail::SEND_STATUS_MAP]; $list = append_to_array($list, $append); + foreach ($list as &$item) { + $item['coupon_type_name'] = StoreCouponRepository::getTypename($item['coupon']['type']); + unset($item['coupon']); + } return app('json')->success(['count' => $count, 'list'=> $list]); }