getGraphicCaptcha static method

Future<String> getGraphicCaptcha(
  1. int width,
  2. int height
)

获取图形验证码 widthheight

Implementation

static Future<String> getGraphicCaptcha(int width, int height) async {
  String tempToken = await getTempToken(1);
  if(tempToken.isEmpty) {
    return formatResponse({});
  }
  String messageId = HttpUtils.getUUID();
  int timestamp = DateTime.now().millisecondsSinceEpoch;
  String sign = CipherUtil.generateSignature(timestamp, messageId);
  Cm005BaseLoginRequest request = Cm005BaseLoginRequest(
      messageId: messageId,
      timestamp: timestamp,
      sign: sign,
      language: 'zh-CN',
      signVersion: '1',
      payLoadVersion: '1',
      payload: Payload(
        token: tempToken,
        type: 'RandomNumberPicture',
        width: width,
        height: height,
      ));
  var result = await HttpUtils.post(true, Api.PATH_GET_PHONE_CAPTCHA,
      data: request.toJson());
  return formatResponse(result);
}