/** * Run the database seeds. * * @return void */ public function run() { DB::table('carinfo')->delete(); for ($i = 0; $i < count($this->items); $i++) { $row = array_combine(['inquiry_id', 'gear', 'transmission', 'engine', 'rudder', 'color', 'run', 'capacity_from', 'capacity_to', 'state', 'owners'], $this->items[$i]); CarInfo::create($row); } }
public function actionCheckcar() { $organID = Commonmodel::getOrganID(); $criteria = new CDbCriteria(); $criteria->with = "owner"; $criteria->addCondition("t.OrganID = {$organID}"); $criteria->addSearchCondition('t.LicensePlate', "{$_POST['licenseplate']}", "AND"); $model = CarInfo::model()->findAll($criteria); foreach ($model as $key => $value) { //车辆ID $data[$key]['ID'] = $value['ID']; //车主信息 $data[$key]['Name'] = $value->owner->Name ? F::msubstr($value->owner->Name) : '未绑定'; $data[$key]['Phone'] = $value->owner->Phone ? F::msubstr($value->owner->Phone) : '未绑定'; $data[$key]['City'] = $value->owner->City ? F::msubstr(str_replace("/", "", $value->owner->City)) : '未绑定'; //车辆信息 $data[$key]['LicensePlate'] = F::msubstr($value['LicensePlate']); if ($value['UseNature'] == '1') { $data[$key]['Uses'] = "私家车"; } elseif ($value['UseNature'] == '2') { $data[$key]['Uses'] = "公务车"; } else { $data[$key]['Uses'] = "运营车辆"; } $data[$key]['Car'] = F::msubstr(str_replace(",", "", $value['Car'])); $data[$key]['VinCode'] = $value['VinCode']; $data[$key]['Miles'] = $value['Mileage']; $data[$key]['BuyTime'] = date('Y-m-d', $value['BuyTime']); } $rs = array('totals' => count($model), 'rows' => $data ? $data : array()); echo json_encode($rs); }
/** * 添加保险预约 */ public function addReservationAction() { $data = $this->request->getJsonRawBody(true); //提交数据包含car_info_id说明该车辆信息已存在,则修改 if (!empty($data['car_info_id'])) { $car_info_id = $data['car_info_id']; //同一个号码同一车辆只能预约一次(未报价前) if (Insurance::isReserved($data['phone'], $car_info_id)) { $this->view->setVars(array('success' => false, 'err_msg' => '车辆已预约')); return; } CarInfo::updateCarInfo($car_info_id, $data); } else { //车辆信息不存在,则添加 $data['car_info_id'] = CarInfo::addCarInfo($data); } $success = Insurance::addInsuranceReservation($data); $this->view->setVars(array('success' => $success, 'err_msg' => '保险预约成功')); }
public function getCarInfoByUserIdAndHphmAction($user_id, $hphm) { $car_info = CarInfo::getCarInfoByUserIdAndHphm($user_id, $hphm); $this->view->setVars(array('row' => $car_info)); }