|
|
|
@ -130,15 +130,29 @@ class PlanController extends Controller
|
|
|
|
$pageSize = request('pageSize');
|
|
|
|
$pageSize = request('pageSize');
|
|
|
|
$searchInfo = request('searchInfo');
|
|
|
|
$searchInfo = request('searchInfo');
|
|
|
|
$list = DB::table('plans as a')
|
|
|
|
$list = DB::table('plans as a')
|
|
|
|
// ->leftJoin('plan_type as b','a.plan_type','=','b.id')
|
|
|
|
->select('a.*','b.name as username','b.phone')
|
|
|
|
// ->select('a.*','b.name as plan_type_name')
|
|
|
|
->leftJoin('orders as b', 'a.id', '=', 'b.plan_id')
|
|
|
|
->where(['a.is_del' => 0]);
|
|
|
|
->where(['a.is_del' => 0]);
|
|
|
|
|
|
|
|
|
|
|
|
if (!isset($searchInfo['date'])) {
|
|
|
|
if (!isset($searchInfo['date'])) {
|
|
|
|
$searchInfo['date'] = date('Y-m-d');
|
|
|
|
$searchInfo['date'] = date('Y-m-d');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$list = $list->where(['a.date' => $searchInfo['date']]);
|
|
|
|
$list = $list->where(['a.date' => $searchInfo['date']]);
|
|
|
|
$count = $list->count();
|
|
|
|
$count = $list->count();
|
|
|
|
$list = $list->orderBy('a.id', 'asc')->get();
|
|
|
|
$list = $list->orderBy('a.id', 'asc')->get();
|
|
|
|
|
|
|
|
$plan_model=DB::table('plan_model_time')
|
|
|
|
|
|
|
|
->select('plan_model_time.*', 'plan_type.name as plan_type_name')
|
|
|
|
|
|
|
|
->leftJoin('plan_type', 'plan_type.id', '=', 'plan_model_time.plan_type_id')
|
|
|
|
|
|
|
|
->get();
|
|
|
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
|
|
|
$list[$k]->plan_type_name = '';
|
|
|
|
|
|
|
|
foreach ($plan_model as $k1 => $v1) {
|
|
|
|
|
|
|
|
if ($v1->model_id == $v->model_id) {
|
|
|
|
|
|
|
|
$list[$k]->plan_type_name = $v1->plan_type_name;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return \Yz::Return(true, '查询完成', ['list' => $list, 'count' => $count, 'date' => $searchInfo['date']]);
|
|
|
|
return \Yz::Return(true, '查询完成', ['list' => $list, 'count' => $count, 'date' => $searchInfo['date']]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|