Beispiel #1
0
        protected void Button10_Click(object sender, EventArgs e)
        {
            if (t_xml.Text.Trim() == "")
            {
                Label1.Text = "请填写发送内容";
                return;
            }


            MtpDealSendNoticeRequest mrequest = (MtpDealSendNoticeRequest)JsonConvert.DeserializeObject(t_xml.Text.Trim(), typeof(MtpDealSendNoticeRequest));

            ReturnResult r = SimulationMTGetDeal("http://localhost:1111/meituan-jk/dealnoticesend.aspx", mrequest.body);



            Label1.Text = r.Message;
        }
Beispiel #2
0
        public ReturnResult SimulationMTGetDeal(string url, List <MtpDealSendNoticeRequestBody> body)
        {
            ReturnResult result = new ReturnResult
            {
                IsSuccess = false,
            };

            try
            {
                MtpDealSendNoticeRequest requestData = new MtpDealSendNoticeRequest
                {
                    partnerId = agentinfo.mt_partnerId.ConvertTo <int>(0),
                    body      = body
                };

                var responseStr = new MeiTuanInter(agentinfo.mt_partnerId, agentinfo.mt_secret, agentinfo.mt_client).DoRequest(url, JsonConvert.SerializeObject(requestData));
                if (string.IsNullOrEmpty(responseStr))
                {
                    result.Message = "返回数据为空";
                }
                else
                {
                    MtpApiResponse responseBody = (MtpApiResponse)JsonConvert.DeserializeObject(responseStr, typeof(MtpApiResponse));
                    if (responseBody.code == 200)
                    {
                        result.IsSuccess = true;
                        result.Message   = JsonConvert.SerializeObject(responseBody);
                    }
                    else
                    {
                        result.Message = responseBody.describe;
                    }
                }
            }
            catch (Exception ex)
            {
                result.Message = "异常" + ex.Message;
            }
            return(result);
        }