Beispiel #1
0
        /// <summary>
        /// 得到会员的扩展信息
        /// </summary>
        /// <param name="pARTNER"></param>
        /// <returns></returns>
        private MemberExtendDTO GetMemberExt(string pARTNER)
        {
            dt_Dyn_DispMember_req w = new dt_Dyn_DispMember_req();

            w.DATA_SOURCE   = AppConfig.DATA_SOURCE;
            w.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            w.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            w.VGROUP        = AppConfig.VGROUP;        //销售组织
            w.PARTNER       = pARTNER;                 //2002652891
            dt_Dyn_DispMember_res dt = WebHmjApiHelp.DispMember(w);

            if (dt.ZCRMT316 == null || dt.ZCRMT316.Length <= 0)
            {
                return(null);
            }

            if (dt.ZCRMT316.Length > 1)
            {
                return(null);
            }

            ZCRMT302_Dyn newmeber = dt.ZCRMT316[0];


            return(newmeber.MapTo <MemberExtendDTO>());
        }
Beispiel #2
0
        /// <summary>
        /// 自己封装耗时的方法
        /// </summary>
        /// <returns></returns>
        static Task SendPiontAsync(int fansid, string openid)
        {
            ICustMemberService api = ObjectFactory.GetInstance <ICustMemberService>();

            return(Task.Run(() =>
            {
                string bp = api.GetOldMember(openid);
                if (!string.IsNullOrEmpty(bp))
                {
                    ZCRMT302_Dyn member = api.GetMemberModelByBp(bp);

                    if (member != null)
                    {
                        CUST_MEMBER model = new CUST_MEMBER()
                        {
                            PARTNER = bp, FANS_ID = fansid
                        };

                        api.InserMeber(model);

                        //发送积分
                        //api.SendPiod(member.ACCOUNT_ID, "300");

                        //如果未激活就执行激活操作
                        if (member.ZZAFLD000004 == "E0005")
                        {
                            api.ChageSatus(member.ACCOUNT_ID);
                        }
                        //标记当前粉丝已经送过积分
                        api.UpdateFans(fansid);
                    }
                }
            }));
        }
