示例#1
0
文件: CommonHelp.cs 项目: Thn123/hmj
        /// <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);
                    }
                }
            }));
        }
示例#2
0
        /// <summary>
        /// 更新会员信息
        /// </summary>
        /// <param name="mebers">如果AVA_POINTS积分赋值-1则表示不更新</param>
        /// <returns></returns>
        public int UpdateMember(CUST_MEMBER mebers)
        {
            string sqlex = string.Empty;

            if (mebers.AVA_POINTS >= 0)
            {
                sqlex += ",AVA_POINTS=@AVA_POINTS";
            }

            if (!string.IsNullOrEmpty(mebers.LOGINPASSON))
            {
                sqlex += ",LOGINPASSON=@LOGINPASSON";
            }

            if (!string.IsNullOrEmpty(mebers.ZZAFLD000004))
            {
                sqlex += ",ZZAFLD000004=@ZZAFLD000004";
            }

            if (!string.IsNullOrEmpty(mebers.MOBILE))
            {
                sqlex += ",MOBILE=@MOBILE";
            }

            if (!string.IsNullOrEmpty(mebers.MEMBERNO))
            {
                sqlex += ",MEMBERNO=@MEMBERNO";
            }

            string sql = @"UPDATE CUST_MEMBER SET  BIRTHDAY=@BIRTHDAY, 
NAME = @NAME,STORE = @STORE, ADDRESS = @ADDRESS,GENDER = @GENDER,MEM_LEVEL = @MEM_LEVEL,NAME_LAST=@NAME_LAST,NAME_FIRST=@NAME_FIRST  "
                         + sqlex + " WHERE ID = @ID";

            return(base.Excute(sql, new
            {
                AVA_POINTS = mebers.AVA_POINTS,
                BIRTHDAY = mebers.BIRTHDAY,
                NAME = mebers.NAME,
                ADDRESS = mebers.ADDRESS,
                GENDER = mebers.GENDER,
                MEM_LEVEL = mebers.MEM_LEVEL,
                STORE = mebers.STORE,
                ID = mebers.ID,
                LOGINPASSON = mebers.LOGINPASSON,
                MOBILE = mebers.MOBILE,
                MEMBERNO = mebers.MEMBERNO,
                NAME_LAST = mebers.NAME_LAST,
                NAME_FIRST = mebers.NAME_FIRST,
                ZZAFLD000004 = mebers.ZZAFLD000004,
            }));
        }
示例#3
0
        /// <summary>
        /// 显示历史记录
        /// </summary>
        /// <param name="openid"></param>
        /// <returns></returns>
        public PointHistory GetPointHistory(string openid)
        {
            //查询会员主数据信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(openid);

            dt_Dyn_GetPointDetail_req req = new dt_Dyn_GetPointDetail_req();

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

            //得到一年之内的历史记录
            req.ZSTART_DATE = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd");
            req.ZEND_DATE   = DateTime.Now.ToString("yyyy-MM-dd");

            req.ACCOUNT_ID = member.MEMBERNO;

            ZCRMT402_Dyn[]      lists = WebApiHelp.GetPointDetail(req).ZCRMT402;
            PointHistory        datas = new PointHistory();
            List <PointHisList> arry  = new List <PointHisList>();

            foreach (ZCRMT402_Dyn dyn in lists)
            {
                PointHisList his = new PointHisList()
                {
                    CATEGORY        = dyn.CATEGORY,
                    CREATED_TIME    = dyn.CREATED_TIME,
                    EXPIRE_DATE     = dyn.EXPIRE_DATE,
                    ORDER_TYPE      = Utility.GetDetailDis(dyn.ORDER_TYPE),
                    POINTS          = dyn.POINTS.ToString(),
                    CREATED_TIME_EX = DateTime.Parse(dyn.CREATED_TIME),
                };

                arry.Add(his);
            }

            datas.Hise  = arry.OrderByDescending(a => a.CREATED_TIME_EX).ToList();
            datas.Point = member.AVA_POINTS.ToString();
            return(datas);
        }
