调整补贴列表

This commit is contained in:
luofei 2024-03-21 16:46:57 +08:00
parent c2d6ece975
commit de9a758c22
2 changed files with 24 additions and 0 deletions

View File

@ -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 '';
}
}
}

View File

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