59 lines
1.6 KiB
PHP
59 lines
1.6 KiB
PHP
<?php
|
||
// +------------------------------------------------+
|
||
// |http://www.cjango.com |
|
||
// +------------------------------------------------+
|
||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||
// +------------------------------------------------+
|
||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||
// +------------------------------------------------+
|
||
namespace app\mobile\controller;
|
||
|
||
use app\common\model\Member as MemberModel;
|
||
use app\common\service\Sms as SmsService;
|
||
|
||
class Sms extends _Init
|
||
{
|
||
public function _initialize()
|
||
{
|
||
}
|
||
|
||
/**
|
||
* [短信验证码]
|
||
* @return [type] [description]
|
||
*/
|
||
public function getsms()
|
||
{
|
||
$mobile = $this->request->post('mobile');
|
||
$forget = $this->request->post('forget');
|
||
$MemberInfo = MemberModel::where('username', $mobile)->find();
|
||
|
||
if (!empty($MemberInfo) && empty($forget)) {
|
||
return $this->error('这个手机号已经注册过了');
|
||
}
|
||
$res = SmsService::send($mobile);
|
||
|
||
if ($res === true) {
|
||
return $this->success('发送成功');
|
||
} else {
|
||
return $this->error($res);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* [短信验证码]
|
||
* @return [type] [description]
|
||
*/
|
||
public function getresms()
|
||
{
|
||
$mobile = $this->request->post('mobile');
|
||
$MemberInfo = MemberModel::where('username', $mobile)->find();
|
||
$res = SmsService::send($mobile);
|
||
|
||
if ($res === true) {
|
||
return $this->success('发送成功');
|
||
} else {
|
||
return $this->error($res);
|
||
}
|
||
}
|
||
}
|