示例#4
0
        /// <summary>
        /// 判断客人是否为华美家会员
        /// </summary>
        /// <param name="arg"></param>
        /// <returns></returns>
        private dynamic GetMemberInfo(dynamic arg)
        {
            string openid = base.GetValue <string>("openid");//openid 为小程序的openid
            //通过第三方开发平台,获取微信公众号下面客人的openid
            ThdPlatformCustInfo ThdPlatformCustInfo = _thdplatform.GetThdPlatformCustInfo(openid, AppConfig.ThdPlatformWechatServiceBrandId);

            if (ThdPlatformCustInfo != null)
            {
                //根据openid 查询cust_member表,如果有记录就返回account_id,/* 没有记录就调用家化接口返回account_id */
                CUST_MEMBER member = _custMember.GetMemberByOpenId(ThdPlatformCustInfo.OpenId);
                if (member == null)
                {
                    return(ResponseJson(false, "没有绑定微信,无法查询卡券信息"));
                }
                return(ResponseJson(true, "OK", member.MEMBERNO));
            }
            else
            {
                return(ResponseJson(false, "第三方开发平台找不到小程序的openid"));
            }
        }
示例#5
0
        /// <summary>
        /// 获取会员详细信息
        /// </summary>
        /// <returns></returns>
        public MemberInfo GetMemberInfo(string openid, string isnew = "1")
        {
            //查询会员信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(openid);

            MemberInfo info = new MemberInfo();

            string storeName = "";

            if (isnew == "1")
            {
                dt_Dyn_DispMemQuick_req w2 = new dt_Dyn_DispMemQuick_req();
                w2.DATA_SOURCE = "0002";//固定
                w2.BP          = member.PARTNER;

                w2.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
                w2.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
                w2.VGROUP        = AppConfig.VGROUP;        //销售组织
                dt_Dyn_DispMemQuick_res dt2 = WebApiHelp.DispMemQuick(w2);
                storeName = dt2.I_ZCRMT316[0].DEPT_T;
            }
            info.AVA_POINTS = member.AVA_POINTS;
            info.MOBILE     = member.MOBILE;
            info.SEX        = member.GENDER == true ? 1 : 0;
            info.NAME       = member.NAME;
            info.ADDRESS    = member.ADDRESS;
            info.MEM_LEVEL  = Utility.GetMemberLvl(member.MEM_LEVEL);
            info.BIRTHDAY   = member.BIRTHDAY;
            info.STORE      = member.STORE;
            info.PWD        = member.LOGINPASSON;
            info.STORE_NAME = storeName;
            info.NAME_FIRST = member.NAME_FIRST;
            info.NAME_LAST  = member.NAME_LAST;
            info.Member_Id  = member.ID.ToString();

            return(info);
        }
示例#6
0
        /// <summary>
        /// 修改会员常规信息
        /// </summary>
        /// <param name="name"></param>
        /// <param name="gender"></param>
        /// <param name="address"></param>
        /// <param name="opendID"></param>
        /// <returns></returns>
        public int UpdateMember(string NAME_LAST, string NAME_FIRST, string gender, string address, string opendID)
        {
            //查询会员主数据信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(opendID);

            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.NAME_LAST  = NAME_LAST;
            z.NAME_FIRST = NAME_FIRST;
            z.NAME1_TEXT = NAME_LAST + NAME_FIRST;
            z.XSEX       = gender == "0" ? "1" : "2"; //1女2男
            z.PSTREET    = address;

            //z.MOB_NUMBER = mobile;
            z.ACCOUNT_ID     = member.MEMBERNO;
            z.PARTNER        = member.PARTNER;
            updates.ZCRMT316 = new ZCRMT322_Dyn[] { z };

            dt_Dyn_UpdateMemberShip_res ups = WebApiHelp.UpdateMemberShip(updates);

            if (ups.WV_RETURN == "Y")
            {
                return(1);
            }
            else
            {
                return(2);
            }
        }
