setPostParams([ 'ucode' => 'http://ygadmin.yigouf.com', 'phone' => $input['mobile'] ])->post('http://ossimg.pinfangw.com/public/signrestrict'); $data = json_decode($data, true); if ($data['code'] == 200) { if ($data['data']['is_test']) { return $data['data']; } $ipinfo = new IpInfoServer(); $ip = $ipinfo->getUserIp(); $cache = \common\api\CacheServer::Cache(); $cacheName = md5($ip); $CacheContent = $cache->get($cacheName); $data['data']['count'] = $CacheContent; if ($CacheContent === false) { $data['data']['sign'] = false; $cache->set($cacheName, 1, $this->Remainingime()); } else { if ($data['data']['sign'] != 0 && $CacheContent >= $data['data']['sign']) { $data['data']['sign'] == true;//达到指定次数进行限制 } else { $data['data']['sign'] = false; $cache->set($cacheName, ++$CacheContent, $this->Remainingime()); } } } else { $data['data']['is_test'] = false; $data['data']['sign'] == fasle; } return $data['data']; } /* * 有归属楼盘 模板 * */ public function TemplateOne() { $str = ''; $str .= ' '; $str .= ''; if (!empty($this->username)) { $str .= ' '; } if (!empty($this->mobile)) { $str .= ''; } if (!empty($this->city)) { $str .= ''; } if (!empty($this->housename)) { $str .= ''; } if (!empty($this->houseType)) { $str .= ''; } if (!empty($this->city)) { $str .= ''; } if (!empty($this->budget)) { $str .= ''; } $str .= '
信息订阅!
姓名:' . $this->username . '
电话:' . $this->mobile . '
区域:' . $this->city . '
意向楼盘:' . $this->housename . '
意向户型:' . $this->houseType . '
意向区域:' . $this->city . '
预算:' . $this->budget . '
'; return $str; $msgemail = << 邮件
信息订阅!
姓名: {$this->username}
电话: {$this->mobile}
区域: {$this->city}
意向楼盘: {$this->housename}
Eof; return $msgemail; } /* *公共 模板 * */ public function TemplateTwo() { } public function TabelEmail($input) { $str = ''; $str .= ' '; $str .= ''; if (!empty($input['name'])) { $str .= ' '; } if (!empty($input['mobile'])) { $str .= ''; } if (!empty($input['city_name'])) { $str .= ''; } if (!empty($input['house_name'])) { $str .= ''; } if (!empty($input['intention_housetype'])) { $str .= ''; } if (!empty($input['intention_city'])) { $str .= ''; } if (!empty($input['budget'])) { $str .= ''; } $str .= '
信息订阅!
姓名:' . $input['name'] . '
电话:' . $input['mobile'] . '
区域:' . $input['city_name'] . '
意向楼盘:' . $input['house_name'] . '
意向户型:' . $input['intention_housetype'] . '
意向区域:' . $input['intention_city'] . '
预算:' . $input['budget'] . '
'; return $str; } public function GetArr($input, $str) { $arr = []; $arr['email'] = $input['send_email']; $arr['title'] = Yii::t('app', 'enter_email'); $arr['content'] = $str; $arr['id'] = $input['id']; return $arr; } public function ChacPhone($mobile) { //限制电话号码 $new_time = time(); $astrict_phone = \common\models\AstrictPhone::find() ->where(['mobile'=>$mobile,'state'=>1]) ->one(); if(!empty($astrict_phone)){ if(($astrict_phone['astrict_start'] == 0 && $astrict_phone['astrict_start'] == 0)|| ($astrict_phone['astrict_start'] <= $new_time && $astrict_phone['astrict_start'] == 0)||($astrict_phone['astrict_start'] <= $new_time && $astrict_phone['astrict_start'] >= $new_time)){ return ['code'=>true,'msg'=>$astrict_phone['astrict_msg']]; } } //今天是否已经报名过 $day_start_time =strtotime(date("Y-m-d",time())); $rows = \common\models\Enroll::find() ->where(['mobile'=>$mobile]) ->andWhere(['>','create_at',$day_start_time]) ->orderBy(['create_at'=>SORT_DESC,'id'=>SORT_DESC]) ->asArray()->one(); if(!empty($rows)) return ['code'=>true,'msg'=>'电话号码已经报过名!']; } }