Beispiel #3
0
        /// <summary>
        /// 绑定会员
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public string BindMember(string mobile, string openid, string Nickname)
        {
            using (TransScope scope = new TransScope())
            {
                WXCUST_FANS fans = _repo.GetFans(openid);

                if (fans == null)
                {
                    return("3");
                }

                CUST_MEMBER member = _repo.GetMemberByMobile(mobile, fans.ID);

                if (member != null)
                {
                    return("2");
                }

                #region 记录会员
                dt_Dyn_DispMember_req w = new dt_Dyn_DispMember_req();
                w.DATA_SOURCE   = "0002";
                w.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
                w.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
                w.VGROUP        = AppConfig.VGROUP;        //销售组织
                w.MOB_NUMBER    = mobile;                  //2002652891
                dt_Dyn_DispMember_res dt = WebApiHelp.DispMember(w);

                if (dt.ZCRMT316 == null || dt.ZCRMT316.Count() <= 0)
                {
                    return("4");
                }

                if (dt.ZCRMT316.Count() > 1)
                {
                    return("5");
                }

                ZCRMT302_Dyn meber = dt.ZCRMT316[0];

                CUST_MEMBER mebers = new CUST_MEMBER()
                {
                    ADDRESS     = meber.PSTREET,
                    AVA_POINTS  = (int?)meber.ZCCUR_POINT,
                    BIRTHDAY    = string.IsNullOrEmpty(meber.BIRTHDT) ? null : (DateTime?)DateTime.Parse(meber.BIRTHDT),
                    CITY        = "",
                    COUNTRY     = "",
                    CREATE_DATE = DateTime.Now,
                    CREATE_USER = "******",
                    EMAIL       = meber.CSMTP_ADDR,
                    FANS_ID     = fans.ID,
                    GENDER      = meber.XSEX == "2" ? true : false,
                    MEMBERNO    = meber.ACCOUNT_ID,
                    MEM_LEVEL   = meber.ZTIER,
                    MOBILE      = mobile,
                    STATUS      = 1,
                    STORE       = meber.ZH003,
                    NAME        = meber.NAME1_TEXT,
                    PARTNER     = meber.PARTNER,
                    TYPE        = meber.DATA_SOURCE == "0001" ? 0 : 1
                };

                double counts = _repo.Insert(mebers);
                #endregion
                //如果绑定成功需要告诉crm已经绑定
                if (counts > 0)
                {
                    //绑定接口
                    dt_Dyn_UpdateMemberShip_req updates = new dt_Dyn_UpdateMemberShip_req();
                    ZCRMT322_Dyn z = new ZCRMT322_Dyn();
                    z.DATA_SOURCE = "0002";

                    z.LOYALTY_BRAND      = AppConfig.LOYALTY_BRAND; //忠诚度品牌
                    z.SOURCE_SYSTEM      = AppConfig.SOURCE_SYSTEM; //来源系统
                    z.VGROUP             = AppConfig.VGROUP;        //销售组织
                    z.WECHATNAME         = Nickname;
                    z.WECHATFOLLOWSTATUS = "1";
                    z.OPENID             = openid;
                    z.ACCOUNT_ID         = dt.ZCRMT316[0].ACCOUNT_ID;
                    z.PARTNER            = dt.ZCRMT316[0].PARTNER;
                    updates.ZCRMT316     = new ZCRMT322_Dyn[] { z };

                    dt_Dyn_UpdateMemberShip_res ups = WebApiHelp.UpdateMemberShip(updates);

                    //如果是待激活状态那么就要激活
                    if (meber.ZZAFLD000004 == "E0005")
                    {
                        //激活
                        this.ChageSatus(meber.ACCOUNT_ID);
                    }

                    //绑定成功送三百积分
                    if (fans.IS_REGISTER == null || fans.IS_REGISTER == 0)
                    {
                        #region 注册送积分
                        //如果注册会员成功送积分
                        //si_Dyn_ActCreateTel_obService == si_ActCreateTel_obService
                        dt_Dyn_ActCreateTel_req Actreq = new dt_Dyn_ActCreateTel_req();
                        // 数据源类型
                        Actreq.TYPE = "0002";
                        //处理标识
                        Actreq.OBJECT_ID = DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelp.GetRand(10);
                        //活动单据类型
                        Actreq.PROCESS_TYPE = "ZXY";
                        //外部会员卡号	"会员卡号(如已传输手机号,可不用填写会员卡号)"
                        Actreq.ACCOUNT_ID   = meber.ACCOUNT_ID;
                        Actreq.POSTING_DATE = DateTime.Today.ToString();
                        //积分类型
                        Actreq.POINT_TYPE = "ZBCJF01";

                        //积分数  要改
                        Actreq.POINTS = decimal.Parse(AppConfig.POINTS);
                        //单据全局活动ID
                        Actreq.CAMPAIGN_HE_ID = "CMP2820171023005";
                        Actreq.LOYALTY_BRAND  = AppConfig.LOYALTY_BRAND; //忠诚度品牌
                        Actreq.SOURCE_SYSTEM  = AppConfig.SOURCE_SYSTEM; //来源系统
                        Actreq.VGROUP         = AppConfig.VGROUP;        //销售组织

                        dt_Dyn_ActCreateTel_res Actres = WebApiHelp.ActCreateTel(Actreq);

                        string remak = string.Empty;

                        if (Actres.I_ZCRMT047_dyn[0].CHECK_FLAG == "N")
                        {
                            remak = "新注册会员送积分失败,原因:" + Actres.I_ZCRMT047_dyn[0].MESSAGE;
                        }
                        #endregion

                        string str = _repo.UpdateIsRegion(fans.ID);
                    }
                }
                scope.Commit();
                return("1");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 减少或者增加积分
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public string ReduceOrAddPiod(string mobile, string piont, string type)
        {
            string pont_type = "ZXY";

            if (type == "reduce")
            {
                pont_type = "PRODUCT_REDEEM";
            }

            if (type == "add")
            {
                pont_type = "ZXY";
            }

            dt_Dyn_ActCreateTel_req Actreq = new dt_Dyn_ActCreateTel_req();

            // 数据源类型
            Actreq.TYPE = "0002";
            //处理标识
            Actreq.OBJECT_ID = DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelp.GetRand(10);;
            //活动单据类型
            Actreq.PROCESS_TYPE = pont_type;
            //外部会员卡号	"会员卡号(如已传输手机号,可不用填写会员卡号)"
            Actreq.ACCOUNT_ID   = mobile;
            Actreq.POSTING_DATE = DateTime.Today.ToString();
            //积分类型
            Actreq.POINT_TYPE = "ZBCJF01";
            //积分数  要改
            Actreq.POINTS = decimal.Parse(piont);
            //单据全局活动ID
            Actreq.CAMPAIGN_HE_ID = "C-00001786";
            Actreq.LOYALTY_BRAND  = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            Actreq.SOURCE_SYSTEM  = AppConfig.SOURCE_SYSTEM; //来源系统
            Actreq.VGROUP         = AppConfig.VGROUP;        //销售组织

            dt_Dyn_ActCreateTel_res Actres = WebApiHelp.ActCreateTel(Actreq);

            #region 查询会员详情
            dt_Dyn_DispMember_req w = new dt_Dyn_DispMember_req();
            w.DATA_SOURCE   = "0002";
            w.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            w.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            w.VGROUP        = AppConfig.VGROUP;        //销售组织
            w.MOB_NUMBER    = mobile;                  //2002652891
            dt_Dyn_DispMember_res dt = WebApiHelp.DispMember(w);

            if (dt.ZCRMT316 == null || dt.ZCRMT316.Count() <= 0)
            {
                return("未查询到该会员");
            }

            if (dt.ZCRMT316.Count() > 1)
            {
                return("查到多条该信息,请联系开发");
            }
            #endregion

            ZCRMT302_Dyn meber = dt.ZCRMT316[0];

            return(meber.PARTNER);
        }
Beispiel #5
0
        /// <summary>
        /// 获取并更新会员信息
        /// </summary>
        /// <param name="openid"></param>
        /// <returns></returns>
        public MemberInfo GetLoadMember(string openid)
        {
            //查询会员主数据信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(openid);

            #region 得到最新会员信息
            //接口查询会员主数据
            dt_Dyn_DispMember_req w = new dt_Dyn_DispMember_req();
            w.DATA_SOURCE   = "0002";
            w.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            w.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            w.VGROUP        = AppConfig.VGROUP;        //销售组织
            w.PARTNER       = member.PARTNER;          //会员唯一标示
            dt_Dyn_DispMember_res dt = WebApiHelp.DispMember(w);

            if (dt.ZCRMT316 == null || dt.ZCRMT316.Count() <= 0)
            {
                return(null);
            }

            if (dt.ZCRMT316.Count() > 1)
            {
                return(null);
            }

            ZCRMT302_Dyn newmeber = dt.ZCRMT316[0];

            #region 接口查询兑礼密码
            dt_Dyn_ChangeMemberStatus_req req = new dt_Dyn_ChangeMemberStatus_req();
            req.DATA_SOURCE   = AppConfig.DATA_SOURCE;
            req.ZVTWEG        = "102";                   //来源渠道
            req.ACCOUNT_ID    = newmeber.ACCOUNT_ID;
            req.FLAG          = "Q";                     //查询
            req.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            req.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            req.VGROUP        = AppConfig.VGROUP;        //销售组织
            req.PASS_FLAG     = "Y";
            req.REASON        = "查询密码";
            dt_Dyn_ChangeMemberStatus_res res = WebApiHelp.ChangeMemberStatus(req);
            #endregion

            CUST_MEMBER mebers = new CUST_MEMBER()
            {
                ID         = member.ID,
                ADDRESS    = newmeber.PSTREET,
                AVA_POINTS = (int?)newmeber.ZCCUR_POINT,
                BIRTHDAY   = string.IsNullOrEmpty(newmeber.BIRTHDT) ? null :
                             (DateTime?)DateTime.Parse(newmeber.BIRTHDT),
                GENDER       = newmeber.XSEX == "2" ? true : false,
                MEMBERNO     = newmeber.ACCOUNT_ID,
                MOBILE       = newmeber.MOB_NUMBER,
                MEM_LEVEL    = newmeber.ZTIER,
                NAME         = newmeber.NAME1_TEXT,
                PARTNER      = newmeber.PARTNER,
                STORE        = newmeber.ZH003,
                LOGINPASSON  = res.ZPASS,
                NAME_FIRST   = newmeber.NAME_FIRST,
                NAME_LAST    = newmeber.NAME_LAST,
                ZZAFLD000004 = newmeber.ZZAFLD000004
            };
            #endregion

            dt_Dyn_PosCpSearch_req reqs = new dt_Dyn_PosCpSearch_req();
            reqs.ACCOUNT_ID  = member.MEMBERNO;//会员账号和MOB_NUMBER至少输入一个
            reqs.DATA_SOURCE = AppConfig.DATA_SOURCE;

            reqs.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            reqs.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            reqs.VGROUP        = AppConfig.VGROUP;        //销售组织

            dt_Dyn_PosCpSearch_res resok = WebApiHelp.PosCpSearch(reqs);

            int allcount = 0;

            foreach (ZPARTERN_CP2 item in resok.ZPARTERN_CP2)
            {
                //未使用
                if (string.IsNullOrEmpty(item.ZCP_USE_FLAG))
                {
                    //查询另外一个集合的数据
                    dt_Dyn_PosCpSearch_resITEM resout = resok.ZCPQ_RESULT.Where(a => a.ZCP_NUM == item.ZCP_NUM).
                                                        ToList().FirstOrDefault();

                    DateTime endTime = resout.ZCP_EDATE;// DateTime.Parse(resout.ZCP_EDATE);
                    if (endTime >= DateTime.Now)
                    {
                        allcount++;
                    }
                }
            }

            //更新本地会员信息
            int count = _repo.UpdateMember(mebers);

            return(new MemberInfo()
            {
                AVA_POINTS = (int?)newmeber.ZCCUR_POINT,
                MOBILE = newmeber.MOB_NUMBER,
                SEX = newmeber.XSEX == "2" ? 1 : 0,
                COUPON_COUNT = allcount.ToString(),
                MEM_LEVEL = Utility.GetMemberLvl(newmeber.ZTIER)
            });
        }