Exemplo n.º 1
0
        public static string EconfirmCard(int aid, int actid, int cardid, int comid, out Member_Activity actinfo, out string phone, out string name, out decimal idcard, out decimal agcardcode)
        {
            try
            {
                MemberCardData carddate = new MemberCardData();
                var            pro      = carddate.EconfirmCard(aid, actid, cardid, comid, out actinfo, out phone, out name, out idcard, out agcardcode);


                Member_Channel channel = new MemberChannelData().GetChannelDetailByCardNo(idcard.ToString());//根据卡号得到所属渠道的详细信息


                if (channel != null)
                {
                    //给渠道表中 开卡数量和总金额赋值
                    channel.Firstdealnum = channel.Firstdealnum + 1;
                    channel.Summoney     = channel.Summoney + channel.RebateConsume;
                    var channeldata = new MemberChannelData().EditChannel(channel);

                    //把返佣日志录入渠道返佣日志表
                    ChannelRebateLog channelrebatelog = new ChannelRebateLog()
                    {
                        Id          = 0,
                        Channelid   = channel.Id,
                        Execdate    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                        Rebatemoney = channel.RebateConsume,
                        Type        = (int)ChannelRebateType.FirstDeal,
                        Summoney    = channel.Summoney,
                        Remark      = "消费返佣" + channel.RebateConsume + "元"
                    };
                    var channelrebatelogret = new ChannelRebateLogData().EditChannelRebateLog(channelrebatelog);
                }

                return(JsonConvert.SerializeObject(new { type = 100, actinfo = actinfo, phone = phone, name = name, idcard = idcard, agcardcode = agcardcode, msg = pro }));
            }
            catch (Exception ex)
            {
                actinfo    = null;
                phone      = "";
                name       = "";
                idcard     = 0;
                agcardcode = 0;
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Exemplo n.º 2
0
        public static string AccountClaimActPageList(int aid, int cardid, int AccountId, int comid)
        {
            int totalcount = 0;
            var aaid       = 0;
            var ret        = "";

            try
            {
                if (cardid != 0)
                {
                    //查询优惠券
                    MemberActivityData Activitydata  = new MemberActivityData();
                    Member_Activity    Activitymodel = Activitydata.GetMemberActivityById(aid);

                    if (Activitymodel != null)
                    {
                        if (Activitymodel.Runstate == false)
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                        var today = DateTime.Now;

                        if (Activitymodel.Actstar < today && Activitymodel.Actend.AddDays(1) > today)
                        {
                        }
                        else
                        {
                            return(JsonConvert.SerializeObject(new { type = 1, msg = "活动已结束" }));
                        }
                    }


                    //每个活动只能领取一次,防止重复领取,
                    var listact = Activitydata.AccountActInfo(aid, AccountId, comid, out totalcount);
                    if (listact == null)
                    {
                        //领取活动
                        aaid = Activitydata.AccountClaimActPageList(aid, cardid, comid);
                        if (aaid != 0)
                        {
                            if (Activitymodel != null)
                            {
                                if (Activitymodel.Acttype == 4)//只有积分优惠券才会领取时充入积分
                                {
                                    MemberIntegralData intdate = new MemberIntegralData();
                                    Member_Integral    Intinfo = new Member_Integral()
                                    {
                                        Id        = AccountId,
                                        Comid     = comid,
                                        Acttype   = "add_integral",      //操作类型,增加积分
                                        Money     = Activitymodel.Money, //交易金额
                                        Admin     = "领取积分优惠券",
                                        Ip        = "",
                                        Ptype     = 1,
                                        Oid       = 0,
                                        Remark    = "",
                                        OrderId   = 0,
                                        OrderName = Activitymodel.Atitle
                                    };
                                    var InsertIntegral = intdate.InsertOrUpdate(Intinfo);

                                    //优惠券确认使用
                                    Member_Activity actinfo     = null;
                                    string          phone       = "";
                                    string          name        = "";
                                    decimal         idcard      = 0;
                                    decimal         aggcardcode = 0;

                                    MemberCardData carddata = new MemberCardData();
                                    var            confirm  = carddata.EconfirmCard(aaid, aid, cardid, comid, out actinfo, out phone, out name, out idcard, out aggcardcode);



                                    B2bCrmData prodata = new B2bCrmData();
                                    var        list    = prodata.Readuser(AccountId, comid);
                                    //微信消息模板
                                    if (list.Weixin != "")
                                    {
                                        new Weixin_tmplmsgManage().WxTmplMsg_CrmIntegralReward(list.Com_id, list.Weixin, "您好," + AccountId + " 积分已经打入您的账户", list.Idcard.ToString(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "活动赠送", Intinfo.Money.ToString(), list.Integral.ToString(), "如有疑问,请致电客服。");
                                    }
                                }
                            }
                        }
                        ret = "OK";
                    }
                    else
                    {
                        ret = "已领取活动";
                    }

                    return(JsonConvert.SerializeObject(new { type = 100, msg = ret }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new { type = 1, msg = "Unlogin" }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }