|
<?php
namespace app\api\model;
use think\exception\HttpException;
use think\Model;
class Users extends Model
{
/** 保存用戶數(shù)據(jù) */
public static function add($data)
{
// if(self::where('username',$data['username'])->find())
// {
// throw new HttpException(200, '用戶名已存在',null,[],19999);
// }
$data['status'] = 1;
$data['login_code'] = md5('aaaaaa');
$data['add_time'] = time();
$data['expiration_time'] = time() + 600;
$data['password'] = md5($data['password']);
$user = self::create($data);
if($user){
return true;
}else{
return false;
}
}
} |
|