Beispiel #1
0
 public function getContact($id)
 {
     $model = BusinessContacts::model()->findByPk($id)->attributes;
     return $model;
 }
Beispiel #2
0
 public static function getContactprice($dealerID, $seriveID)
 {
     $criteria = new CDbCriteria();
     $criteria->select = "cooperationtype";
     $OrganID = Commonmodel::getOrganID();
     $Identity = Commonmodel::getIdentity($OrganID);
     //判断当前登录用户角色类别(修理厂/经销商)
     if ($Identity['identity'] == 3) {
         //修理厂角色登录
         $criteria->addCondition("t.user_id = {$dealerID}", "AND");
         //经销商ID
         $criteria->addCondition("t.contact_user_id = {$OrganID}", "AND");
         //当前登录的修理厂ID
         $criteria->addCondition("t.Status=0", 'AND');
     } elseif ($Identity['identity'] == 2) {
         //经销商角色登录
         $criteria->addCondition("t.user_id = {$OrganID}", "AND");
         //当前登录的经销商ID
         //  $criteria->addCondition("t.contact_user_id =$seriveID", "AND");
         $criteria->addCondition("t.contact_user_id = :seriveID", 'AND');
         $criteria->addCondition("t.Status=0", 'AND');
         $criteria->params[':seriveID'] = $seriveID;
         //修理厂ID(询价对象ID)
     }
     $contact = BusinessContacts::model()->find($criteria);
     if ($contact) {
         $model = PriceManage::model()->find(array("condition" => "OrganID = {$dealerID} AND CooperationType = '{$contact['cooperationtype']}'"));
     }
     return $model;
 }
Beispiel #3
0
 public function actionOrgan()
 {
     $user_id = Commonmodel::getOrganID();
     // $ids = $user_id;
     $businessContacts = BusinessContacts::model()->findAll('user_id=:user_id and Status=0', array(':user_id' => $user_id));
     foreach ($businessContacts as $key => $val) {
         if ($val['contact_user_id']) {
             $ids[] = $val['contact_user_id'];
         }
     }
     $ids[] = $user_id;
     //新增的联系人不能是添加者本人
     $ids = implode(',', $ids);
     //经销商数据
     $i = 0;
     $model = Dealer::model()->findAll("userID not in ({$ids}) and !ISNULL(organName)");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['organName'];
         $data[$i]['userID'] = $value['userID'];
         // $data[$key]['companytype']=$value['userID'];
         $result = User::model()->findByPk($value['userID']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     //修理厂
     $model = Service::model()->findAll("userId not in ({$ids}) and !ISNULL(serviceName)");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['serviceName'];
         $data[$i]['userID'] = $value['userId'];
         //$data[$value['userId']]['companytype']=$value['userId'];
         $result = User::model()->findByPk($value['userId']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     //生产商
     //    		$model=Yii::app()->db->createCommand()
     //    		->select('*')
     //    		->from('tbl_make_organ')
     //    		->queryAll();
     $model = MakeOrgan::model()->findAll("userID not in ({$ids})");
     foreach ($model as $key => $value) {
         $data[$i]['companyname'] = $value['name'];
         $data[$i]['userID'] = $value['userID'];
         //$data[$key]['companytype']=$value['userID'];
         $result = User::model()->findByPk($value['userID']);
         switch ($result['identity']) {
             case 1:
                 $data[$i]['companytype'] = '生产商';
                 break;
             case 2:
                 $data[$i]['companytype'] = '经销商';
                 break;
             case 3:
                 $data[$i]['companytype'] = '修理厂';
         }
         $i++;
     }
     $rs = array('total' => 1000, 'rows' => $data);
     echo json_encode($rs);
 }
Beispiel #4
0
 /**
  * 获取业务联系人信息
  */
 public function getBussineContact($contactID)
 {
     $model = BusinessContacts::model()->findByPk($contactID)->attributes;
     return $model;
     // var_dump($model);
 }