You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2332 lines
104 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using POSV.HttpApi;
using POSV.Utils;
using POSV.Stock;
using POSV.OtherWaiMai;
namespace POSV.Card
{
public class OtherWaiMaiUtils
{
private static NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
protected static Dictionary<string, string> _errorDesc = new Dictionary<string, string>();
static OtherWaiMaiUtils()
{
//------------------------------------------------------
//系统没有定义的错误代码
_errorDesc.Add("9999", "应答的报文解析异常");
}
/// <summary>
/// 饿了么解绑
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>> EleMeStoreUnbind(EleMeStoreUnbindRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "waimai.eleme.store.unbind");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么解绑失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreUnbindResponse>>(false, "饿了么解绑失败,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么门店创建
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>> EleMeStoreSave(EleMeStoreSaveRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "waimai.eleme.store.save");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么门店获取失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeStoreSaveResponse>>(false, "饿了么门店获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么绑定URL
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>> EleMeAuthorizeUrl(EleMeAuthorizeUrlRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.authorize.url");
parameters.Add("appSign", request.AppSign);
parameters.Add("no", request.No);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么绑定地址获取失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeAuthorizeUrlResponse>>(false, "饿了么绑定地址获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团解绑URL
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>> MeiTuanStoreMapRelaseUrl(MeiTuanStoreMapRelaseUrlRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.store.map.release.url");
parameters.Add("storeId", request.StoreId);
parameters.Add("businessId", request.BusinessId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团外卖绑定地址获取失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapRelaseUrlResponse>>(false, "美团外卖绑定地址获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团门店创建
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>> MeiTuanStoreSave(MeiTuanStoreSaveRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "waimai.meituan.store.save");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团外卖门店获取失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreSaveResponse>>(false, "美团外卖门店获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团绑定前创建美团门店
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>> MeiTuanStoreMapUrl(MeiTuanStoreMapUrlRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.store.map.url");
parameters.Add("storeId", request.StoreId);
parameters.Add("businessId", request.BusinessId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团外卖绑定地址获取失败");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanStoreMapUrlResponse>>(false, "美团外卖绑定地址获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 外卖汇总
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>> WaimaiOrderStatistics(WaimaiOrderStatisticsRequest request)
{
Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.Business);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "waimai.order.statistics");
parameters.Add("storeId", request.StoreId);
parameters.Add("startTime", request.StartTime);
parameters.Add("endTime", request.EndTime);
var ignoreParameters = new List<string>();
ignoreParameters.Add("startTime");
ignoreParameters.Add("endTime");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "外卖汇总查询异常");
result = new Tuple<bool, string, OtherWaiMaiListResponse<WaimaiOrderStatisticsResponse>>(false, "外卖汇总查询异常,本次操作无效", null);
}
return result;
}
///// <summary>
///// 订单信息
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>> BaiDuOrder(BaiDuOrderRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.order.info");
// parameters.Add("storeId", request.StoreId);
// parameters.Add("orderId", request.OrderId);
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuOrderResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度订单查询异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderResponse>>(false, "百度订单询异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度待处理订单查询
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>> QueryBaiDuOrderHandle(BaiDuOrderHandleRequest request)
//{
// Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.order.pending");
// parameters.Add("storeId", request.StoreId);
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiListResponse<BaiDuOrderHandleResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度待处理订单查询异常");
// result = new Tuple<bool, string, OtherWaiMaiListResponse<BaiDuOrderHandleResponse>>(false, "百度待处理订单询异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度外卖历史列表查询
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>> QueryBaiDuOrder(BaiDuOrderListRequest request)
//{
// Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.order.list");
// parameters.Add("storeId", request.StoreId);
// parameters.Add("pageNumber", string.Format("{0}", request.PageNumber));
// parameters.Add("pageSize", string.Format("{0}", request.PageSize));
// parameters.Add("orderDate", request.OrderDate);
// if (request.Status > 0)
// {
// parameters.Add("status", string.Format("{0}", request.Status));
// }
// var ignoreParameters = new List<string>();
// ignoreParameters.Add("pageNumber");
// ignoreParameters.Add("pageSize");
// ignoreParameters.Add("orderDate");
// ignoreParameters.Add("status");
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiPagerResponse<BaiDuOrderListResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度历史订单查询异常");
// result = new Tuple<bool, string, OtherWaiMaiPagerResponse<BaiDuOrderListResponse>>(false, "百度历史订单询异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度订单取消
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>> BaiDuOrderCancel(BaiDuOrderCancelRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.order.cancel");
// parameters.Add("storeId", request.StoreId);
// parameters.Add("orderId", request.OrderId);
// parameters.Add("type", string.Format("{0}", request.Type));
// parameters.Add("reason", request.Reason);
// var ignoreParameters = new List<string>();
// ignoreParameters.Add("type");
// ignoreParameters.Add("reason");
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度订单取消异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderCancelResponse>>(false, "百度订单取消异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度订单接单
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>> BaiDuOrderConfirm(BaiDuOrderConfirmRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.order.confirm");
// parameters.Add("storeId", request.StoreId);
// parameters.Add("orderId", request.OrderId);
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度订单接单异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuOrderConfirmResponse>>(false, "百度订单接单异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度门店歇业
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>> BaiDuShopClose(BaiDuShopCloseRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.shop.close");
// parameters.Add("storeId", request.StoreId);
// var ignoreParameters = new List<string>();
// ignoreParameters.Add("storeId");
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度门店歇业异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopCloseResponse>>(false, "百度门店歇业异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度门店开业
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>> BaiDuShopOpen(BaiDuShopOpenRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.shop.open");
// parameters.Add("storeId", request.StoreId);
// var ignoreParameters = new List<string>();
// ignoreParameters.Add("storeId");
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度门店开业异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopOpenResponse>>(false, "百度门店开业异常,本次操作无效", null);
// }
// return result;
//}
///// <summary>
///// 百度门店信息
///// </summary>
///// <param name="request"></param>
///// <returns></returns>
//public static Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>> BaiDuShopInfo(BaiDuShopInfoRequest request)
//{
// Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>> result = null;
// try
// {
// OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
// SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
// parameters.Add("method", "baidu.shop.get");
// parameters.Add("storeId", request.StoreId);
// var ignoreParameters = new List<string>();
// ignoreParameters.Add("storeId");
// parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
// string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
// //获取成功
// if (Constant.IsSuccessful(response))
// {
// var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>>(response);
// if (data.Status == 1)
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>>(true, data.Message, data);
// }
// else
// {
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>>(false, data.ErrMessage, data);
// }
// }
// else
// {
// string errorMessage = PaserErrors(response);
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>>(false, errorMessage, null);
// }
// }
// catch (Exception ex)
// {
// logger.Error(ex, "百度门店信息查询异常");
// result = new Tuple<bool, string, OtherWaiMaiEntityResponse<BaiDuShopInfoResponse>>(false, "百度门店信息查询异常,本次操作无效", null);
// }
// return result;
//}
/// <summary>
/// 饿了么订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>> EleMeOrder(EleMeOrderRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.query");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeOrderResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么订单获取异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderResponse>>(false, "饿了么订单获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么不同意退单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>> EleMeOrderRefundDisagree(EleMeOrderRefundDisagreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.refund.disagree");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么不同意退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundDisagreeResponse>>(false, "饿了么不同意退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么同意退单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>> EleMeOrderRefundAgree(EleMeOrderRefundAgreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.refund.agree");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么同意退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderRefundAgreeResponse>>(false, "饿了么同意退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么取消订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>> EleMeOrderCancel(EleMeOrderCancelRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.cancel");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("type", string.Format("{0}", request.Type));
parameters.Add("remark", request.Remark);
var ignoreParameters = new List<string>();
ignoreParameters.Add("remark");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么取消订单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderCancelResponse>>(false, "饿了么取消订单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么接单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>> EleMeOrderConfirm(EleMeOrderConfirmRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.confirm");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么接单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeOrderConfirmResponse>>(false, "饿了么接单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么待处理订单查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>> QueryEleMeOrderHandle(EleMeOrderHandleRequest request)
{
Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.handle");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiListResponse<EleMeOrderHandleResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么待处理订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiListResponse<EleMeOrderHandleResponse>>(false, "饿了么待处理订单询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么门店营业/休业
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>> EleMePoiUpdate(EleMePoiUpdateRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.shop.update");
parameters.Add("storeId", request.StoreId);
parameters.Add("isOpen", string.Format("{0}", request.IsOpen));
var ignoreParameters = new List<string>();
ignoreParameters.Add("isOpen");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么门店营业状态变更异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMePoiUpdateResponse>>(false, "饿了么门店营业状态变更异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么门店信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>> EleMeShopInfo(EleMeShopInfoRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.shop.info");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<EleMeShopInfoResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么门店信息查询异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<EleMeShopInfoResponse>>(false, "饿了么门店信息查询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 饿了么历史列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>> QueryEleMeOrder(EleMeOrderListRequest request)
{
Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "eleme.order.list");
parameters.Add("storeId", request.StoreId);
parameters.Add("pageNumber", string.Format("{0}", request.PageNumber));
parameters.Add("pageSize", string.Format("{0}", request.PageSize));
parameters.Add("orderDate", request.OrderDate);
parameters.Add("type", string.Format("{0}", request.Type));
var ignoreParameters = new List<string>();
ignoreParameters.Add("pageNumber");
ignoreParameters.Add("pageSize");
ignoreParameters.Add("orderDate");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiPagerResponse<EleMeOrderListResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "饿了么历史订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<EleMeOrderListResponse>>(false, "饿了么历史订单询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>> MeiTuanOrder(MeiTuanOrderRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.info.byid");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团订单获取异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderResponse>>(false, "美团订单获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团拒绝退款
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>> MeiTuanOrderRefundReject(MeiTuanOrderRefundDisagreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.refund.reject");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团订单拒绝退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, "美团订单拒绝退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团同意退款
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>> MeiTuanOrderRefundAgree(MeiTuanOrderRefundAgreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.refund.agree");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团订单退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, "美团订单退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团订单拒单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>> MeiTuanOrderCancel(MeiTuanOrderCancelRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.cancel");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reasonCode", request.ReasonCode);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团订单拒单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, "美团订单拒单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团订单接单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>> MeiTuanOrderConfirm(MeiTuanOrderConfirmRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.confirm");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团订单接单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, "美团订单接单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团历待处理订单查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>> QueryMeiTuanOrderHandle(MeiTuanOrderHandleRequest request)
{
Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.handle");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团待处理订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiListResponse<MeiTuanOrderHandleResponse>>(false, "美团待处理订单询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团休息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>> MeiTuanPoiClose(MeiTuanPoiCloseRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.poi.close");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团门店休业异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, "美团门店休业异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团营业
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>> MeiTuanPoiOpen(MeiTuanPoiOpenRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.poi.open");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团门店开业异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, "美团门店开业异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团门店信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>> MeiTuanPoiInfo(MeiTuanPoiInfoRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.poi.info");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团门店信息查询异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiInfoResponse>>(false, "美团门店信息查询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 美团历史列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>> QueryMeiTuanOrder(MeiTuanOrderListRequest request)
{
Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "meituan.waimai.order.list");
parameters.Add("storeId", request.StoreId);
parameters.Add("pageNumber", string.Format("{0}", request.PageNumber));
parameters.Add("pageSize", string.Format("{0}", request.PageSize));
parameters.Add("orderDate", request.OrderDate);
parameters.Add("type", string.Format("{0}", request.Type));
var ignoreParameters = new List<string>();
ignoreParameters.Add("pageNumber");
ignoreParameters.Add("pageSize");
ignoreParameters.Add("orderDate");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团历史订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<MeiTuanOrderListResponse>>(false, "美团历史订单询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团订单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> SJ_MeiTuanOrder(MeiTuanOrderRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.info.byid");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团订单获取异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, "商家美团订单获取异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团拒绝退款
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>> SJ_MeiTuanOrderRefundReject(MeiTuanOrderRefundDisagreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.refund.reject");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团订单拒绝退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundDisagreeResponse>>(false, "商家美团订单拒绝退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团同意退款
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>> SJ_MeiTuanOrderRefundAgree(MeiTuanOrderRefundAgreeRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.refund.agree");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团订单退单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderRefundAgreeResponse>>(false, "商家美团订单退单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团订单拒单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>> SJ_MeiTuanOrderCancel(MeiTuanOrderCancelRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.cancel");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("reasonCode", request.ReasonCode);
parameters.Add("reason", request.Reason);
var ignoreParameters = new List<string>();
ignoreParameters.Add("reason");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团订单拒单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderCancelResponse>>(false, "商家美团订单拒单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团订单接单
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>> SJ_MeiTuanOrderConfirm(MeiTuanOrderConfirmRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.confirm");
parameters.Add("storeId", request.StoreId);
parameters.Add("orderId", request.OrderId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团订单接单异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanOrderConfirmResponse>>(false, "商家美团订单接单异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团历待处理订单查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> SJ_QueryMeiTuanOrderHandle(MeiTuanOrderHandleRequest request)
{
Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.handle");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团待处理订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiListResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, "商家美团待处理订单询异常,本次操作无效", null);
}
logger.Info(">>>>>>商家美团待处理订单查询>>>>>{0}", result);
return result;
}
/// <summary>
/// 商家美团休息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>> SJ_MeiTuanPoiClose(MeiTuanPoiCloseRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.poi.close");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团门店休业异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiCloseResponse>>(false, "商家美团门店休业异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团营业
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>> SJ_MeiTuanPoiOpen(MeiTuanPoiOpenRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.poi.open");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, data.Message, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团门店开业异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<MeiTuanPoiOpenResponse>>(false, "商家美团门店开业异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团门店信息
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>> SJ_MeiTuanPoiInfo(MeiTuanPoiInfoRequest request)
{
Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.poi.info");
parameters.Add("storeId", request.StoreId);
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "商家美团门店信息查询异常");
result = new Tuple<bool, string, OtherWaiMaiEntityResponse<ShopMeituanWaiMaiPoiInfo>>(false, "商家美团门店信息查询异常,本次操作无效", null);
}
return result;
}
/// <summary>
/// 商家美团历史列表查询
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public static Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> SJ_QueryMeiTuanOrder(MeiTuanOrderListRequest request)
{
Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>> result = null;
try
{
OpenApi api = OpenApiUtils.Instance.NextApi(ApiType.WaiMai);
SortedList<string, string> parameters = OpenApiUtils.Instance.NewParameters(api);
parameters.Add("method", "shop.meituan.waimai.order.list");
parameters.Add("storeId", request.StoreId);
parameters.Add("pageNumber", string.Format("{0}", request.PageNumber));
parameters.Add("pageSize", string.Format("{0}", request.PageSize));
parameters.Add("orderDate", request.OrderDate);
parameters.Add("type", string.Format("{0}", request.Type));
var ignoreParameters = new List<string>();
ignoreParameters.Add("pageNumber");
ignoreParameters.Add("pageSize");
ignoreParameters.Add("orderDate");
parameters.Add("sign", OpenApiUtils.Instance.Sign(api, parameters, ignoreParameters));
string response = HttpClientUtils.PostAsync(api, api.Url, parameters);
//获取成功
if (Constant.IsSuccessful(response))
{
var data = JsonUtils.Deserialize<OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(response);
if (data.Status == 1)
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(true, data.Message, data);
}
else
{
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, data.ErrMessage, data);
}
}
else
{
string errorMessage = PaserErrors(response);
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, errorMessage, null);
}
}
catch (Exception ex)
{
logger.Error(ex, "美团历史订单查询异常");
result = new Tuple<bool, string, OtherWaiMaiPagerResponse<ShopMeituanWaiMaiOrderInfoByidResponse>>(false, "美团历史订单询异常,本次操作无效", null);
}
logger.Info(">>>>>>美团历史订单查询>>>>>{0}", result);
return result;
}
protected static string PaserErrors(string response)
{
string result = string.Empty;
try
{
logger.Error(response);
Errors mainError = JsonUtils.Deserialize<Errors>(response);
if (_errorDesc.ContainsKey(mainError.Code))
{
result = _errorDesc[mainError.Code];
}
else
{
result = mainError.Message;
}
List<SubErrors> subError = mainError.SubErrors;
if (subError != null && subError.Count > 0)
{
SubErrors error = subError[0];
if (_errorDesc.ContainsKey(error.Code))
{
result = _errorDesc[error.Code];
}
else
{
result = error.Message;
}
}
}
catch (Exception ex)
{
logger.Error(ex, "非法的错误信息格式");
result = _errorDesc["9999"];
}
return result;
}
}
}