示例#7
0
 /// <summary>
 /// 插入数据库
 /// </summary>
 /// <param name="model"></param>
 public void InserMeber(CUST_MEMBER model)
 {
     _repo.Insert(model);
 }
示例#8
0
        /// <summary>
        /// 获取优惠券
        /// </summary>
        /// <param name="openid"></param>
        /// <returns></returns>
        public MEMBER_COUPON GetCoupon(string openid)
        {
            MEMBER_COUPON coupon = new MEMBER_COUPON();

            //查询会员主数据信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(openid);

            dt_Dyn_PosCpSearch_req reqs = new dt_Dyn_PosCpSearch_req();

            reqs.ACCOUNT_ID  = member.MEMBERNO;//会员账号和MOB_NUMBER至少输入一个
            reqs.DATA_SOURCE = "0002";

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

            dt_Dyn_PosCpSearch_res resok = WebApiHelp.PosCpSearch(reqs);

            if (resok.ZTYPE != "Y")
            {
                return(null);
            }

            //已使用
            List <COUPONS> shiyong = new List <COUPONS>();

            //未使用
            List <COUPONS> meiyou = new List <COUPONS>();

            //已过期
            List <COUPONS> guoqi = new List <COUPONS>();

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

                    COUPONS one = new COUPONS()
                    {
                        BPEXT        = item.BPEXT,
                        ZCP_EDATE    = resout.ZCP_EDATE,
                        ZCP_EDATE_EX = resout.ZCP_EDATE,
                        ZCP_JE       = resout.ZCP_JE,
                        ZCP_POINT    = resout.ZCP_POINT,
                        ZCP_PROD     = resout.ZCP_PROD,
                        ZCP_TYPE     = item.ZCP_TYPE,
                        ZCP_YHQDES   = resout.ZCP_YHQDES,
                        ZCP_ZK       = resout.ZCP_ZK,
                        ZCP_NUM      = resout.ZCP_NUM,
                        ZCP_YHQ      = resout.ZCP_YHQ,
                        ZCP_BDATE    = resout.ZCP_BDATE,
                        ZCP_PASSW    = resout.ZCP_PASSW,
                        IS_BOOK      = 0
                    };


                    one.ZCPUDATE = item.ZCPUDATE;


                    //已使用
                    if (item.ZCP_USE_FLAG == "X")
                    {
                        shiyong.Add(one);
                    }

                    //未使用
                    if (string.IsNullOrEmpty(item.ZCP_USE_FLAG))
                    {
                        DateTime endTime = one.ZCP_EDATE;
                        if (endTime > DateTime.Now)
                        {
                            HMJ_BOOK_EX book = _book.GetBookByNo(one.ZCP_NUM);

                            if (book != null)
                            {
                                if (book.STATUS == 1)
                                {
                                    shiyong.Add(one);
                                }
                                else if (book.STATUS == 0)
                                {
                                    one.IS_BOOK = 1;
                                    meiyou.Add(one);
                                }
                            }
                            else
                            {
                                meiyou.Add(one);
                            }
                        }
                        else
                        {
                            guoqi.Add(one);
                        }
                    }
                }
            }

            coupon.ALREADY_USE = shiyong.OrderByDescending(a => a.ZCPUDATE).ToList();
            coupon.NOT_USE     = meiyou.OrderBy(a => a.ZCP_EDATE_EX).ToList();
            coupon.OBSOLETE    = guoqi.OrderByDescending(a => a.ZCP_EDATE_EX).ToList();
            return(coupon);
        }
