/** * 判断验证码是否正确 * @param string $p_telephone 手机号 * @param string $p_verifyCode 验证码 * @return boolean 是/否 */ public static function isSmsVerifyRight($p_telephone, $p_verifyCode) { if (isset($p_telephone, $p_verifyCode)) { $_smsVerifyModelList = SmsVerifyHandler::loadModelList(array('telephone' => $p_telephone), 'id desc', 1, 1); if (is_array($_smsVerifyModelList) && count($_smsVerifyModelList) > 0) { $_smsVerifyModel = $_smsVerifyModelList[0]; if ($_smsVerifyModel->getVerifyCode() == $p_verifyCode) { return true; } } } // if ($p_verifyCode=='123456') // { // return true; // } return false; }
public static function actionCheckVerifyCode() { $isRight = SmsVerifyHandler::isSmsVerifyRight(W2HttpRequest::getRequestTelephone('telephone'), W2HttpRequest::getRequestString('verifycode')); if ($isRight) { return Utility::getArrayForResults(RUNTIME_CODE_OK, '', true, '正确'); } else { return Utility::getArrayForResults(RUNTIME_CODE_ERROR_NO_AUTH, '验证码错误'); } }