发送短信添加ip地址

master
ELF 5 years ago
parent a643e88ffb
commit c01b0f1083

@ -345,7 +345,7 @@ class PublicController extends \Think\Controller
public function telsafecode($phone = '', $delay = 10, $flag = true) public function telsafecode($phone = '', $delay = 10, $flag = true)
{ {
$taskClient = new TaskClient(); $taskClient = new TaskClient();
$result = $taskClient->sendSms($phone); $result = $taskClient->sendSms($phone, get_client_ip());
$data = []; $data = [];
if ($result['code'] == TaskClient::SUCCESS) { if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1; $data['status'] = 1;

@ -28,9 +28,9 @@ class TaskClient
return json_decode($result, true); return json_decode($result, true);
} }
public function sendSms($mobile, $type = 'common') public function sendSms($mobile, $clientIp, $type = 'common')
{ {
return $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type]); return $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type, 'client_ip' => $clientIp]);
} }
public function checkSms($mobile, $code) public function checkSms($mobile, $code)

@ -220,7 +220,7 @@ class CommonController extends BaseController {
{ {
$phone = I('phone'); $phone = I('phone');
$taskClient = new TaskClient(); $taskClient = new TaskClient();
$result = $taskClient->sendSms($phone); $result = $taskClient->sendSms($phone, get_client_ip());
$data = []; $data = [];
if ($result['code'] == TaskClient::SUCCESS) { if ($result['code'] == TaskClient::SUCCESS) {
$this->respondSuccess('发送成功'); $this->respondSuccess('发送成功');

@ -409,7 +409,7 @@ class SsgController extends BaseController {
{ {
$phone = I('phone'); $phone = I('phone');
$taskClient = new TaskClient(); $taskClient = new TaskClient();
$result = $taskClient->sendSms($phone); $result = $taskClient->sendSms($phone, get_client_ip());
$data = []; $data = [];
if ($result['code'] == TaskClient::SUCCESS) { if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1; $data['status'] = 1;

@ -581,7 +581,7 @@ class UserController extends BaseController
public function telsafecode($phone = '', $delay = 10, $flag = true) public function telsafecode($phone = '', $delay = 10, $flag = true)
{ {
$taskClient = new TaskClient(); $taskClient = new TaskClient();
$result = $taskClient->sendSms($phone); $result = $taskClient->sendSms($phone, get_client_ip());
$data = []; $data = [];
if ($result['code'] == TaskClient::SUCCESS) { if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1; $data['status'] = 1;

Loading…
Cancel
Save