loginCellPhone method

Future<LoginEntity?> loginCellPhone({
  1. required String phone,
  2. String? password,
  3. String? captcha,
  4. String countryCode = '86',
  5. String clientType = 'android',
  6. bool rememberLogin = true,
  7. bool https = true,
})

登录手机号接口

phone 手机号(必填) password 密码(可选,提供验证码时无效) captcha 验证码(可选,若提供此参数,则 password 失效) countryCode 国家代码(可选,默认为 '86') clientType 客户端类型(可选,默认为 'android') rememberLogin 是否记住登录状态(可选,默认为 true) https 是否使用 HTTPS 请求(可选,默认为 true)

Implementation

Future<LoginEntity?> loginCellPhone({
  required String phone,
  String? password,
  String? captcha,
  String countryCode = '86',
  String clientType = 'android',
  bool rememberLogin = true,
  bool https = true,
}) {
  final data = {
    'phone': phone,
    if (captcha == null) 'password': password ?? '', // 只有未提供验证码时才包含密码
    if (captcha != null) 'captcha': captcha, // 提供验证码时忽略密码
    'countrycode': countryCode,
    'clientType': clientType,
    'rememberLogin': rememberLogin,
    'https': https,
  };

  return BujuanMusicManager()
      .post<LoginEntity>(url: Api.loginCellPhone, options: createOption(), data: data);
}