public JsonResult Refund(DishStore store, int?orderId, string remark = null) { if (!orderId.HasValue) { return(ApiModel(message: "参数不能为空[orderId]")); } if (DishOrderBLL.SingleModel.GetModel(orderId.Value)?.storeId != store.id) { return(ApiModel(message: "非法操作")); } DishReturnMsg result = new DishReturnMsg(); DishOrderBLL.SingleModel.RefundOrderById(orderId.Value, result, remark); return(ApiModel(isok: result.code == 1, message: result.msg, data: result.obj)); }
public JsonResult UpdateItem(DishStore store, int?itemId, int count = 0) { if (!itemId.HasValue) { return(ApiModel(message: "参数不能为空[itemId]")); } DishShoppingCart item = DishShoppingCartBLL.SingleModel.GetModel(itemId.Value); if (item == null) { return(ApiModel(message: "订单商品不存在")); } DishOrder order = DishOrderBLL.SingleModel.GetModel(item.order_id); if (order.huodong_manjin_jiner > 0 && order.huodong_manjian_id == 0) { return(ApiModel(message: "2018-8-13前享受满减的订单,不能修改")); } List <DishShoppingCart> carts = DishShoppingCartBLL.SingleModel.GetShoppingCart(item.aId, item.storeId, item.user_id, order.id) ?? new List <DishShoppingCart>(); //购物车 List <DishGood> goods = DishGoodBLL.SingleModel.GetGoodsByIds(carts.Select(c => c.goods_id)?.ToArray()); //购物车内商品详细资料 if (goods == null || carts.Any(c => !goods.Any(g => c.goods_id == g.id))) { return(ApiModel(message: "菜品不存在")); } item.goods_number += count; if (item.goods_number < 0) { item.goods_number = 0; } if (item.goods_number <= 0 && carts.Count == 1) { return(ApiModel(message: "订单至少要有一个菜品")); } DishReturnMsg result = new DishReturnMsg(); bool buildResult = DishOrderBLL.SingleModel.ReBuildOrder(order, store, item, carts, goods, result); return(ApiModel(isok: buildResult, message: buildResult ? "设置成功" : "设置失败")); }
public JsonResult RefundItem(DishStore store, string itemId) { if (string.IsNullOrWhiteSpace(itemId)) { return(ApiModel(message: "参数不能为空[orderId]")); } int[] items = itemId.ConvertToIntList(',').ToArray(); if (!DishShoppingCartBLL.SingleModel.GetCartsByIds(items).All(item => item.storeId == store.id)) { return(ApiModel(message: "非法操作")); } DishReturnMsg result = new DishReturnMsg(); DishOrderBLL.SingleModel.RefundOrderByCartIds(items, result); return(ApiModel(isok: result.code == 1, message: result.msg, data: result.obj)); }
/// <summary> /// 处理智慧餐厅达达配送回调 /// </summary> /// <param name="orderid"></param> /// <param name="state"></param> /// <returns></returns> public bool DadaToMutilFoodReturn(int orderid, DadaOrder order, string appid) { bool isSuccess = false; string updatesql = "state,update_time"; DishOrder dishOrder = DishOrderBLL.SingleModel.GetModel(orderid);// and OrderType ={(int)miniAppFoodOrderType.店内点餐 } "); if (dishOrder == null) { LogHelper.WriteInfo(this.GetType(), "智慧餐厅达达配送:找不到订单"); return(isSuccess); } string msg = string.Empty; switch (order.state) { case (int)DadaOrderEnum.已取消: if (order.state == (int)DadaOrderEnum.已取消) { updatesql += ",cancel_from,cancel_reason"; } isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "智慧餐厅达达配送回调修改系统订单状态出错:" + JsonConvert.SerializeObject(order)); return(isSuccess); } //退款接口 abel //判断是否是取消订单,取消订单则要执行退款 if (dishOrder.pay_status == (int)DishEnums.PayState.已付款) { DishReturnMsg result = new DishReturnMsg(); DishOrderBLL.SingleModel.RefundOrderById(orderid, result); isSuccess = result.code == 1; if (isSuccess) { LogHelper.WriteInfo(this.GetType(), result.msg); } } return(isSuccess); case (int)DadaOrderEnum.待接单: dishOrder.peisong_status = (int)DishEnums.DeliveryState.待商家确认; break; case (int)DadaOrderEnum.待取货: updatesql += ",dm_id,dm_name,dm_mobile"; dishOrder.peisong_status = (int)DishEnums.DeliveryState.待取货; dishOrder.peisong_open = 1; dishOrder.peisong_user_name = order.dm_name; dishOrder.peisong_user_phone = order.dm_mobile; #region 发送餐饮订单配送通知 模板消息 //C_UserInfo userinfo = _userInfoBLL.GetModel(dishOrder.user_id) ?? new C_UserInfo(); //TemplateMsg_UserParam tmgup = _templateMsg_UserParamBLL.getParamByAppIdOpenId(appid, userinfo.OpenId) ?? new TemplateMsg_UserParam(); //TemplateMsg_User tmgu = _templateMsg_UserBLL.getModelByAppIdTypeId(tmgup.AppId, (int)TmpType.小程序餐饮模板, (int)SendTemplateMessageTypeEnum.餐饮订单配送通知) ?? new Entity.MiniApp.Conf.TemplateMsg_User(); //if (tmgu.State == 1) //{ // object postData = _foodGoodsOrderBLL.getTemplateMessageData(dishOrder.id, SendTemplateMessageTypeEnum.餐饮订单配送通知); // _msnModelHelper.sendMyMsn(userinfo.appId, userinfo.OpenId, tmgu.TemplateId, tmgu.PageUrl, tmgup.Form_Id, postData, string.Empty, string.Empty, ref msg); // //参数使用次数增加(默认是1) // _templateMsg_UserParamBLL.addUsingCount(tmgup); //} #endregion break; case (int)DadaOrderEnum.配送中: dishOrder.peisong_status = (int)DishEnums.DeliveryState.配送中; break; case (int)DadaOrderEnum.已完成: dishOrder.peisong_status = (int)DishEnums.DeliveryState.已完成; break; case (int)DadaOrderEnum.已过期: case (int)DadaOrderEnum.系统故障订单发布失败: case (int)DadaOrderEnum.妥投异常之物品返回完成: dishOrder.peisong_status = (int)DishEnums.DeliveryState.已取消; updatesql += ",cancel_from,cancel_reason"; break; } isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "达达配送回调修改系统订单状态出错:" + JsonConvert.SerializeObject(order)); return(isSuccess); } isSuccess = DishOrderBLL.SingleModel.Update(dishOrder, "peisong_status,peisong_open,peisong_user_name,peisong_user_phone"); return(isSuccess); }
public DishCashController() { _result = new DishReturnMsg(); }
/// <summary> /// 处理智慧餐厅UU配送回调 /// </summary> /// <param name="orderid"></param> /// <param name="state"></param> /// <returns></returns> public bool UUToMutilFoodReturn(UUOrder order) { bool isSuccess = false; string updatesql = "State"; DishOrder dishOrder = DishOrderBLL.SingleModel.GetModel(order.OrderId); if (dishOrder == null) { LogHelper.WriteInfo(this.GetType(), "UU配送:找不到智慧餐厅订单"); return(isSuccess); } string msg = string.Empty; switch (order.State) { case (int)UUOrderEnum.订单取消: isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "UU配送:修改UU订单状态出错," + JsonConvert.SerializeObject(order)); return(isSuccess); } //退款接口 abel //判断是否是取消订单,取消订单则要执行退款 if (dishOrder.pay_status == (int)DishEnums.PayState.已付款) { DishReturnMsg result = new DishReturnMsg(); DishOrderBLL.SingleModel.RefundOrderById(order.OrderId, result); isSuccess = result.code == 1; if (isSuccess) { LogHelper.WriteInfo(this.GetType(), result.msg); } } return(isSuccess); case (int)UUOrderEnum.跑男抢单: case (int)UUOrderEnum.已到达: updatesql += ",driver_name,driver_mobile,driver_jobnum"; dishOrder.peisong_status = (int)DishEnums.DeliveryState.待取货; dishOrder.peisong_open = 1; dishOrder.peisong_user_name = order.driver_name; dishOrder.peisong_user_phone = order.driver_mobile; #region 发送餐饮订单配送通知 模板消息 #endregion break; case (int)UUOrderEnum.已取件: case (int)UUOrderEnum.到达目的地: dishOrder.peisong_status = (int)DishEnums.DeliveryState.配送中; break; case (int)UUOrderEnum.收件人已收货: dishOrder.peisong_status = (int)DishEnums.DeliveryState.已完成; break; } isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "UU配送:修改智慧餐厅订单状态出错:" + JsonConvert.SerializeObject(order)); return(isSuccess); } isSuccess = DishOrderBLL.SingleModel.Update(dishOrder, "peisong_status,peisong_open,peisong_user_name,peisong_user_phone"); return(isSuccess); }
public PrinterController() { _result = new DishReturnMsg(); }
public OrderController() { _result = new DishReturnMsg(); }
public ActivityController() { _result = new DishReturnMsg(); }
/// <summary> /// 处理智慧餐厅快跑者配送回调 /// </summary> /// <param name="orderid"></param> /// <param name="state"></param> /// <returns></returns> public bool KPZToMutilFoodReturn(KPZOrder order) { bool isSuccess = false; string updatesql = "status"; DishOrder dishOrder = DishOrderBLL.SingleModel.GetModel(order.OrderId); if (dishOrder == null) { LogHelper.WriteInfo(this.GetType(), "快跑者配送:找不到智慧餐厅订单"); return(isSuccess); } string msg = string.Empty; switch (order.status) { case (int)KPZOrderEnum.已撤销: isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "快跑者配送:修改快跑者订单状态出错," + JsonConvert.SerializeObject(order)); return(isSuccess); } //退款接口 abel //判断是否是取消订单,取消订单则要执行退款 if (dishOrder.pay_status == (int)DishEnums.PayState.已付款) { DishReturnMsg result = new DishReturnMsg(); DishOrderBLL.SingleModel.RefundOrderById(order.OrderId, result); isSuccess = result.code == 1; if (isSuccess) { LogHelper.WriteInfo(this.GetType(), result.msg); } } return(isSuccess); case (int)KPZOrderEnum.待发单: case (int)KPZOrderEnum.待抢单: case (int)KPZOrderEnum.待接单: dishOrder.peisong_status = (int)DishEnums.DeliveryState.待商家确认; break; case (int)KPZOrderEnum.取单中: updatesql += ",courier,tel"; dishOrder.peisong_status = (int)DishEnums.DeliveryState.待取货; dishOrder.peisong_open = 1; dishOrder.peisong_user_name = order.courier; dishOrder.peisong_user_phone = order.tel; #region 发送餐饮订单配送通知 模板消息 #endregion break; case (int)KPZOrderEnum.送单中: dishOrder.peisong_status = (int)DishEnums.DeliveryState.配送中; break; case (int)KPZOrderEnum.已送达: dishOrder.peisong_status = (int)DishEnums.DeliveryState.已完成; break; } isSuccess = base.Update(order, updatesql); if (!isSuccess) { LogHelper.WriteInfo(this.GetType(), "快跑者配送:修改智慧餐厅订单状态出错:" + JsonConvert.SerializeObject(order)); return(isSuccess); } isSuccess = DishOrderBLL.SingleModel.Update(dishOrder, "peisong_status,peisong_open,peisong_user_name,peisong_user_phone"); return(isSuccess); }
public CardController() { _result = new DishReturnMsg(); _result.msg = "网络异常"; }
public ConfigController() { //default params _result = new DishReturnMsg(); _result.msg = "执行失败"; }
public CategoryController() { _result = new DishReturnMsg(); }
public PeiSongController() { _result = new DishReturnMsg(); }