示例#1
0
 public function actionPricelist()
 {
     $OrganID = Commonmodel::getOrganID();
     $model = PriceManage::model()->findAll("OrganID=:ID", array(":ID" => $OrganID));
     if (empty($model)) {
         unset($model);
         $model = new PriceManage();
         $model->OrganID = $OrganID;
         $model->CooperationType = "A:VIP客户";
         $model->PriceRatio = "";
         $model->UpdateTime = time();
         if ($model->save()) {
             unset($model);
             $model = new PriceManage();
             $model->OrganID = $OrganID;
             $model->CooperationType = "B:重要客户";
             $model->PriceRatio = "";
             $model->UpdateTime = time();
             if ($model->save()) {
                 unset($model);
                 $model = new PriceManage();
                 $model->OrganID = $OrganID;
                 $model->CooperationType = "C:普通客户";
                 $model->PriceRatio = "100%";
                 $model->UpdateTime = time();
                 $model->save();
             }
         }
         unset($model);
         $model = PriceManage::model()->findAll("OrganID=:ID", array(":ID" => $OrganID));
     }
     foreach ($model as $key => $value) {
         $data[$key]['ID'] = $value['ID'];
         $data[$key]['OrganName'] = Commonmodel::getOrganName();
         $data[$key]['CooperationType'] = $value['CooperationType'];
         $data[$key]['PriceRatio'] = $value['PriceRatio'];
     }
     $rs = array('rows' => $data ? $data : array());
     echo json_encode($rs);
 }
示例#2
0
 public function actionShareapply()
 {
     //通过$_POST['ContactID']获取联系人信息
     $contact = $this->getContact(Yii::app()->request->getParam("ContactID"));
     //判断该共享机构是否与当前登录用户存在共享关系,存在则提示用户是否覆盖
     $share = BusinessShare::model()->find(array("condition" => "InitiatorID = {$contact['user_id']} and ShareID = {$contact['contact_user_id']} and Status = 1"));
     //向该机构的共享申请已存在,但尚未确认
     if ($share) {
         $result['exists'] = "已存在向该机构的申请记录,是否覆盖?";
         echo json_encode($result);
     } else {
         $type = explode(',', Yii::app()->request->getParam("ShareType"));
         if ($type[1]) {
             $ShareType = 3;
         } else {
             $ShareType = Yii::app()->request->getParam("ShareType");
         }
         $verify = Yii::app()->request->getParam("VerifyInfo");
         $model = new BusinessShare();
         $model->InitiatorID = $contact['user_id'];
         $model->InitiatorName = Commonmodel::getOrganName();
         $model->ShareID = $contact['contact_user_id'];
         $model->ShareName = $contact['companyname'];
         $model->ShareType = $ShareType;
         $model->VerifyInfo = $verify == "(验证信息不能超过64个字符)" ? '' : $verify;
         $model->Status = 1;
         $model->CreateTime = time();
         $model->UpdateTime = time();
         $success = $model->save();
         if ($success == 1) {
             $result['success'] = "共享申请发送成功!";
         } else {
             $result['errorMsg'] = "系统异常,共享申请发送失败!";
         }
         echo json_encode($result);
     }
 }