コード例 #1
0
        public List <XcxAppAccountRelation> GetListByTemplateType(string accountId, TmpType templateType)
        {
            XcxTemplate template = XcxTemplateBLL.SingleModel.GetModelByType((int)templateType);
            string      whereSql = $"AccountId='{accountId}' and TId={template.Id} and state>=0 and outtime>'{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}'";

            return(base.GetList(whereSql));
        }
コード例 #2
0
        public bool AddByFlashItem(FlashDealItem flashItem, C_UserInfo user, TmpType pageType = TmpType.小程序电商模板)
        {
            FlashDeal flashDeal = FlashDealBLL.SingleModel.GetModel(flashItem.DealId);

            object sendContent = new
            {
                keyword1 = new { value = "限时秒杀开始啦!", color = "#000000" },               //交易类型
                keyword2 = new { value = flashDeal.Title, color = "#000000" },          //活动信息
                keyword3 = new { value = flashItem.Title, color = "#000000" },          //商品信息
                keyword4 = new { value = flashDeal.End.ToString(), color = "#000000" }, //到期日
            };

            SubscribeMessage newMsg = new SubscribeMessage
            {
                State       = (int)SubscribeMsgState.等待发送,
                Template    = (int)SendTemplateMessageTypeEnum.秒杀开始通知,
                ContentType = (int)SubscribeMsgType.小程序模板消息,
                UserId      = user.Id,
                SourceId    = flashDeal.Id,
                OpenId      = user.OpenId,
                PageType    = (int)pageType,
                SendTime    = flashDeal.Begin,
                SendContent = JsonConvert.SerializeObject(sendContent)
            };

            int newId = 0;

            return(int.TryParse(Add(newMsg).ToString(), out newId) && newId > 0);
        }
コード例 #3
0
        /// <summary>
        /// 储值退款(共用)
        /// </summary>
        /// <param name="appid"></param>
        /// <param name="aid"></param>
        /// <param name="userid"></param>
        /// <param name="type"></param>
        /// <param name="buyprice"></param>
        /// <param name="ordernum"></param>
        /// <param name="tran"></param>
        /// <param name="msg"></param>
        /// <param name="getsql">是否获取sql</param>
        public void ReturnPrice(string appid, int aid, int userid, TmpType type, int buyprice, string ordernum, ref TransactionModel tran, ref string msg, bool getsql = false)
        {
            if (string.IsNullOrEmpty(appid))
            {
                msg = "储值退款:appid不能为空";
                return;
            }
            if (userid <= 0)
            {
                msg = "储值退款:用户ID无效";
                return;
            }
            if (aid <= 0)
            {
                msg = "储值退款:权限ID无效";
                return;
            }

            SaveMoneySetUser saveMoneyUser = getModelByUserId(appid, userid);

            tran.Add(SaveMoneySetUserLogBLL.SingleModel.BuildAddSql(new SaveMoneySetUserLog()
            {
                AppId          = appid,
                UserId         = userid,
                AId            = aid,
                MoneySetUserId = saveMoneyUser.Id,
                Type           = 1,
                BeforeMoney    = saveMoneyUser.AccountMoney,
                AfterMoney     = saveMoneyUser.AccountMoney + buyprice,
                ChangeMoney    = buyprice,
                ChangeNote     = $"{type.ToString()}购买商品退款,订单号:{ordernum} ",
                CreateDate     = DateTime.Now,
                State          = 1
            }));

            tran.Add($" update SaveMoneySetUser set AccountMoney = AccountMoney + {buyprice} where id =  {saveMoneyUser.Id} ; ");
            if (!getsql)
            {
                if (!ExecuteTransactionDataCorect(tran.sqlArray, tran.ParameterArray))
                {
                    msg = "储值退款:操作失败";
                }
            }
        }
コード例 #4
0
ファイル: FoodReservationBLL.cs プロジェクト: soon14/vzan
        /// <summary>
        /// 发送预约模板消息
        /// </summary>
        /// <param name="reservation"></param>
        /// <param name="msgState">模板消息状态(接单、退款、取消)</param>
        /// <param name="tmpType">模板消息类型(专业版、餐饮版)</param>
        /// <param name="refundOrder">退款订单(仅退款消息需要)</param>
        /// <param name="refundEntOrder">退款订单(仅退款消息需要)</param>
        /// <returns></returns>
        public bool SendReserveMsg(FoodReservation reservation, SendTemplateMessageTypeEnum msgState, TmpType tmpType, EntGoodsOrder refundEntOrder = null, FoodGoodsOrder refundOrder = null)
        {
            //发送小程序模板消息给用户
            object orderData = TemplateMsg_Miniapp.GetReservationTempMsgData(reservation, msgState, refundOrder: refundOrder, refundEntOrder: refundEntOrder);

            if (orderData == null)
            {
                return(false);
            }
            TemplateMsg_Miniapp.SendTemplateMessage(reservation.UserId, msgState, (int)tmpType, orderData);
            return(true);
        }
