예제 #1
0
        public ActionResult Search(SEExOrder model)
        {
            MemberResult mbr = BAdminUser.GetInstance().GetMallOrderList(model);

            return(Json(mbr.Data));
        }
예제 #2
0
        /// <summary>
        /// 获取积分商城订单数据
        /// </summary>
        /// <returns></returns>
        public MemberResult GetMallOrderList(SEExOrder model)
        {
            MemberResult ApiResul = new MemberResult {
                Code = 0
            };

            string token = GetMemberToken();

            if (string.IsNullOrEmpty(token))
            {
                return(ApiResul);
            }
            using (HttpClient client = new HttpClient())
            {
                client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
                string url = ConfigHelper.GetConfigString("JDFMemberURL").TrimEnd('/') + "/CRM/VIPMallOrder/Search";
                var    dic = new Dictionary <string, string>();
                dic.Add("ExOrderNoLike", model.ExOrderNoLike);
                dic.Add("ExOrderGoodName", model.ExOrderGoodName);
                dic.Add("VipCusName", model.VipCusName);
                dic.Add("VIPNo", model.VIPNo);
                dic.Add("Mobile", model.Mobile);
                dic.Add("Page", model.Page.ToString());
                dic.Add("Rows", model.Rows.ToString());
                dic.Add("AddTime_From", model.AddTime_From.ToString());
                dic.Add("AddTime_To", model.AddTime_To.ToString());

                HttpContent         httpContent         = new FormUrlEncodedContent(dic);
                HttpResponseMessage httpResponseMessage = client.PostAsync(url, httpContent).Result;
                string callMsg = "";
                if (httpResponseMessage.IsSuccessStatusCode)
                {
                    callMsg = httpResponseMessage.Content.ReadAsStringAsync().Result;
                }
                if (string.IsNullOrWhiteSpace(callMsg))
                {
                    token = GetMemberToken(true);
                    if (string.IsNullOrEmpty(token))
                    {
                        return(ApiResul);
                    }
                    client.DefaultRequestHeaders.Remove("Authorization");
                    client.DefaultRequestHeaders.Add("Authorization", "Bearer " + token);
                    httpResponseMessage = client.PostAsync(url, httpContent).Result;
                    if (httpResponseMessage.IsSuccessStatusCode)
                    {
                        callMsg = httpResponseMessage.Content.ReadAsStringAsync().Result;
                    }
                }
                if (string.IsNullOrWhiteSpace(callMsg))
                {
                    return(ApiResul);
                }
                ApiResul = JsonConvert.DeserializeObject <MemberResult>(callMsg);
                if (ApiResul.Data != null)
                {
                    ApiResul = JsonConvert.DeserializeObject <MemberResult>(callMsg);
                }
            }
            return(ApiResul);
        }