SchoolPhysicalExamination/application/admin/controller/Login.php

50 lines
1.6 KiB
PHP

<?php
namespace app\admin\controller;
use think\Controller;
use think\Db;
use app\bj\controller\Common;
use think\helper\hash\Md5;
use think\Log;
use \think\Validate;
class Login extends Controller{
public function login(){
// $this->assign('domain',$a);
// dump(md5('123'));
return $this->fetch();
}
public function login_action(){
$data = input();
// $key_word1='教育';
// $key_word2='体测';
// $data['name'] = md5($key_word1.$data['name'].$key_word2)
// dump($data);
// die;
$result = Db::table('admin_user')->where(['user_name'=>$data['username'],'pass_word'=>$data['password']])->count();
if($result>0){
return $this->msg(0,'success');
}else{
return $this->msg(10001,'error');
}
// if($data['name'] == 'a' && md5($key_word1.$data['password'].$key_word2) == '871365cc2db43a8f2c7544798b36ed78'){
// return $this->msg(10000,'success');
// }else{
// return $this->msg(10001,'error');
// }
}
################################################################other################################################################
################################################################other################################################################
################################################################other################################################################
public function msg($code,$msg='',$data=[]){
return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
}
}