示例#1
0
        public async Task <string> LoginAsync(string pk, string canumber)
        {
            try
            {
                var replay = await AuthClient.GetCodeAsync(new QMBlockClientSDK.Client.AuthRequest()
                {
                    CaNumber = canumber
                });

                if (replay.Status)
                {
                    //签名
                    var signature = RSAHelper.SignData(pk, replay.Code);
                    var rs        = await AuthClient.GetTokenAsync(new QMBlockClientSDK.Client.AuthRequest()
                    {
                        CaNumber = canumber, Data = signature
                    });

                    if (rs.Status)
                    {
                        _token = rs.Token;
                        return("");
                    }
                    else
                    {
                        return(string.IsNullOrEmpty(rs.Msg) ? "获取token失败" : rs.Msg);
                    }
                }
                else
                {
                    return(string.IsNullOrEmpty(replay.Msg) ? "获取token失败" : replay.Msg);
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                return(ex.Message);
            }
        }