public void ProcessRequest(HttpContext context) { M_UserInfo mu = buser.GetLogin(); retMod.retcode = M_APIResult.Failed; string cartCookID = GetCartCookID(context); //retMod.callback = CallBack;//暂不开放JsonP try { switch (Action) { case "deladdress": { B_UserRecei receBll = new B_UserRecei(); int id = DataConverter.CLng(Req("id")); if (mu == null || mu.UserID == 0 || id < 1) { OldRep("-1"); } else { receBll.U_DelByID(id, mu.UserID); OldRep("1"); } } break; case "setnum": //ID,数量,Cookies,可不登录,数量不能小于1 { int id = DataConverter.CLng(Req("mid")); int pronum = DataConverter.CLng(Req("pronum")); if (id < 1 || pronum < 1 || string.IsNullOrEmpty(cartCookID)) { OldRep("-1"); } else { cartBll.UpdateProNum(cartCookID, mu.UserID, id, pronum); OldRep("1"); } } break; case "arrive": { B_Arrive avBll = new B_Arrive(); string flow = Req("flow"); double money = double.Parse(Req("money")); string err = ""; M_Arrive avMod = avBll.SelModelByFlow(flow, mu.UserID); if (avBll.U_CheckArrive(avMod, mu.UserID, ref money, ref err)) { retMod.retcode = M_APIResult.Success; //已优惠金额,优惠后金额 retMod.result = "{\"amount\":\"" + avMod.Amount + "\",\"money\":\"" + money + "\"}"; } else { retMod.retmsg = err; } } break; default: retMod.retmsg = "[" + Action + "]接口不存在"; break; } } catch (Exception ex) { retMod.retmsg = ex.Message; } RepToClient(retMod); }
public ContentResult OrderCom() { M_APIResult retMod = new M_APIResult(M_APIResult.Failed); switch (action) { case "cart_del": { cartBll.DelByIDS(CartCookID, buser.GetLogin().UserName, ids); retMod.retcode = M_APIResult.Success; } break; case "setnum": //兼容 case "cart_setnum": //ID,数量,Cookies,可不登录,数量不能小于1 { int id = DataConverter.CLng(GetParam("id")); int pronum = DataConverter.CLng(GetParam("pronum")); if (id < 1 || pronum < 1) { retMod.retmsg = "商品ID与数量不能小于1"; } else if (string.IsNullOrEmpty(CartCookID)) { retMod.retmsg = "CartCookID不存在"; } else { cartBll.UpdateProNum(CartCookID, mu.UserID, id, pronum); retMod.retcode = M_APIResult.Success; } } break; case "deladdress": { int id = DataConverter.CLng(GetParam("id")); if (mu == null || mu.UserID == 0 || id < 1) { return(Content(Failed.ToString())); } else { receBll.U_DelByID(id, mu.UserID); return(Content(Success.ToString())); } } case "arrive": { string flow = GetParam("flow"); double money = double.Parse(GetParam("money")); DataTable cartdt = cartBll.SelByCartID(CartCookID, mu.UserID, -100, ids); if (cartdt.Rows.Count < 1) { retMod.retmsg = "购物车为空"; return(Content(retMod.ToString())); } M_Arrive avMod = avBll.SelModelByFlow(flow, mu.UserID); M_Arrive_Result arrMod = avBll.U_CheckArrive(avMod, mu.UserID, cartdt, money); if (arrMod.enabled) { retMod.retcode = M_APIResult.Success; //已优惠金额,优惠后金额 retMod.result = Newtonsoft.Json.JsonConvert.SerializeObject(arrMod); } else { retMod.retmsg = arrMod.err; } } break; default: retMod.retmsg = "[" + action + "]接口不存在"; break; } return(Content(retMod.ToString())); }