/** * 公司信息保存 */ public function actionSavedealerorgan() { $OrganID = Yii::app()->user->getOrganID(); $Organ = Yii::app()->request->getParam("Organ"); $arr = Yii::app()->request->getParam("telPhone"); $TelPhone = ""; foreach ($arr as $key => $val) { if (empty($val)) { continue; } $TelPhone .= $val . ","; } $model = Organ::model()->findByPK($OrganID); if (empty($model)) { $model = new Organ(); } //保存organ数据 $model->attributes = $Organ; $model->TelPhone = trim($TelPhone, ','); //判断基本信息是否为空,为空则不提交 if ($Organ) { //接收删除图片的地址 $photoId = Yii::app()->request->getParam("photoId"); //判断是否删除图片 if (!empty($photoId)) { $imageids = explode(',', $photoId); foreach ($imageids as $imageid) { $picture = OrganPhoto::model()->find('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); //判断该图片路径是否存在数据库中 if (empty($picture)) { $ftp = new Ftp(); $res = $ftp->delete_file($imageid); $ftp->close(); } else { OrganPhoto::model()->deleteAll('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); $ftp = new Ftp(); $res = $ftp->delete_file($picture->Path); $ftp->close(); } } } //接收上传图片地址 $goodsImages = Yii::app()->request->getParam("goodsImages"); //判断是否有上传图片 if (!empty($goodsImages)) { $imglegth = count($goodsImages); for ($i = 0; $i < $imglegth; $i++) { $goodsImg = new OrganPhoto(); $goodsImg->OrganID = $OrganID; $goodsImg->Path = $goodsImages[$i]; $goodsImg->save(); } } //判断是否上传营业执照 $BLPoto = Yii::app()->request->getParam("BLPoto"); if ($model->BLPoto != $BLPoto) { if (!empty($model->BLPoto)) { $ftp = new Ftp(); $res = $ftp->delete_file($model->BLPoto); $ftp->close(); } $model->BLPoto = $BLPoto; } //接收dealer数据 $dealer = Yii::app()->request->getParam("Dealer"); //保存dealer数据 $dealermodel = Dealer::model()->find("OrganID=:organid", array(":organid" => $OrganID)); if (empty($dealermodel)) { //判断是否第一次添加 $dealermodel = new Dealer(); $dealermodel->OrganID = $OrganID; } $dealermodel->SaleMoney = $dealer['SaleMoney']; $dealermodel->SaleDomain = $dealer['SaleDomain']; $dealermodel->ShopArea = $dealer['ShopArea']; if ($dealermodel->save() && $model->save()) { //保存成功 $this->redirect(array('index')); } else { var_dump($dealermodel->errors); var_dump($model->errors); die; } } }
} ?> </div> </div> <!--满意度评价--> <p class="txxx bor_back m-top10">满意度评价</p> <div class="bor_back "> <div class="satisfied "> <div class="jg-info float_l"> <div class="triangle-border2 tb-border2"></div> <div class="triangle-border2 tb-background2"></div> <div style="padding:35px 20px"> <?php $OrderInfo = PapOrder::model()->findByPK($OrderID); $OrganInfo = Organ::model()->findByPk($OrderInfo['SellerID']); $OrganPhoto = OrganPhoto::model()->find("OrganID =:organID", array(':organID' => $OrganInfo['ID'])); $xylevel = EvaluateService::getpets($OrganInfo['Grade']); if (empty($xylevel) || !$xylevel[0] || !$xylevel[1]) { $xylvstr = "<div class='xy-div' title='积分过低'><i class='seller-level0'></i></div>"; } else { $xylvstr = '<div class = "xy-div" title = "积分:' . $OrganInfo['Grade'] . '">' . str_repeat("<i class='seller-level" . $xylevel[0] . "'></i>", $xylevel[1]) . '</div>'; } ?> <div class="eav-jg-img float_l"><img src="<?php echo F::uploadUrl() . $OrganPhoto['Path']; ?> "></div> <div class="eav-jg-info float_l"> <p><b><?php echo $OrganInfo['OrganName']; ?>
public function delorganphoto($photoId) { $imageids = explode(',', $photoId); $OrganID = Yii::app()->user->getOrganID(); $ftp = new Ftp(); foreach ($imageids as $imageid) { $picture = OrganPhoto::model()->find('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); //判断该图片路径是否存在数据库中 if (empty($picture)) { $res = $ftp->delete_file($imageid); } else { OrganPhoto::model()->deleteAll('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); $res = $ftp->delete_file($picture->Path); } } $ftp->close(); }
/** * 公司信息保存 */ public function actionSaveserviceorgan() { $OrganID = Yii::app()->user->getOrganID(); $Organ = Yii::app()->request->getParam("Organ"); $arr = Yii::app()->request->getParam("telPhone"); $TelPhone = ""; foreach ($arr as $key => $val) { if (empty($val)) { continue; } $TelPhone .= $val . ","; } $model = Organ::model()->findByPK($OrganID); if (empty($model)) { $model = new Organ(); } //保存organ数据 $model->attributes = $Organ; $model->TelPhone = trim($TelPhone, ','); //判断基本信息是否为空,为空则不提交 if ($Organ) { //接收删除图片的地址 $photoId = Yii::app()->request->getParam("photoId"); //判断是否删除图片 if (!empty($photoId)) { $imageids = explode(',', $photoId); foreach ($imageids as $imageid) { $picture = OrganPhoto::model()->find('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); //判断该图片路径是否存在数据库中 if (empty($picture)) { $ftp = new Ftp(); $res = $ftp->delete_file($imageid); $ftp->close(); } else { OrganPhoto::model()->deleteAll('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); $ftp = new Ftp(); $res = $ftp->delete_file($picture->Path); $ftp->close(); } } } //接收上传图片地址 $goodsImages = Yii::app()->request->getParam("goodsImages"); //判断是否有上传图片 if (!empty($goodsImages)) { $imglegth = count($goodsImages); for ($i = 0; $i < $imglegth; $i++) { $goodsImg = new OrganPhoto(); $goodsImg->OrganID = $OrganID; $goodsImg->Path = $goodsImages[$i]; $goodsImg->save(); } } //判断是否上传营业执照 $BLPoto = Yii::app()->request->getParam("BLPoto"); if ($model->BLPoto != $BLPoto) { if (!empty($model->BLPoto)) { $ftp = new Ftp(); $res = $ftp->delete_file($model->BLPoto); $ftp->close(); } $model->BLPoto = $BLPoto; } //接收service数据 $service = Yii::app()->request->getParam("Service"); $opentime = Yii::app()->request->getParam("OpenTime"); //保存service数据 $servicemodel = Service::model()->find("OrganID=:organid", array(":organid" => $OrganID)); if (empty($servicemodel)) { //判断是否第一次添加 $servicemodel = new Service(); $servicemodel->OrganID = $OrganID; } $servicemodel->PositionCount = $service['PositionCount']; $servicemodel->TechnicianCount = $service['TechnicianCount']; $servicemodel->ParkingDigits = $service['ParkingDigits']; $servicemodel->ReservationMode = $service['ReservationMode']; $servicemodel->ShopArea = $service['ShopArea']; $servicemodel->OpenTime = $opentime[0] . ',' . $opentime[1] . ',' . $opentime[2] . ',' . $opentime[3]; //$model->attributes = $Organ; if ($servicemodel->save() && $model->save()) { //保存成功 //$file->saveAs(Yii::app()->params['uploadPath'].$model->Logo, true); $this->redirect(array('index')); } else { var_dump($goodsImg->errors); die; } } }
/** * 公司信息保存 */ public function actionSavemakeorgan() { $OrganID = Yii::app()->user->getOrganID(); $Organ = Yii::app()->request->getParam("Organ"); $model = Organ::model()->findByPK($OrganID); if (empty($model)) { $model = new Organ(); } //保存organ数据 $model->attributes = $Organ; //判断基本信息是否为空,为空则不提交 if ($Organ) { //接收删除图片的地址 $photoId = Yii::app()->request->getParam("photoId"); //判断是否删除图片 if (!empty($photoId)) { $imageids = explode(',', $photoId); foreach ($imageids as $imageid) { $picture = OrganPhoto::model()->find('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); //判断该图片路径是否存在数据库中 if (empty($picture)) { $myfileurl = Yii::app()->params['uploadPath'] . $imageid; if (file_exists($myfileurl)) { $result = unlink($myfileurl); } } else { $myfileurl = Yii::app()->params['uploadPath'] . $picture->Path; OrganPhoto::model()->deleteAll('Path=:img AND OrganID=:OrganID', array(':img' => $imageid, ':OrganID' => $OrganID)); if (file_exists($myfileurl)) { $result = unlink($myfileurl); } } } } //接收上传图片地址 $goodsImages = Yii::app()->request->getParam("goodsImages"); //判断是否有上传图片 if (!empty($goodsImages)) { $imglegth = count($goodsImages); for ($i = 0; $i < $imglegth; $i++) { $goodsImg = new OrganPhoto(); $goodsImg->OrganID = $OrganID; $goodsImg->Path = $goodsImages[$i]; $goodsImg->save(); } } //判断是否上传营业执照 $BLPoto = Yii::app()->request->getParam("BLPoto"); if ($model->BLPoto != $BLPoto) { if (!empty($model->BLPoto)) { $filePath = Yii::app()->params['uploadPath'] . $model->BLPoto; if (file_exists($filePath)) { unlink($filePath); } } $model->BLPoto = $BLPoto; } //接收make数据 $make = Yii::app()->request->getParam("Make"); //保存make数据 $makemodel = Make::model()->find("OrganID=:organid", array(":organid" => $OrganID)); if (empty($makemodel)) { //判断是否第一次添加 $makemodel = new Make(); $makemodel->OrganID = $OrganID; } $makemodel->SaleMoney = $make['SaleMoney']; $makemodel->SaleDomain = $make['SaleDomain']; if ($makemodel->save() && $model->save()) { //保存成功 $this->redirect(array('index')); } else { var_dump($makemodel->errors); var_dump($model->errors); die; } } }