/** * 获取某个手机号某种业务类型在一定时间内发送的次数,并加一 * @param $phone 手机号码 * @param $codetype 业务类型:0-注册帐号 1-发送验证码到旧绑定手机 2-更换绑定手机 3-提现 4-重置密码 * @return int */ private static function updateSendNums($phone, $codetype) { $num = 0; if (MyRedis::exists("identifyCode:num:{$codetype}:{$phone}")) { $num = intval(MyRedis::get("identifyCode:num:{$codetype}:{$phone}")); } $expire = 3 * 60; // 统计3分钟内的点击次数 MyRedis::set("identifyCode:num:{$codetype}:{$phone}", $num + 1, $expire); // 次数加1 return $num; }