迅睿CMS框架是一款PHP8高性能·简单易用的CMS开源开发框架,基于MIT开源许可协议发布,免费且不限制商业使用,是免费开源的产品,以万端互联为设计理念,支持的微信公众号、小程序、APP客户端、移动端网站、PC网站等多终端式管理系统。
联系官方销售客服
1835022288
028-61286886
请问怎么写才能在登录接口上加个获取空间ID,
URL /index.php?appid=1&appsecret=123&s=member&c=login&m=sms
插件教程:https://www.xunruicms.com/doc/app-361.html
// 短信验证码登录
public function sms() {
// 获取返回页面
$url = dr_safe_url($_GET['back'] ? urldecode((string)\Phpcmf\Service::L('input')->get('back')) : $_SERVER['HTTP_REFERER']);
strpos($url, 'login') !== false && $url = MEMBER_URL;
if (IS_AJAX_POST) {
$post = \Phpcmf\Service::L('input')->post('data');
\Phpcmf\Hooks::trigger('member_login_before', $post);
if ($this->member_cache['login']['code']
&& !\Phpcmf\Service::L('Form')->check_captcha('code')) {
$this->_json(0, dr_lang('图片验证码不正确'));
} elseif (empty($post['phone'])) {
$this->_json(0, dr_lang('手机号码必须填写'));
} else {
$sms = \Phpcmf\Service::L('Form')->get_mobile_code($post['phone']);
if (!$sms) {
$this->_json(0, dr_lang('未发送手机验证码'), ['field' => 'sms']);
} elseif (!$_POST['sms']) {
$this->_json(0, dr_lang('手机验证码未填写'), ['field' => 'sms']);
} elseif ($sms != $_POST['sms']) {
$this->_json(0, dr_lang('手机验证码不正确'), ['field' => 'sms']);
$rt = \Phpcmf\Service::M('member')->login_sms($post['phone'], (int)$_POST['remember']);
if ($rt['code']) {
// 登录成功
$rt['data']['url'] = urldecode(\Phpcmf\Service::L('input')->xss_clean($_POST['back'] ? \Phpcmf\Service::L('input')->post('back') : MEMBER_URL));
$this->_json(1, 'ok', $rt['data']);
$this->_json(0, $rt['msg']);
}
$this->_json(0, dr_lang('提交方式不正确'));
// 短信验证码登录
public function sms() {
// 获取返回页面
$url = dr_safe_url($_GET['back'] ? urldecode((string)\Phpcmf\Service::L('input')->get('back')) : $_SERVER['HTTP_REFERER']);
strpos($url, 'login') !== false && $url = MEMBER_URL;
if (IS_AJAX_POST) {
$post = \Phpcmf\Service::L('input')->post('data');
\Phpcmf\Hooks::trigger('member_login_before', $post);
if ($this->member_cache['login']['code']
&& !\Phpcmf\Service::L('Form')->check_captcha('code')) {
$this->_json(0, dr_lang('图片验证码不正确'));
} elseif (empty($post['phone'])) {
$this->_json(0, dr_lang('手机号码必须填写'));
} else {
$sms = \Phpcmf\Service::L('Form')->get_mobile_code($post['phone']);
if (!$sms) {
$this->_json(0, dr_lang('未发送手机验证码'), ['field' => 'sms']);
} elseif (!$_POST['sms']) {
$this->_json(0, dr_lang('手机验证码未填写'), ['field' => 'sms']);
} elseif ($sms != $_POST['sms']) {
$this->_json(0, dr_lang('手机验证码不正确'), ['field' => 'sms']);
} else {
$rt = \Phpcmf\Service::M('member')->login_sms($post['phone'], (int)$_POST['remember']);
if ($rt['code']) {
// 登录成功
$rt['data']['url'] = urldecode(\Phpcmf\Service::L('input')->xss_clean($_POST['back'] ? \Phpcmf\Service::L('input')->post('back') : MEMBER_URL));
$this->_json(1, 'ok', $rt['data']);
} else {
$this->_json(0, $rt['msg']);
}
}
}
} else {
$this->_json(0, dr_lang('提交方式不正确'));
}
}