|
|
@@ -33,8 +33,8 @@ class ShopItemController extends AdminController
|
|
|
protected function grid()
|
|
|
{
|
|
|
return Grid::make(new ShopItemRepository(), function (Grid $grid) {
|
|
|
- // 预加载关联数据
|
|
|
- $grid->model()->with(['category', 'consumeGroup', 'rewardGroup']);
|
|
|
+ // 预加载关联数据,包括消耗组和奖励组的详细项目
|
|
|
+ $grid->model()->with(['category', 'consumeGroup.consumeItems', 'rewardGroup.rewardItems']);
|
|
|
|
|
|
$grid->column('id', 'ID')->sortable();
|
|
|
$grid->column('name', '商品名称');
|
|
|
@@ -68,6 +68,22 @@ class ShopItemController extends AdminController
|
|
|
return admin_url('game-reward-groups/' . $this->reward_group_id);
|
|
|
});
|
|
|
|
|
|
+ // 消耗组详情列
|
|
|
+ $grid->column('consume_group_details', '消耗组详情')->display(function () {
|
|
|
+ if (!$this->consumeGroup) {
|
|
|
+ return '<span class="text-muted">无消耗组</span>';
|
|
|
+ }
|
|
|
+ return $this->consumeGroup->formatConsumeDetails();
|
|
|
+ })->width('200px');
|
|
|
+
|
|
|
+ // 奖励组详情列
|
|
|
+ $grid->column('reward_group_details', '奖励组详情')->display(function () {
|
|
|
+ if (!$this->rewardGroup) {
|
|
|
+ return '<span class="text-muted">无奖励组</span>';
|
|
|
+ }
|
|
|
+ return $this->rewardGroup->formatRewardDetails();
|
|
|
+ })->width('200px');
|
|
|
+
|
|
|
$grid->column('max_buy', '购买限制')->display(function ($maxBuy) {
|
|
|
return $maxBuy > 0 ? $maxBuy : '无限制';
|
|
|
});
|