6
0
Fork 0

admin/api skus query

base
panliang 2023-10-17 13:39:21 +08:00
parent c23990f7d3
commit a6eff46f3a
2 changed files with 8 additions and 3 deletions

View File

@ -166,13 +166,17 @@ class ProductSkuController extends AdminController
{
$name = $request->input('q');
$query = ProductSkuModel::select('id', 'name as text');
$query = ProductSkuModel::query();
if ($name) {
$query->where('name', 'like', "%$name%");
return $query->paginate(null);
}
$list = $query->get();
return response()->json($query->get());
return response()->json([
'data' => $list->map(function ($item) {
return ['id' => $item->id, 'text' => $item->name . '-----库存('.$item->stock.')'];
})
]);
}
}

View File

@ -24,6 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(fn () => logger('schedule running'))->everyMinute();
$schedule->command('order-profit:send')->daily();
$schedule->command('order-profit:check')->daily();
}