public ActionResult SetupPayType(ShopPayTypeSetupModel model) { JsonModel jm = new JsonModel(); //根据商家ID,获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); T_Shop shop = shopBll.GetEntity(s => s.Id == model.shopId); // 新建用户角色关联表 List <T_ShopPaymentManagement> payTypes = new List <T_ShopPaymentManagement>(); if (model.ids != null) { foreach (var id in model.ids) { T_ShopPaymentManagement item = new T_ShopPaymentManagement() { ShopId = model.shopId, PayTypeId = id }; payTypes.Add(item); } } //修改商家支付类型集合 if (shopBll.SetupPayTypes(shop, payTypes)) { jm.Content = "商家 " + shop.ShopName + " 设置支付类型"; } else { jm.Msg = "设置支付类型失败"; } return(Json(jm, JsonRequestBehavior.AllowGet)); }
public ApiResultModel SetShopPayType(Property.UI.Models.Mobile.ShopPayTypeModel model) { ApiResultModel resultModel = new ApiResultModel(); try { //获取当前用户 IShopUserBLL userBll = BLLFactory <IShopUserBLL> .GetBLL("ShopUserBLL"); T_ShopUser user = userBll.GetEntity(u => u.Id == model.UserId && u.DelFlag == ConstantParam.DEL_FLAG_DEFAULT); if (user != null) { //如果验证Token不通过或已过期 if (DateTime.Now > user.TokenInvalidTime || model.Token != user.Token) { resultModel.Msg = APIMessage.TOKEN_INVALID; return(resultModel); } //更新最近登录时间和Token失效时间 user.LatelyLoginTime = DateTime.Now; user.TokenInvalidTime = DateTime.Now.AddDays(Convert.ToInt32(PropertyUtils.GetConfigParamValue("TokenInvalid"))); userBll.Update(user); //调用商家BLL层获取商家信息 IShopBLL shopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); var shop = shopBll.GetEntity(s => s.Id == model.ShopId); //设置商家支付 if (shop != null) { // 新建用户角色关联表 List <T_ShopPaymentManagement> payTypes = new List <T_ShopPaymentManagement>(); if (!string.IsNullOrEmpty(model.PayTypeIds)) { foreach (var id in model.PayTypeIds.Split(';')) { T_ShopPaymentManagement item = new T_ShopPaymentManagement() { ShopId = model.ShopId, PayTypeId = int.Parse(id) }; payTypes.Add(item); } shopBll.SetupPayTypes(shop, payTypes); } } } else { resultModel.Msg = APIMessage.NO_USER; } } catch { resultModel.Msg = APIMessage.REQUEST_EXCEPTION; } return(resultModel); }