123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import 'dart:core';
- import 'package:fiscommon/json_convert.dart';
- import 'package:fisjsonrpc/client_base.dart';
- import 'login.m.dart';
- /// 登录服务
- class LoginService extends JsonRpcClientBase {
- LoginService(
- String host, {
- String serviceName = "ILoginService",
- Map<String, String>? headers,
- int? timeout,
- }) : super(
- host,
- serviceName,
- headers: headers,
- timeout: timeout,
- ) {
- /// 注册响应实体反序列化处理器
- FJsonConvert.setDecoder((map) => LoginResult.fromJson(map));
- }
- /// 登录
- Future<LoginResult> clientLoginAsync(LoginRequest request) async {
- var rpcRst = await call("ClientLoginAsync", request);
- var result = LoginResult.fromJson(rpcRst as Map<String, dynamic>);
- return result;
- }
- /// 注册
- Future<bool> signInAsync(SignInRequest request) async {
- var rpcRst = await call("SignInAsync", request);
- return rpcRst == true;
- }
- /// 发送邮件验证码
- Future<bool> sendEmailVerificationCode(String address) async {
- var rpcRst = await call("SendEmailVerificationCode", address);
- return rpcRst == true;
- }
- /// 校验邮件验证码
- Future<bool> checkEmailVerificationCode(String address, String code) async {
- var rpcRst = await call("CheckEmailVerificationCode", [address, code]);
- return rpcRst == true;
- }
- /// 发送短信验证码
- Future<bool> sendSMSVerificationCode(String phone) async {
- var rpcRst = await call("SendSMSVerificationCode", phone);
- return rpcRst == true;
- }
- /// 校验短信验证码
- Future<bool> checkSMSVerificationCode(String phone, String code) async {
- var rpcRst = await call("CheckSMSVerificationCode", [phone, code]);
- return rpcRst == true;
- }
- }
|