Jing Li 2024-05-31 10:47:40 +08:00
parent 987c921052
commit f237b091e1
1 changed files with 7 additions and 2 deletions

View File

@ -6,6 +6,7 @@ use App\Exceptions\RuntimeException;
use App\Models\Keyword;
use App\Models\Ledger;
use App\Models\LedgerItem;
use App\Models\Store;
use App\Models\TaskLedger;
use App\Models\TaskPerformance;
use Illuminate\Http\Request;
@ -199,15 +200,19 @@ class LedgerController extends Controller
$storeId = $request->whenFilled('store_id', fn ($storeId) => $storeId, fn () => $user->store_id);
if (is_null($store = Store::find($storeId))) {
throw new RuntimeException('门店未找到');
}
/** @var \App\Models\Ledger|null */
$ledger = Ledger::with(['items'])
->where('store_id', $storeId)
->where('store_id', $store->id)
->where('date', $date)
->first();
$items = [];
if ($user->store?->isLotteryStore()) {
if ($store->isLotteryStore()) {
/** @var \Illuminate\Database\Eloquent\Collection */
$lotteryTypes = Keyword::filter(['parent_key' => 'lottery_type'])
->oldest('sort')