You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.0 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\ProfitsharingLog;
use Illuminate\Http\Request;
use Login;
use Yo;
class ProfitsharingLogController extends Controller
{
public function list(Request $request)
{
Login::admin([], [31, 32]);
$hospital = $request->post('hospital');
if (Login::$info->hospital != 0) {
if ($hospital != Login::$info->hospital) {
Yo::error_echo(100000, ['机构/医院']);
}
}
$start_time = $request->post('start_time');
$end_time = $request->post('end_time');
$time = $request->post('time');
$status = $request->post('status');
$list = ProfitsharingLog::select('*')
->where('hospital', $hospital)
->where(function ($query) use ($status) {
if ($status != 0) $query->where('status', $status);
});
if (!!$start_time) {
$list->where('created_at', '>=', $start_time);
}
if (!!$end_time) {
$list->where('created_at', '<=', $end_time);
}
return Yo::echo($list->orderBy('id', 'desc')->paginate(10));
}
}