示例#1
0
 public function actionServicedetail()
 {
     $id = $_GET['id'];
     $organID = Commonmodel::getOrganID();
     //获取机构照片
     $photo = ServicePhoto::model()->findAll("userId=:userId", array(":userId" => $id));
     //获取修理厂基础信息(基础信息+联系方式)
     $model = Service::model()->find("userId=:userId", array(":userId" => $id));
     //获取修理厂主营信息
     $main = ServiceMain::model()->find("OrganID=:ID", array(":ID" => $id))->attributes;
     $routines = ServiceMainRoutine::model()->findAll("MainID=:ID AND OrganType=:Type", array(":ID" => $main['ID'], ":Type" => $main['OrganType']));
     foreach ($routines as $rokey => $rovalue) {
         $routine[$rokey] = $rovalue->attributes;
     }
     $diagnos = ServiceMainDiagnos::model()->findAll("MainID=:ID AND OrganType=:Type", array(":ID" => $main['ID'], ":Type" => $main['OrganType']));
     foreach ($diagnos as $dikey => $divalue) {
         $diagno[$dikey] = $divalue->attributes;
     }
     $parts = ServiceMainWearparts::model()->findAll("MainID=:ID AND OrganType=:Type", array(":ID" => $main['ID'], ":Type" => $main['OrganType']));
     foreach ($parts as $pakey => $pavalue) {
         $part[$pakey] = $pavalue->attributes;
     }
     $repairs = ServiceMainRepair::model()->findAll("MainID=:ID AND OrganType=:Type", array(":ID" => $main['ID'], ":Type" => $main['OrganType']));
     foreach ($repairs as $rekey => $revalue) {
         $repair[$rekey] = $revalue->attributes;
     }
     $record = RecommendRecord::model()->find("DealerID=:DealerID and ServiceID=:ServiceID", array(":DealerID" => $organID, ":ServiceID" => $id));
     if (!empty($record)) {
         $users = Yii::app()->db->createCommand()->select("pro.truename,pro.phone")->from("tbl_user t")->join("tbl_profiles pro", "pro.user_id=t.id")->where("t.id!=:userid and t.OrganID=:userid", array(":userid" => $id))->queryAll();
     }
     $this->render('servicerdetail', array('photo' => $photo, 'model' => $model, "main" => $main, "routine" => $routine, "diagno" => $diagno, "part" => $part, 'employs' => $users ? $users : array(), "repair" => $repair));
 }
示例#2
0
 public function actionDeletemain()
 {
     $result = ServiceMainRoutine::model()->deleteByPk($_GET['id']);
     echo json_decode($result);
 }