public function findMoblie($mobile, $type) { $SmsLog = SmsLog::find()->where(array('mobile' => $mobile, 'type' => $type))->orderBy(array('time' => SORT_DESC))->limit(1)->one(); if (!$SmsLog) { return false; } return $SmsLog; }
function checkRate($mobile) { $smslog_model = new SmsLog(); //一分钟之内 $count1 = $smslog_model->getcount($mobile, 60); //一小时三次 $count2 = $smslog_model->getcount($mobile, 1800); //24小时内5次 $count3 = $smslog_model->getcount($mobile, 86400); if ($count1 > 1 || $count2 > 10 || $count3 > 30) { $return = false; } else { $return = true; } return $return; //return $smslog_model->getcount($mobile); }