添加后台代理代码
This commit is contained in:
31
codes/agent/game/dlweb/api/lib/1.0/models/Tools.php
Normal file
31
codes/agent/game/dlweb/api/lib/1.0/models/Tools.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once APP_PATH.'/sms.php';
|
||||
|
||||
class Tools
|
||||
{
|
||||
/**
|
||||
* 发送手机验证码
|
||||
* @param $phone
|
||||
* @param int $captcha
|
||||
* @param bool $is_debug
|
||||
* @return int
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sendCaptcha($phone, $captcha = 0, $is_debug = false)
|
||||
{
|
||||
$rand_code = !empty($captcha) ? $captcha : rand(100000, 999999);
|
||||
// 是否是测试状态
|
||||
if(!$is_debug) {
|
||||
$sms = new sms();
|
||||
$result = $sms->_SendSms(7, array('code' => $rand_code, 'product' => '代理'), $phone);
|
||||
|
||||
if ( !is_null($result)) {
|
||||
throw new Exception('短信发送太频繁,请稍候再试', ERRORCODE_SMSSENDERROR);
|
||||
}
|
||||
}
|
||||
|
||||
return $rand_code;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user