示例#9
0
        /// <summary>
        /// 修改会员手机或兑礼密码,
        /// </summary>
        /// <param name="mobile">新手机号</param>
        /// <param name="oldmobile">旧的手机号</param>
        /// <param name="pwd">新密码</param>
        /// <param name="oldpwd">旧密码</param>
        /// <returns></returns>
        public int UpdateMobileOrPwd(string mobile, string oldmobile, string pwd,
                                     string oldpwd, string OpendID, ref string msg)
        {
            //查询会员主数据信息
            CUST_MEMBER member = _repo.GetMemberByOpenId(OpendID);

            //修改手机号
            if (!string.IsNullOrEmpty(mobile) && !string.IsNullOrEmpty(oldmobile))
            {
                //修改手机号
                dt_Dyn_UpdateMemberShip_req updates = new dt_Dyn_UpdateMemberShip_req();
                ZCRMT322_Dyn z = new ZCRMT322_Dyn
                {
                    DATA_SOURCE   = AppConfig.DATA_SOURCE,
                    LOYALTY_BRAND = AppConfig.LOYALTY_BRAND, //忠诚度品牌
                    SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM, //来源系统
                    VGROUP        = AppConfig.VGROUP,        //销售组织
                    MOB_NUMBER    = mobile,
                    ACCOUNT_ID    = member.MEMBERNO,
                    PARTNER       = member.PARTNER
                };
                updates.ZCRMT316 = new ZCRMT322_Dyn[] { z };

                dt_Dyn_UpdateMemberShip_res ups = WebApiHelp.UpdateMemberShip(updates);

                if (ups.WV_RETURN == "Y")
                {
                    return(1);
                }
                else
                {
                    msg = ups.WV_MESSAGE;
                    return(2);
                }
            }

            //修改密码
            if (!string.IsNullOrEmpty(pwd) && !string.IsNullOrEmpty(oldpwd))
            {
                dt_Dyn_ChangePassword_req piq = new dt_Dyn_ChangePassword_req
                {
                    DATA_SOURCE = AppConfig.DATA_SOURCE, //SOURCE
                    ZVTWEG      = "102",
                    ACCOUNT_ID  = member.MEMBERNO,       //EXTERNAL_CARD_NU

                    EXCHANGEPASS  = oldpwd,
                    EXCHANGEPASS2 = pwd,
                    PASS_TYPE     = "2",
                    REASON        = "兑礼密码修改",
                    INIT_FLAG     = "",

                    LOYALTY_BRAND = AppConfig.LOYALTY_BRAND, //忠诚度品牌
                    SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM, //来源系统
                    VGROUP        = AppConfig.VGROUP         //销售组织
                };
                //修改CRM端密码
                dt_Dyn_ChangePassword_res res = WebApiHelp.ChangePassword(piq);

                if (res.ZRETURN == "Y")
                {
                    //修改本地密码
                    CUST_MEMBER mebers = new CUST_MEMBER()
                    {
                        ID          = member.ID,
                        LOGINPASSON = pwd
                    };
                    //更新本地会员信息
                    int count = _repo.UpdateMember(mebers);

                    return(1);
                }
                else
                {
                    return(2);
                }
            }

            return(0);
        }
示例#10
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");
            }
        }
