| 12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- /**
- * class Login
- * Created by PhpStorm.
- * User: Jonlin
- * Date: 2019/3/20
- * Time: 9:11
- */
- namespace App\Sports\Controller;
- use App\Http\Controllers\Controller;
- use \System\Model;
- class Login extends Controller{
- /**
- * 用户登陆
- */
- public function login(){
- $data = $_REQUEST;
- try {
- if (empty($data['username'])) throw new \Exception(Render([], '4013', lang('Tips','Sports')->get('no_account')));
- if (empty($data['password'])) throw new \Exception(Render([], '4014', lang('Tips','Sports')->get('no_password')));
- $user = lm('Account','Sports')->where('username',$data['username'])->first();
- if (empty($user->username)) throw new \Exception(Render([], '4019', lang('Tips','Sports')->get('login_fail')));
- $string = 'qwe';
- if (md5(md5($data['password']).$string) != ($user->password)) throw new \Exception(Render([], '4002', lang('Tips','Sports')->get('login_fail')));
- Render([], '200', lang('Tips','Sports')->get('login_success'));
- } catch (\Exception $e) {
- echo $e->getMessage();
- }
- }
- }
|