Beispiel #1
0
        /// <summary>
        /// 会员卡资金记录
        /// </summary>
        /// <returns></returns>
        public ActionResult CardLog(int id = 0, int aId = 0, int storeId = 0, int pageIndex = 0, int pageSize = 20)
        {
            DishStore store = DishStoreBLL.SingleModel.GetModelByAid_Id(aId, storeId);

            if (store == null)
            {
                _result.code = 500;
                _result.msg  = "门店不存在";
                return(View("PageError", _result));
            }
            if (id <= 0)
            {
                _result.code = 500;
                _result.msg  = "参数错误 id_error";
                return(View("PageError", _result));
            }
            DishVipCard card                  = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
            int         recordCount           = 0;
            ViewModel <DishCardAccountLog> vm = new ViewModel <DishCardAccountLog>();

            vm.DataList   = DishCardAccountLogBLL.SingleModel.GetRecordLogList(storeId, card.uid, pageIndex + 1, pageSize, out recordCount);
            vm.TotalCount = recordCount;
            vm.PageIndex  = pageIndex;
            vm.PageSize   = pageSize;
            vm.storeId    = storeId;
            vm.aId        = aId;
            return(View(vm));
        }
Beispiel #2
0
 /// <summary>
 /// 会员卡资料编辑
 /// </summary>
 /// <returns></returns>
 public ActionResult CardEdit(int id = 0, int aId = 6901757, int storeId = 8, string act = "")
 {
     if (act != "save")
     {
         if (id <= 0)
         {
             _result.code = 500;
             _result.msg  = "参数错误 id_error";
             return(View("PageError", _result));
         }
         EditModel <DishVipCard> model = new EditModel <DishVipCard>();
         model.DataModel = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         model.aId       = aId;
         model.storeId   = storeId;
         return(View(model));
     }
     else
     {
         if (id <= 0)
         {
             _result.msg = "参数错误 id_error";
             return(Json(_result));
         }
         string      u_name  = Context.GetRequest("u_name", string.Empty);
         string      u_phone = Context.GetRequest("u_phone", string.Empty);
         DishVipCard card    = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         if (card == null)
         {
             _result.msg = "不存在此会员卡";
             return(Json(_result));
         }
         C_UserInfo userInfo = C_UserInfoBLL.SingleModel.GetModel(card.uid);
         if (userInfo == null)
         {
             _result.msg = "不存在此用户";
             return(Json(_result));
         }
         card.u_name = u_name;
         if (!DishVipCardBLL.SingleModel.Update(card, "u_name"))
         {
             _result.msg = "保存失败";
             return(Json(_result));
         }
         userInfo.TelePhone = u_phone;
         if (!C_UserInfoBLL.SingleModel.Update(userInfo, "telephone"))
         {
             _result.msg = "手机号保存失败";
             return(Json(_result));
         }
         _result.code = 1;
         _result.msg  = "保存成功";
         return(Json(_result));
     }
 }
Beispiel #3
0
 /// <summary>
 /// 充值
 /// </summary>
 /// <returns></returns>
 public ActionResult Recharge(int id = 0, int aId = 0, int storeId = 0, string act = "", double account_money = 0, string account_info = "")
 {
     if (act != "save")
     {
         EditModel <DishVipCard> model = new EditModel <DishVipCard>();
         model.aId       = aId;
         model.storeId   = storeId;
         model.DataModel = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         if (model.DataModel == null)
         {
             _result.code = 500;
             _result.msg  = "会员卡不存在";
             return(View("PageError", _result));
         }
         return(View(model));
     }
     else
     {
         if (account_money == 0)
         {
             _result.msg = "充值金额不能为0";
             return(Json(_result));
         }
         if (id <= 0)
         {
             _result.msg = "参数错误 id_error";
             return(Json(_result));
         }
         DishVipCard card = DishVipCardBLL.SingleModel.GetVipCardById_StoreId(id, storeId);
         if (card == null)
         {
             _result.msg = "不存在此会员卡";
             return(Json(_result));
         }
         card.account_balance += account_money;
         if (DishVipCardBLL.SingleModel.Update(card, "account_balance"))
         {
             _result.code = 1;
             _result.msg  = "修改成功";
             DishCardAccountLogBLL.SingleModel.AddRecordLog(card, account_money, account_info);
             return(Json(_result));
         }
         else
         {
             _result.msg = "修改失败";
             return(Json(_result));
         }
     }
 }
Beispiel #4
0
        public void AddRecordLog(DishVipCard card, double account_money, string account_info)
        {
            DishCardAccountLog log = new DishCardAccountLog();

            log.account_money = account_money;
            log.account_info  = string.IsNullOrEmpty(account_info) ? "手动充值" : $"手动充值:{account_info}";
            log.account_type  = 1;
            log.add_time      = DateTime.Now;
            log.aId           = card.aid;
            log.shop_id       = card.shop_id;
            log.user_id       = card.uid;
            log.state         = 1;
            Add(log);

            //发 充值成功通知 模板消息
            DishStore store = DishStoreBLL.SingleModel.GetModelByAid_Id(card.aid, card.shop_id);
            object    curSortQueue_TemplateMsgObj = TemplateMsg_Miniapp.DishMessageData(store.dish_name, card, log, log.account_money, SendTemplateMessageTypeEnum.充值成功通知);

            TemplateMsg_Miniapp.SendTemplateMessage(log.user_id, SendTemplateMessageTypeEnum.充值成功通知, (int)TmpType.智慧餐厅, curSortQueue_TemplateMsgObj, $"pages/restaurant/restaurant-card/index?dish_id={log.shop_id}&savemoney=0");
        }
Beispiel #5
0
        public void AddRecordLog(DishVipCard card, int account_type, double account_money, string info, TransactionModel tran = null)
        {
            DishCardAccountLog log = new DishCardAccountLog();

            log.account_money = account_money;
            log.account_info  = info;
            log.account_type  = account_type;
            log.add_time      = DateTime.Now;
            log.aId           = card.aid;
            log.shop_id       = card.shop_id;
            log.user_id       = card.uid;
            log.state         = 1;

            if (tran != null)
            {
                tran.Add(BuildAddSql(log));
            }
            else
            {
                Add(log);
            }
        }