示例#11
0
        /// <summary>
        /// 注册会员
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="openid"></param>
        /// <param name="nameo"></param>
        /// <param name="namek"></param>
        /// <returns></returns>
        public string RegisterMember(string mobile, string openid,
                                     string nameo, string namek, string brithday, string nickname, string gender)
        {
            WXCUST_FANS fans = _repo.GetFans(openid);

            //没有该粉丝
            if (fans == null)
            {
                return("-1");
            }

            #region 调用接口通知crm创建会员
            dt_Dyn_UploadMemberShip_req req = new dt_Dyn_UploadMemberShip_req();
            ZCRMT316_Dyn meber = new ZCRMT316_Dyn();
            meber.MOB_NUMBER         = mobile;
            meber.OPENID             = openid;
            meber.NAME1_TEXT         = nameo + namek;//全名
            meber.DATA_SOURCE        = "0002";
            meber.ACCOUNT_ID         = mobile;
            meber.NAME_LAST          = nameo;
            meber.NAME_FIRST         = namek;
            meber.XSEX               = gender == "1" ? "2" : "1";
            meber.REGION             = "";
            meber.BIRTHDT            = brithday;
            meber.NAMCOUNTRY         = "CN";
            meber.WECHATNAME         = nickname;
            meber.WECHATFOLLOWSTATUS = "1";
            //meber.LOGINPASS2 = "111111";//兑换密码默认123456
            meber.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND; //忠诚度品牌
            meber.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM; //来源系统
            meber.VGROUP        = AppConfig.VGROUP;        //销售组织

            //固定死
            meber.EMPID  = AppConfig.EMPID;
            meber.DEPTID = AppConfig.DEPTID;

            req.ZCRMT316 = new ZCRMT316_Dyn[] { meber };

            //创建会员
            dt_Dyn_UploadMemberShip_res res = WebApiHelp.CreateMemberShip(req);
            #endregion

            if (res.WV_RETURN == "N")
            {
                return(res.WV_MESSAGE);
            }

            //创建成功
            if (res.WV_RETURN == "Y")
            {
                //创建本地会员
                CUST_MEMBER member = new CUST_MEMBER()
                {
                    BIRTHDAY = DateTime.Parse(brithday),
                    FANS_ID  = fans.ID,
                    MEMBERNO = res.ACCOUNT_ID,
                    MOBILE   = mobile,
                    NAME     = nameo + namek,
                    STATUS   = 1,
                    STORE    = AppConfig.DEPTID,
                    TYPE     = 0,
                    //LOGINPASSON = "111111",
                    CREATE_DATE = DateTime.Now,
                    AVA_POINTS  = 0,
                    PARTNER     = res.PARTNER,
                    GENDER      = false
                                  //REMARK = remak
                };

                double counts = _repo.Insert(member);

                if (counts <= 0)
                {
                    return($"请关掉页面并用手机号:{mobile},绑定!");
                }
                else
                {
                    #region 注册送积分
                    //如果注册会员成功送积分
                    //si_Dyn_ActCreateTel_obService == si_ActCreateTel_obService
                    dt_Dyn_ActCreateTel_req Actreq = new dt_Dyn_ActCreateTel_req
                    {
                        // 数据源类型
                        TYPE = "0002",
                        //处理标识
                        OBJECT_ID = DateTime.Now.ToString("yyyyMMddHHmmss") + CommonHelp.GetRand(10),
                        //活动单据类型
                        PROCESS_TYPE = "ZXY",
                        //外部会员卡号	"会员卡号(如已传输手机号,可不用填写会员卡号)"
                        ACCOUNT_ID   = res.ACCOUNT_ID,
                        POSTING_DATE = DateTime.Today.ToString(),
                        //积分类型
                        POINT_TYPE = "ZBCJF01",
                        //积分数  要改
                        POINTS = decimal.Parse(AppConfig.POINTS),
                        //单据全局活动ID
                        CAMPAIGN_HE_ID = "C-00001786",
                        LOYALTY_BRAND  = AppConfig.LOYALTY_BRAND, //忠诚度品牌
                        SOURCE_SYSTEM  = AppConfig.SOURCE_SYSTEM, //来源系统
                        VGROUP         = AppConfig.VGROUP         //销售组织
                    };

                    dt_Dyn_ActCreateTel_res Actres = WebApiHelp.ActCreateTel(Actreq);

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


                    #region 注册成功就要激活会员
                    ////如果是待激活状态那么就要激活
                    //dt_Dyn_ChangeMemberStatus_req reqs = new dt_Dyn_ChangeMemberStatus_req();
                    //reqs.DATA_SOURCE = "0002";
                    //reqs.ZVTWEG = "102";
                    ////req.STATUS_OLD = "E0000";
                    ////req.STATUS_NEW = "E0001";
                    //reqs.ACCOUNT_ID = meber.ACCOUNT_ID;
                    //reqs.FLAG = "I";//激活
                    //reqs.LOYALTY_BRAND = AppConfig.LOYALTY_BRAND;//忠诚度品牌
                    //reqs.SOURCE_SYSTEM = AppConfig.SOURCE_SYSTEM;//来源系统
                    //reqs.VGROUP = AppConfig.VGROUP; //销售组织
                    //reqs.PASS_FLAG = "N";
                    //reqs.REASON = "激活";
                    //dt_Dyn_ChangeMemberStatus_res resok = WebApiHelp.ChangeMemberStatus(reqs);
                    #endregion
                }
            }

            return("1");
        }