コード例 #5
0
ファイル: DiscountRuleBLL.cs プロジェクト: soon14/vzan
        /// <summary>
        /// 获取当前订单用户可以得到首单立减优惠的金额(单位:分)
        /// </summary>
        /// <param name="curOrderMoney"></param>
        /// <param name="aId"></param>
        /// <param name="storeId"></param>
        /// <returns></returns>
        public int getFirstOrderDiscountMoney(int userId, int aId, int storeId, TmpType tmpType)
        {
            float discountMoneySum = 0f;               //总的优惠金额
            float newUserFirstOrderDiscountMoney = 0f; //新用户首单立减
            float userFirstOrderDiscountMoney    = 0f; //用户首单立减

            bool isNewUserFirstOrder = false;          //新下单用户为新用户首单
            bool isTodayFirstOrder   = false;          //用户每天下的首单为用户首单

            #region 获取 新用户首单立减,用户首单立减
            switch (tmpType)
            {
            case TmpType.小程序餐饮模板:
                Food store_Food = FoodBLL.SingleModel.GetModel($" appId = {aId} {(storeId > 0 ? $" and Id = {storeId}" : "")} ");
                if (store_Food == null)
                {
                    return(0);
                }

                newUserFirstOrderDiscountMoney = store_Food.funJoinModel.newUserFirstOrderDiscountMoney;
                userFirstOrderDiscountMoney    = store_Food.funJoinModel.userFirstOrderDiscountMoney;
                break;

            case TmpType.小程序多门店模板:
                FootBath store_MultiStore = FootBathBLL.SingleModel.GetModel($" appId = {aId} {(storeId > 0 ? $" and Id = {storeId}" : " and HomeId = 0 ")}");
                if (store_MultiStore == null)
                {
                    return(0);
                }
                storeId = store_MultiStore.Id;

                //读取配置
                SwitchModel switchModel = null;
                try
                {
                    switchModel = JsonConvert.DeserializeObject <SwitchModel>(store_MultiStore.SwitchConfig);
                }
                catch (Exception)
                {
                    switchModel = new SwitchModel();
                }

                newUserFirstOrderDiscountMoney = switchModel.newUserFirstOrderDiscountMoney;
                userFirstOrderDiscountMoney    = switchModel.userFirstOrderDiscountMoney;
                break;

            default:
                return(0);
            }
            #endregion

            if (newUserFirstOrderDiscountMoney == 0f && userFirstOrderDiscountMoney == 0f)
            {
                return(0);
            }

            #region 查询 是否满足优惠条件
            switch (tmpType)
            {
            case TmpType.小程序餐饮模板:

                isNewUserFirstOrder = !FoodGoodsOrderBLL.SingleModel.Exists($" userId = {userId} and  storeId ={storeId} ");
                isTodayFirstOrder   = !FoodGoodsOrderBLL.SingleModel.Exists($" userId = {userId} and  storeId ={storeId} and CreateDate >= '{DateTime.Now.ToString("yyyy-MM-dd")}' ");
                break;

            case TmpType.小程序多门店模板:
                isNewUserFirstOrder = !EntGoodsOrderBLL.SingleModel.Exists($" userId = {userId} and aId = {aId} and  storeId ={storeId} ");
                isTodayFirstOrder   = !EntGoodsOrderBLL.SingleModel.Exists($" userId = {userId} and aId = {aId} and  storeId ={storeId} and CreateDate >= '{DateTime.Now.ToString("yyyy-MM-dd")}' ");
                break;

            default:
                return(0);
            }
            #endregion

            //二者不可累加,取最大值
            if (isNewUserFirstOrder && discountMoneySum < newUserFirstOrderDiscountMoney)
            {
                discountMoneySum = newUserFirstOrderDiscountMoney;
            }
            if (isTodayFirstOrder && discountMoneySum < userFirstOrderDiscountMoney)
            {
                discountMoneySum = userFirstOrderDiscountMoney;
            }

            return(Convert.ToInt32(discountMoneySum * 100));
        }