|
发表于 2023-10-5 20:26:05
|
显示全部楼层
<?php
namespace app\api\model;
use think\exception\HttpException;
use think\Model;
class Users extends Model
{
/** 保存用户数据 */
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;
}
}
} |
|