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 .= ' 姓名: | ' . $this->username . ' |
';
}
if (!empty($this->mobile)) {
$str .= '电话: | ' . $this->mobile . ' |
';
}
if (!empty($this->city)) {
$str .= '区域: | ' . $this->city . ' |
';
}
if (!empty($this->housename)) {
$str .= '意向楼盘: | ' . $this->housename . ' |
';
}
if (!empty($this->houseType)) {
$str .= '意向户型: | ' . $this->houseType . ' |
';
}
if (!empty($this->city)) {
$str .= '意向区域: | ' . $this->city . ' |
';
}
if (!empty($this->budget)) {
$str .= '预算: | ' . $this->budget . ' |
';
}
$str .= '
';
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 .= ' 姓名: | ' . $input['name'] . ' |
';
}
if (!empty($input['mobile'])) {
$str .= '电话: | ' . $input['mobile'] . ' |
';
}
if (!empty($input['city_name'])) {
$str .= '区域: | ' . $input['city_name'] . ' |
';
}
if (!empty($input['house_name'])) {
$str .= '意向楼盘: | ' . $input['house_name'] . ' |
';
}
if (!empty($input['intention_housetype'])) {
$str .= '意向户型: | ' . $input['intention_housetype'] . ' |
';
}
if (!empty($input['intention_city'])) {
$str .= '意向区域: | ' . $input['intention_city'] . ' |
';
}
if (!empty($input['budget'])) {
$str .= '预算: | ' . $input['budget'] . ' |
';
}
$str .= '
';
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'=>'电话号码已经报过名!'];
}
}