12345678910111213141516171819202122232425262728293031323334 |
- import 'package:gobang/model/user_model.dart';
- /// Description: user dao
- /// Time : 02/20/2024 Tuesday
- /// Author : liuyuqi.gov@msn.cn
- class UserDao {
- /// login
- /// @param username
- /// @param password
- /// @return Future<String>
- static Future<UserModel> login(String username, String password) async {
- await Future.delayed(Duration(seconds: 2));
- if (username == 'admin' && password == 'admin') {
- return UserModel.fromJson({"username": "admin", "password": "admin"});
- } else {
- throw Exception('username or password is incorrect');
- }
- }
- /// logout
- static Future<bool> logout() async {
- await Future.delayed(Duration(seconds: 2));
- return true;
- }
- /// register
- /// @param username
- /// @param password
- /// @return Future<String>
- static Future<String> register(String username, String password) async {
- await Future.delayed(Duration(seconds: 2));
- return 'success';
- }
- }
|