public function actionAddapply() { if (Yii::app()->request->isPostRequest) { $time = $_SERVER['REQUEST_TIME']; $type = Yii::app()->request->getParam('type'); if ($type == 1) { $model = new JpdApplyDealer(); $types = '经销商'; } else { $model = new JpdApplyService(); $types = '修理厂'; } $model->attributes = $_POST; $model->CreateTime = $time; $model->UpdateTime = $time; if ($type == 2) { $model->Province = Yii::app()->request->getParam('Province_s'); $model->City = Yii::app()->request->getParam('City_s'); $model->Area = Yii::app()->request->getParam('Area_s'); } if ($model->save()) { echo json_encode(array('res' => 1)); $subject = '由你配提醒您'; $email = QuotationService::getsysparam('apply_remind_email'); if (!$email) { $email = Yii::app()->params->sendEmail['email']; } else { $email = array_filter(explode(',', $email)); } $message = '<p>有用户申请加入unipei系统,申请人信息如下:</p><table> <tr><td>身份:</td><td>' . $types . '</td></tr> <tr><td>机构名称:</td><td>' . $model->OrganName . '</td></tr> <tr><td>店铺人数:</td><td>' . $model->StaffNum . '</td></tr>'; if ($type == 1) { $message .= '<tr><td>主营品牌:</td><td>' . $model->Brand . '</td></tr> <tr><td>主营车系:</td><td>' . $model->CarModel . '</td></tr>'; } elseif ($type == 2) { $message .= '<tr><td>技师人数:</td><td>' . $model->TechnicianNum . '</td></tr> <tr><td>工位数:</td><td>' . $model->PositionNum . '</td></tr>'; } $message .= ' <tr><td>申请人姓名:</td><td>' . $model->Name . '</td></tr> <tr><td>手机:</td><td>' . $model->Phone . '</td></tr> <tr><td>固定电话:</td><td>' . $model->TelPhone . '</td></tr> <tr><td>联系邮箱:</td><td>' . $model->Email . '</td></tr> <tr><td>QQ:</td><td>' . $model->QQ . '</td></tr> <tr><td>机构所在省:</td><td>' . Area::getdatabyid($model->Province) . '</td></tr> <tr><td>机构所在市:</td><td>' . Area::getdatabyid($model->City) . '</td></tr> <tr><td>机构所在区:</td><td>' . Area::getdatabyid($model->Area) . '</td></tr> <tr><td>机构所在街道:</td><td>' . $model->Address . '</td></tr> <tr><td>申请时间:</td><td>' . date('Y-m-d H:i:s', $time) . '</td></tr>'; $message .= '</table>'; UserModule::sendMail($email, $subject, $message); } else { echo json_encode($model->errors); } } }