|
|
@ -97,17 +97,15 @@ class RenewalController extends BaseController |
|
|
|
$car_man = $request->get('car_man'); |
|
|
|
$car_man = $request->get('car_man'); |
|
|
|
$phone = $request->get('phone'); |
|
|
|
$phone = $request->get('phone'); |
|
|
|
$car_no = $request->get('car_no'); |
|
|
|
$car_no = $request->get('car_no'); |
|
|
|
$page = $request->get('page',1); |
|
|
|
|
|
|
|
$username = $request->get('username'); |
|
|
|
$username = $request->get('username'); |
|
|
|
$sort_key = $request->get('sort_key','appointment_t.pdate'); |
|
|
|
$sort_key = $request->get('sort_key','appointment_t.pdate'); |
|
|
|
$sort_value = $request->get('sort_value','ASC'); |
|
|
|
$sort_value = $request->get('sort_value','ASC'); |
|
|
|
$user_id = $request->get('user_id'); |
|
|
|
|
|
|
|
$offset = $request->get('offset',0); |
|
|
|
$offset = $request->get('offset',0); |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
$limit = $request->get('limit', 10); |
|
|
|
|
|
|
|
|
|
|
|
$query = AppointmentT::find() |
|
|
|
$query = AppointmentT::find() |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->where('appointment_t.is_first=1 and car_t.location=2'); |
|
|
|
->where('appointment_t.is_first=1 and car_t.location=4'); |
|
|
|
|
|
|
|
|
|
|
|
if($username == '') { |
|
|
|
if($username == '') { |
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
@ -118,7 +116,7 @@ class RenewalController extends BaseController |
|
|
|
$query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
$query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($phone != '') { |
|
|
|
if($phone != '') { |
|
|
|
$query->andWhere('car_t.phone like "'.$phone.'"'); |
|
|
|
$query->andWhere('car_t.car_man_phone like "'.$phone.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($car_no != '') { |
|
|
|
if($car_no != '') { |
|
|
|
$query->andWhere('car_t.car_no like "'.$car_no.'"'); |
|
|
|
$query->andWhere('car_t.car_no like "'.$car_no.'"'); |
|
|
@ -137,12 +135,11 @@ class RenewalController extends BaseController |
|
|
|
$query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value); |
|
|
|
$query->orderBy($sort_key.' '.$sort_value.',appointment_t.id '.$sort_value); |
|
|
|
} |
|
|
|
} |
|
|
|
$sql = $query->createCommand()->rawSql; |
|
|
|
$sql = $query->createCommand()->rawSql; |
|
|
|
// echo $query->createCommand()->rawSql; |
|
|
|
|
|
|
|
$total = $query->count(); |
|
|
|
$total = $query->count(); |
|
|
|
$session->remove('appointment_first'); |
|
|
|
$session->remove('appointment_first'); |
|
|
|
$session->set('appointment_first',$sql); |
|
|
|
$session->set('appointment_first',$sql); |
|
|
|
|
|
|
|
|
|
|
|
$query = $query->offset($offset)->limit($limit); |
|
|
|
$query->offset($offset)->limit($limit); |
|
|
|
$items = $query->all(); |
|
|
|
$items = $query->all(); |
|
|
|
|
|
|
|
|
|
|
|
$data = []; |
|
|
|
$data = []; |
|
|
@ -189,7 +186,7 @@ class RenewalController extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
$query = AppointmentT::find() |
|
|
|
$query = AppointmentT::find() |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->where('appointment_t.is_first=0 and car_t.location=2') |
|
|
|
->where('appointment_t.is_first=0 and car_t.location=4') |
|
|
|
->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); |
|
|
|
->andWhere('appointment_t.pdate<="'.date('Y-m-d').'"'); |
|
|
|
|
|
|
|
|
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
@ -199,7 +196,7 @@ class RenewalController extends BaseController |
|
|
|
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($phone != '') { |
|
|
|
if($phone != '') { |
|
|
|
$query = $query->andWhere('car_t.phone="'.$phone.'"'); |
|
|
|
$query = $query->andWhere('car_t.car_man_phone="'.$phone.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($ptype > 0) { |
|
|
|
if($ptype > 0) { |
|
|
|
$query = $query->andWhere('appointment_t.ptype='.$ptype); |
|
|
|
$query = $query->andWhere('appointment_t.ptype='.$ptype); |
|
|
@ -265,7 +262,7 @@ class RenewalController extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
$query = AppointmentT::find() |
|
|
|
$query = AppointmentT::find() |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->leftJoin('car_t','`car_t`.`id`=`appointment_t`.`car_id`') |
|
|
|
->where('appointment_t.is_first=0 and car_t.location=2'); |
|
|
|
->where('appointment_t.is_first=0 and car_t.location=4'); |
|
|
|
|
|
|
|
|
|
|
|
if($username == '') { |
|
|
|
if($username == '') { |
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
|
$user_ids = $this->getChildrenUserIDs(); |
|
|
@ -276,7 +273,7 @@ class RenewalController extends BaseController |
|
|
|
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
$query = $query->andWhere('car_t.car_man like "'.$car_man.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($phone != '') { |
|
|
|
if($phone != '') { |
|
|
|
$query = $query->andWhere('car_t.phone="'.$phone.'"'); |
|
|
|
$query = $query->andWhere('car_t.car_man_phone="'.$phone.'"'); |
|
|
|
} |
|
|
|
} |
|
|
|
if($ptype > 0) { |
|
|
|
if($ptype > 0) { |
|
|
|
$query = $query->andWhere('appointment_t.ptype='.$ptype); |
|
|
|
$query = $query->andWhere('appointment_t.ptype='.$ptype); |
|
|
|