示例#12
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)
            });
        }
示例#13
0
        /// <summary>
        /// 判断该粉丝是否已经绑定会员
        /// </summary>
        /// <param name="openid"></param>
        /// <returns></returns>
        public bool ChckBind(string openid)
        {
            CUST_MEMBER member = _repo.GetMemberByOpenId(openid);

            return(member != null);
        }
示例#14
0
        private dynamic sys_login(dynamic arg)
        {
            try
            {
                string code   = base.GetValue <string>("code");
                string appid  = AppConfig.MiniProgramAppId;  // "wx7f0a5d01dce079bf";//小程序id
                string secret = AppConfig.MiniProgramSecret; // "5147ec0051af368bb64e98fa99a28a7e";//小程序secret
                string url    = string.Format("https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code", appid, secret, code);

                var resMessage = NetHelper.HttpRequest(url, "", "GET", 5000, Encoding.UTF8, "application/json");

                if (resMessage.Contains("errcode"))
                {
                    return(ResponseJson(false, "登录失败", null));
                }
                else
                {
                    string openid      = "";
                    string session_key = "";
                    string unionid     = "";
                    string account_id  = "";

                    miniKeyResponse response = JsonConvert.DeserializeObject <miniKeyResponse>(resMessage);
                    openid      = response.openid;
                    session_key = response.session_key;
                    unionid     = response.unionid;
                    string minikey = openid + session_key + unionid;

                    if (!string.IsNullOrWhiteSpace(unionid))//unionid
                    {
                        ThdPlatformCustInfo ThdPlatformCustInfo = _thdplatform.GetThdPlatformCustInfoByUnionid(unionid, AppConfig.ThdPlatformWechatServiceBrandId);
                        if (ThdPlatformCustInfo != null)
                        {
                            //根据openid 查询cust_member表,如果有记录就返回account_id,/* 没有记录就调用家化接口返回account_id */
                            CUST_MEMBER member = _custMember.GetMemberByOpenId(ThdPlatformCustInfo.OpenId);
                            if (member != null)
                            {
                                account_id = member.MEMBERNO;
                            }
                        }
                    }
                    else
                    {
                        return(ResponseJson(false, "登录失败", "请取消关注公众号并重新关注"));
                        //if (!string.IsNullOrWhiteSpace(openid))//openid:小程序openid
                        //{
                        //    ThdPlatformCustInfo ThdPlatformCustInfo = _thdplatform.GetThdPlatformCustInfo(openid, AppConfig.ThdPlatformWechatServiceBrandId);
                        //    if (ThdPlatformCustInfo != null)
                        //    {
                        //        //根据openid 查询cust_member表,如果有记录就返回account_id,/* 没有记录就调用家化接口返回account_id */
                        //        CUST_MEMBER member = _custMember.GetMemberByOpenId(ThdPlatformCustInfo.OpenId);
                        //        if (member != null)
                        //        {
                        //            account_id = member.MEMBERNO;
                        //        }
                        //    }
                        //}
                    }

                    Mini_sessionkey msk = new Mini_sessionkey();
                    msk.minikey     = minikey;
                    msk.openid      = openid;
                    msk.session_key = session_key;
                    msk.unionid     = unionid;
                    msk.account_id  = account_id;
                    msk.create_date = DateTime.Now;
                    long ret = _miniprogram.insertMiniKey(msk);
                    if (ret > 0)
                    {
                        miniCustResponse miniCustResponse = new miniCustResponse();
                        miniCustResponse.minikey    = minikey;
                        miniCustResponse.account_id = account_id;
                        return(ResponseJson(true, "登录成功", miniCustResponse));
                    }
                    else
                    {
                        return(ResponseJson(false, "登录失败", "数据保存失败"));
                    }
                }
            }
            catch (Exception ex)
            {
                return(ResponseJson(false, "失败了", ex.Message));
            }
        }