Exemplo n.º 1
0
 internal override object ToProto()
 {
     BaseRespP.Builder builder = BaseRespP.CreateBuilder();
     builder.Type        = (uint)Type();
     builder.Transaction = Transaction;
     builder.ErrCode     = (uint)ErrCode;
     builder.ErrStr      = ErrStr;
     SendAuthResp.Builder builder2 = SendAuthResp.CreateBuilder();
     builder2.Base  = builder.Build();
     builder2.Code  = string.IsNullOrEmpty(Code) ? "" : Code;
     builder2.State = string.IsNullOrEmpty(State) ? "" : State;
     builder2.Url   = string.IsNullOrEmpty(Url) ? "" : Url;
     return(builder2.Build());
 }
Exemplo n.º 2
0
            internal override void FromProto(object protoObj)
            {
                SendAuthResp resp = protoObj as SendAuthResp;

                if (resp != null)
                {
                    Transaction = resp.Base.Transaction;
                    ErrCode     = (int)resp.Base.ErrCode;
                    ErrStr      = resp.Base.ErrStr;
                    Code        = resp.Code;
                    State       = resp.State;
                    Url         = resp.Url;
                }
            }
Exemplo n.º 3
0
        public override async void OnResp(BaseResp resp)
        {
            if (resp.ErrCode == (int)AuthErrCode.WechatAuth_Err_Ok)
            {
                SendAuthResp authResp = (SendAuthResp)resp;
                if (authResp != null)
                {
                    string code = authResp.Code;

                    string url = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx8b14701dca600e63&secret=5ed091c79c9fcbec01bd74d8c573a874&code=" + code + "&grant_type=authorization_code";
                    await WeChatHelper.GetUserInfo(url);
                }
            }
        }
Exemplo n.º 4
0
 internal override object ToProto()
 {
     BaseRespP.Builder builder = BaseRespP.CreateBuilder();
     builder.Type        = (uint)this.Type();
     builder.Transaction = this.Transaction;
     builder.ErrCode     = (uint)this.ErrCode;
     builder.ErrStr      = this.ErrStr;
     SendAuthResp.Builder builder2 = SendAuthResp.CreateBuilder();
     builder2.Base  = builder.Build();
     builder2.Code  = (string.IsNullOrEmpty(this.Code) ? "" : this.Code);
     builder2.State = (string.IsNullOrEmpty(this.State) ? "" : this.State);
     builder2.Url   = (string.IsNullOrEmpty(this.Url) ? "" : this.Url);
     return(builder2.Build());
 }
Exemplo n.º 5
0
            internal override void FromProto(object protoObj)
            {
                if (protoObj == null)
                {
                    return;
                }
                SendAuthResp sendAuthResp = protoObj as SendAuthResp;

                if (sendAuthResp == null)
                {
                    return;
                }
                this.Transaction = sendAuthResp.Base.Transaction;
                this.ErrCode     = (int)sendAuthResp.Base.ErrCode;
                this.ErrStr      = sendAuthResp.Base.ErrStr;
                this.Code        = sendAuthResp.Code;
                this.State       = sendAuthResp.State;
                this.Url         = sendAuthResp.Url;
            }