diff --git a/application/controllers/Admin/User.php b/application/controllers/Admin/User.php new file mode 100644 index 0000000..c38b3d2 --- /dev/null +++ b/application/controllers/Admin/User.php @@ -0,0 +1,22 @@ +table}"; + $count = $UserModel->query($sql); + $sql = "select * from {$UserModel->table} order by id desc limit {$offset},{$limit} "; + $data = $UserModel->query($sql); + $return['code'] = 0; + $return['count'] = count($count); + $return['data'] = $data; + $return['msg'] = "成功"; + echo json_encode($return);die; + } +} \ No newline at end of file diff --git a/application/controllers/Api/Login.php b/application/controllers/Api/Login.php index 8157d46..4d73e50 100644 --- a/application/controllers/Api/Login.php +++ b/application/controllers/Api/Login.php @@ -149,9 +149,10 @@ } public function sendcodeAction(){ $phone = empty($this->POST['phone'])||!isset($this->POST['phone'])? Tool_Fnc::apiMsg('请输入手机号', '500'):Tool_fnc::safe_string($this->POST['phone']); + $username = empty($this->POST['username'])||!isset($this->POST['username'])? Tool_Fnc::apiMsg('请输入手机号', '500'):Tool_fnc::safe_string($this->POST['username']); // 验证系统是否存在该手机号 - $userinfo = $this->Usermodel->field('username')->where("phone='{$phone}' and is_delete=0 and status=1")->fRow(); - if(empty($userinfo)) Tool_Fnc::apiMsg('当前手机号不存在', '500'); + $userinfo = $this->Usermodel->field('username')->where("phone='{$phone}' and is_delete=0 and status=1 and username='{$username}'")->fRow(); + if(empty($userinfo)) Tool_Fnc::apiMsg('账号不存在', '500'); // 短信接口 $accessKeyId = Yaf_Registry::get("config")->aliyun->sms->accessKeyId; $smsModel = new SmscodeModel(); @@ -167,6 +168,7 @@ if(!$result) Tool_Fnc::apiMsg('短信发送失败', '500'); $data['phone'] = $phone; $data['code'] = $code; + $data['username'] = $username; $data['created'] = date("Y-m-d H:i:s",time()); $smsModel->save($data); Tool_Fnc::apiMsg('短信发送成功', '200'); @@ -174,9 +176,11 @@ public function ValidationAction(){ $phone = empty($this->POST['phone'])||!isset($this->POST['phone'])? Tool_Fnc::apiMsg('请输入手机号', '500'):Tool_fnc::safe_string($this->POST['phone']); $code = empty($this->POST['code'])||!isset($this->POST['code'])? Tool_Fnc::apiMsg('请输入验证码', '500'):Tool_fnc::safe_string($this->POST['code']); + $username = empty($this->POST['username'])||!isset($this->POST['username'])? Tool_Fnc::apiMsg('请输入账号', '500'):Tool_fnc::safe_string($this->POST['username']); $smsModel = new SmscodeModel(); - $userinfo = $this->Usermodel->field('id')->where("phone='{$phone}' and is_delete=0 and status=1")->fRow(); - $codedata = $smsModel->field('id')->where("phone='{$phone}' and code='{$code}' and status=0")->fRow(); + $userinfo = $this->Usermodel->field('id')->where("phone='{$phone}' and is_delete=0 and username='{$username}' and status=1")->fRow(); + if(empty($codedata))Tool_Fnc::apiMsg('账号不存在', '500'); + $codedata = $smsModel->field('id')->where("phone='{$phone}' and code='{$code}' and username='{$username}' and status=0")->fRow(); if(empty($codedata))Tool_Fnc::apiMsg('验证码不正确', '500'); $codedata['status']=1; $smsModel->save($codedata); diff --git a/application/models/Smscode.php b/application/models/Smscode.php index 0352526..a1a13a8 100644 --- a/application/models/Smscode.php +++ b/application/models/Smscode.php @@ -7,6 +7,7 @@ class SmscodeModel extends Orm_Base{ 'code' => array('type' => "varchar(45)",'comment' => '是否删除'), 'created' => array('type' => "int(11)",'comment' => '添加时间'), 'status' => array('type' => "int(11)",'comment' => '添加时间'), + 'username' => array('type' => "int(11)",'comment' => '添加时间'), ); public $pk = 'id'; } diff --git a/application/views/admin/index/index.phtml b/application/views/admin/index/index.phtml index 3a52175..29beee0 100644 --- a/application/views/admin/index/index.phtml +++ b/application/views/admin/index/index.phtml @@ -48,7 +48,7 @@