修复膨胀人数没有对人气跟单生效

main
jcadmin 2026-07-04 19:18:43 +08:00
parent b68aa6d12c
commit dde1883809
2 changed files with 12 additions and 9 deletions

View File

@ -9,6 +9,7 @@ use Dcat\Admin\Form;
use Dcat\Admin\Grid; use Dcat\Admin\Grid;
use Dcat\Admin\Http\Controllers\AdminController; use Dcat\Admin\Http\Controllers\AdminController;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log;
class OrderFakeController extends AdminController class OrderFakeController extends AdminController
{ {
@ -18,11 +19,6 @@ class OrderFakeController extends AdminController
protected function grid() protected function grid()
{ {
$orders = OrderFake::paging(1);
foreach ($orders as $item) {
$item->fake_count += 100;
}
dd($orders->toArray());
return Grid::make(OrderFake::class, function (Grid $grid) { return Grid::make(OrderFake::class, function (Grid $grid) {
$grid->model()->with([ $grid->model()->with([
'customer:id,name,nickname,phone', 'customer:id,name,nickname,phone',
@ -58,7 +54,9 @@ class OrderFakeController extends AdminController
}); });
}, '发单人名称'); }, '发单人名称');
}); });
$grid->disableEditButton();
$grid->disableDeleteButton();
$grid->disableActions();
$grid->disableViewButton(); $grid->disableViewButton();
$grid->scrollbarX(); $grid->scrollbarX();
}); });
@ -174,6 +172,9 @@ JS
$form->created_by = Admin::user()->id; $form->created_by = Admin::user()->id;
} }
}); });
$form->saved(function (Form $form) {
Order::where('order_sn', $form->order_sn)->increment('gendan_num', $form->fake_count);
});
$form->footer(function ($footer) { $form->footer(function ($footer) {
$footer->disableViewCheck(); $footer->disableViewCheck();

View File

@ -429,9 +429,11 @@ class Order extends BaseModel
->where('pay_state', PayState::SUCCESS) ->where('pay_state', PayState::SUCCESS)
->whereIn('lottery_state', $this->gendanLotteryState()) ->whereIn('lottery_state', $this->gendanLotteryState())
->count(); ->count();
$fake = OrderFake::where('order_sn', $this->order_sn)->first(); if ($this->created_date <= '20260704') {
if ($fake) { $fake = OrderFake::where('order_sn', $this->order_sn)->first();
$gendanCount += $fake->fake_count; if ($fake) {
$gendanCount += $fake->fake_count;
}
} }
$info['count_gendan'] = $gendanCount; $info['count_gendan'] = $gendanCount;
$info['count_default_show'] = 10; $info['count_default_show'] = 10;