pc 1=>移动 * city 区域 * * */ public function actionSignup() { $en = new EnrollServer(); $cacheResult = $en->Restrict(Yii::$app->request->post()); if (!$cacheResult['is_test'] && $cacheResult['sign']) { return Help::JsonCode(Help::ERROR, '您今天的报名次数已超过限制'); } $form = new \common\forms\VisitorRegistrationForm(); $form->load(Yii::$app->request->post(), ''); if (!$form->validate()) return Help::JsonCode(Help::ERROR, '提交失败', $form->errors); /* * 2020.7.27 lyy 报名号码限制 * */ $astrict_is = $en->ChacPhone(Yii::$app->request->post('mobile')); if ($astrict_is['code']) return Help::JsonCode(Help::ERROR, $astrict_is['msg']);//号码限制 $model = new \common\models\Enroll(); $model->scenario = 'pcadd'; $model->load(array_merge($form->attributes, Yii::$app->request->post()), ''); if ($model->save()) { if ($cacheResult['is_test']) { //如果是测试号码,则不走以下发送邮箱的步骤 return Help::JsonCode(Help::SUCCESS, '测试号码提交成功'); } $array = array_merge($form->attributes, Yii::$app->request->post()); (new Curl())->setPostParams([ 'name' => empty($array['housename']) ? '' : $array['housename'], 'city' => empty($array['city_name']) ? '' : $array['city_name'], 'tel' => empty($array['mobile']) ? '' : $array['mobile'], 'time' => $_SERVER['REQUEST_TIME'], ])->post('http://abc.pinfangw.com/index.php?m=Admin&c=ReceiveSign'); $Email = $form->attributes; $Email['id'] = $model->attributes['id']; (new \common\service\common\MailerService())->send($form->send_email, $Email, EmailEnum::SITEFORM); return Help::JsonCode(Help::SUCCESS, '提交成功'); } // $en = new EnrollServer(); // $cacheResult = $en->Restrict(); // if($cacheResult === false) return Help::JsonCode(Help::ERROR,'您今天的报名次数已超过限制'); // // aid: 0 // //source: 2 // //equipment: 2 // //intention_city: 区域 // //intention_housetype: 户型 // //budget: 预算 // //mobile: 13816450442 // //根据报名判断是否有相应的区域邮箱 // $input = Yii::$app->request->post(); // $en->mobile = $input['mobile']; // if(!empty($input['intention_house'])) // { // $en->housename = $input['intention_house']; // } // if(!empty($input['intention_housetype'])) // { // $en->houseType = $input['intention_housetype']; // } // if(!empty($input['budget'])) // { // $en->budget = $input['budget'];//预算 // } // if(!empty($input['hid'])){ // $houst = new \common\models\House(); // $houseModel = $houst->FindById($input['hid']); //楼盘相关信息 // $en->housename = $houseModel['name']; // $city = $houseModel['city']; // // $email = $cityEmail->FindByEmail($houseModel['city']); // // $en->city = $email['city_name']; // }else if(!empty($input['city'])){ // $city = $input['city']; // // $email = $cityEmail->FindByEmail($input['city']); // // $en->city = $email['city_name']; // } // if(!empty($input['intention_city'])) // { // $city_rows = \common\models\CategoryCity::findOne(['city_name'=> $input['intention_city']]); // if($city_rows) // { // $city = $city_rows['id']; // } // $en->city = $input['intention_city']; // } // //根据区域发送指定邮箱 // if(!empty($city)) // { // $cityEmail = new \common\models\Email(); // $email = $cityEmail->FindByEmail($city); // $catCity = ( new \common\models\CategoryCity())->FindById($city); // $en->city = $catCity['city_name']; // } // if(!empty($email)) // { // $e = $email['email']; // $en->city = $email['city_name']; // } // else // { // $e = Yii::$app->params['default_email']; // } // // ( new \common\api\EmailServer())->SendOut($e,Yii::t('app','enter_email'),$msgemail); // $model = new \common\models\Enroll(); // $model->scenario = 'pcadd'; // $auth = $model->Authenticator($input); // if(is_object($auth)) // { // $auth->ip = Yii::$app->request->userIP; // $auth->send_email = $e; // if($auth->save(false)){ // $auth->attributes['id']; // $en->username = $auth->name; // //发送邮件 // $event = new \common\event\Event(); // $arr = []; // $arr['email'] = $e; // $arr['title'] = Yii::t('app','enter_email'); // $arr['content'] = $en->TemplateOne(); // $arr['id'] = $auth->attributes['id']; // $event->SendEmail($arr); // return Help::JsonCode(Help::SUCCESS,'提交成功'); // } // } // return Help::JsonCode(Help::ERROR,'提交失败',$auth); } }