示例#1
0
文件: WebApiHelp.cs 项目: Thn123/hmj
        /// <summary>
        /// 创建会员
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public static dt_Dyn_UploadMemberShip_res CreateMemberShip(dt_Dyn_UploadMemberShip_req req)
        {
            try
            {
                string   reqStr    = js.Serialize(req);
                DateTime timeStart = DateTime.Now;
                logger.Info("微信注册会员si_Dyn_CreateMemberShip_obService请求信息:" + reqStr);
                si_Dyn_CreateMemberShip_obService web = new si_Dyn_CreateMemberShip_obService();

                dt_Dyn_UploadMemberShip_res res = web.si_Dyn_CreateMemberShip_ob(req);

                string   resStr  = js.Serialize(res);
                DateTime timeEnd = DateTime.Now;
                logger.Info("响应信息" + resStr + "\r\n");

                datalog.DataInfo(reqStr, resStr, timeStart, timeEnd, 0, "si_Dyn_CreateMemberShip_obService", "微信注册会员");
                return(res);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
示例#2
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");
        }