SchoolPhysicalExamination/application/app/controller/Login.php

67 lines
2.2 KiB
PHP

<?php
namespace app\app\controller;
use think\Controller;
use think\Db;
use app\bj\controller\Common;
use think\Log;
use \think\Validate;
class Login extends Controller{
################################################################个人资料卡################################################################
################################################################个人资料卡################################################################
################################################################个人资料卡################################################################
// 注册
public function register_action(){
$data = input();
$result = Db::table('app_register')->insert([
'account_number'=>$data['account_number'],
'password'=>$data['password'],
]);
if($result){
return $this->msg(0,'success');
}else{
return $this->msg(10001,'注册失败');
}
}
// 登录
public function login_action(){
$data = input();
$result = Db::table('app_register')->where([
'account_number'=>$data['account_number'],
'password'=>$data['password'],
])->count();
if($result){
return $this->msg(0,'success');
}else{
return $this->msg(10001,'未找到账户');
}
}
// 登录
public function phone_code(){
$data = '696969';
return $this->msg(0,'success',['phone_code'=>$data]);
}
// 登录
public function email_code(){
$data = '696969';
return $this->msg(0,'success',['email_code'=>$data]);
}
################################################################other################################################################
################################################################other################################################################
################################################################other################################################################
public function msg($code,$msg='',$data=[]){
return json(['code'=>$code,'msg'=>$msg,'data'=>$data]);
}
}