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]); }