Exemplo n.º 1
0
        public JsonResult InviteRegist(string serviceProvider, string openId, string username, string password, string nickName, string headimgurl, long introducer, string sex, string city = null, string province = null, string unionid = null, string mobile = null)
        {
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            username   = System.Web.HttpUtility.UrlDecode(username);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            var platform = PlatformType.GetHashCode();//注册终端来源

            Entities.MemberInfo member;
            if (string.IsNullOrWhiteSpace(username))
            {
                username = mobile;
            }
            if (!string.IsNullOrWhiteSpace(serviceProvider) && !string.IsNullOrWhiteSpace(openId))
            {
                member = _iMemberService.Register(username, password, serviceProvider, openId, platform, sex, headimgurl, introducer, nickName
                                                  , city, province, unionid, spreadId: CurrentSpreadId);
            }
            else
            {
                member = _iMemberService.Register(username, password, platform, mobile, "", introducer, spreadId: CurrentSpreadId);
            }

            //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
            _iBonusService.DepositToRegister(member.Id);
            //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
            int num = CouponApplication.RegisterSendCoupon(member.Id, member.UserName);

            ClearDistributionSpreadCookie();
            base.SetUserLoginCookie(member.Id);
            Application.MemberApplication.UpdateLastLoginDate(member.Id);
            _iMemberService.AddIntegel(member); //给用户加积分//执行登录后初始化相关操作
            return(Json <dynamic>(success: true, data: new { memberId = member.Id, num = num }));
        }
Exemplo n.º 2
0
        public JsonResult SubmitOrder(CommonModel.OrderPostModel model)
        {
            model.CurrentUser            = CurrentUser;
            model.DistributionUserLinkId = GetDistributionUserLinkId();
            model.PlatformType           = PlatformType.GetHashCode();

            var result = OrderApplication.SubmitOrder(model);

            ClearDistributionUserLinkId();   //清理分销cookie
            OrderApplication.AddVshopBuyNumber(result.OrderIds);
            Session.Remove("OrderTag");
            return(Json(new { success = result.Success, orderIds = result.OrderIds, realTotalIsZero = result.OrderTotal == 0 }));
        }
        /// <summary>
        /// 获取指定平台下打印机列表
        /// </summary>
        /// <param name="platformType"></param>
        /// <returns></returns>
        public List <ShopPrinterEntity> GetList(PlatformType platformType)
        {
            var sql = @"SELECT 
                              spr.*
                        FROM bll_shop_platform AS spl 
                             INNER JOIN bll_shop_printer AS spr ON spl.ShopId = spr.ShopId 
                        WHERE spl.PlatformId = @platformId AND spr.EnabledFlag = 1 AND spr.DeleteFlag = 0";

            var parms = new List <DbParameter>();

            parms.Add(DbParameters.CreateDbParameter("platformId", platformType.GetHashCode()));

            return(this.BaseRepository().FindList(sql, parms.ToArray()).ToList <ShopPrinterEntity>());
        }
Exemplo n.º 4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (PlatformType != global::AcFunDanmu.DeviceInfo.Types.PlatformType.KInvalid)
            {
                hash ^= PlatformType.GetHashCode();
            }
            if (OsVersion.Length != 0)
            {
                hash ^= OsVersion.GetHashCode();
            }
            if (DeviceModel.Length != 0)
            {
                hash ^= DeviceModel.GetHashCode();
            }
            if (ImeiMd5.Length != 0)
            {
                hash ^= ImeiMd5.GetHashCode();
            }
            if (DeviceId.Length != 0)
            {
                hash ^= DeviceId.GetHashCode();
            }
            if (SoftDid.Length != 0)
            {
                hash ^= SoftDid.GetHashCode();
            }
            if (KwaiDid.Length != 0)
            {
                hash ^= KwaiDid.GetHashCode();
            }
            if (Manufacturer.Length != 0)
            {
                hash ^= Manufacturer.GetHashCode();
            }
            if (DeviceName.Length != 0)
            {
                hash ^= DeviceName.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemplo n.º 5
0
        public JsonResult SubmitOrder(OrderPostModel model, string payPwd)
        {
            model.CurrentUser       = CurrentUser;
            model.PlatformType      = PlatformType.GetHashCode();
            model.IsShopbranchOrder = true;
            var result = OrderApplication.SubmitOrder(model, payPwd);

            OrderApplication.AddVshopBuyNumber(result.OrderIds);
            #region 处理虚拟订单项
            OrderApplication.AddVshopBuyNumber(result.OrderIds);
            if (model.ProductType == 1 && model.VirtualProductItems != null && model.VirtualProductItems.Count() > 0)
            {
                var orderId = result.OrderIds.FirstOrDefault();
                if (orderId > 0)
                {
                    var orderItemInfo = OrderApplication.GetOrderItemsByOrderId(orderId).FirstOrDefault();
                    if (orderItemInfo != null)
                    {
                        var list = model.VirtualProductItems.ToList().Where(a => !string.IsNullOrWhiteSpace(a.Content)).ToList();//过滤空项
                        list.ForEach(a =>
                        {
                            a.OrderId     = orderId;
                            a.OrderItemId = orderItemInfo.Id;
                            if (a.VirtualProductItemType == (sbyte)ProductInfo.VirtualProductItemType.Picture)
                            {
                                a.Content = MoveImages(a.Content, CurrentUser.Id);
                            }
                        });
                        if (list.Count > 0)
                        {
                            OrderApplication.AddVirtualOrderItemInfo(list);
                        }
                    }
                }
            }
            #endregion
            HttpContext.Session.Remove("OrderTag");
            return(Json <dynamic>(result.Success, data: new { orderIds = result.OrderIds, realTotalIsZero = result.OrderTotal == 0 }));
        }
Exemplo n.º 6
0
        public JsonResult Skip(string serviceProvider, string openId, string nickName, string realName, string headimgurl, Entities.MemberOpenIdInfo.AppIdTypeEnum appidtype = Entities.MemberOpenIdInfo.AppIdTypeEnum.Normal, string unionid = null, string sex = null, string city = null, string province = null)
        {
            int    num      = 0;
            string username = DateTime.Now.ToString("yyMMddHHmmssffffff");   //TODO:DZY[150916]未使用,在方法内会重新生成

            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            realName   = System.Web.HttpUtility.UrlDecode(realName);
            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            Entities.MemberInfo memberInfo = _iMemberService.GetMemberByUnionIdOpenId(unionid, openId);
            if (memberInfo == null)
            {
                memberInfo = _iMemberService.QuickRegister(username, realName, nickName, serviceProvider, openId, PlatformType.GetHashCode(),
                                                           unionid, sex, headimgurl, appidtype, null, city, province, spreadId: CurrentSpreadId);
                //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
                _iBonusService.DepositToRegister(memberInfo.Id);
                //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
                if (memberInfo.IsNewAccount)
                {
                    num = CouponApplication.RegisterSendCoupon(memberInfo.Id, memberInfo.UserName);
                }
                ClearDistributionSpreadCookie();
                _iMemberService.AddIntegel(memberInfo); //给用户加积分//执行登录后初始化相关操作
            }

            base.SetUserLoginCookie(memberInfo.Id);
            Application.MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            WebHelper.SetCookie(CookieKeysCollection.HIMALL_ACTIVELOGOUT, "0", DateTime.MaxValue);

            #region 判断是否强制绑定手机号
            MemberApplication.UpdateLastLoginDate(memberInfo.Id);
            var isBind = MessageApplication.IsOpenBindSms(memberInfo.Id);
            if (!isBind)
            {
                return(Json <dynamic>(success: false, data: new { num = num }, code: 99));
            }
            #endregion

            return(Json <dynamic>(success: true, data: new { num = num }));
        }
Exemplo n.º 7
0
        public JsonResult Index(string serviceProvider, string openId, string username, string password, string checkCode, string mobilecheckCode,
                                string headimgurl, long introducer = 0, string unionid = null, string sex = null,
                                string city = null, string province = null, string country = null, string nickName = null, string email = "", string emailcheckCode = "")
        {
            var    mobilepluginId  = "Himall.Plugin.Message.SMS";
            var    emailpluginId   = "Himall.Plugin.Message.Email";
            string systemCheckCode = Session[CHECK_CODE_KEY] as string;

            if (systemCheckCode.ToLower() != checkCode.ToLower())
            {
                throw new Core.HimallException("验证码错误");
            }

            if (Core.Helper.ValidateHelper.IsMobile(username))
            {
                var cache     = CacheKeyCollection.MemberPluginCheck(username, mobilepluginId);
                var cacheCode = Core.Cache.Get <string>(cache);

                if (string.IsNullOrEmpty(mobilecheckCode) || mobilecheckCode.ToLower() != cacheCode.ToLower())
                {
                    throw new Core.HimallException("手机验证码错误");
                }
            }

            if (!string.IsNullOrEmpty(email) && Core.Helper.ValidateHelper.IsMobile(email))
            {
                var cache     = CacheKeyCollection.MemberPluginCheck(username, emailpluginId);
                var cacheCode = Core.Cache.Get <string>(cache);

                if (string.IsNullOrEmpty(emailcheckCode) || emailcheckCode.ToLower() != cacheCode.ToLower())
                {
                    throw new Core.HimallException("手机验证码错误");
                }
            }

            headimgurl = System.Web.HttpUtility.UrlDecode(headimgurl);
            nickName   = System.Web.HttpUtility.UrlDecode(nickName);
            province   = System.Web.HttpUtility.UrlDecode(province);
            city       = System.Web.HttpUtility.UrlDecode(city);
            Entities.MemberInfo member;
            var mobile = "";

            if (Core.Helper.ValidateHelper.IsMobile(username))
            {
                mobile = username;
            }
            var platform = PlatformType.GetHashCode();//注册终端来源

            if (!string.IsNullOrWhiteSpace(serviceProvider) && !string.IsNullOrWhiteSpace(openId))
            {
                OAuthUserModel userModel = new OAuthUserModel
                {
                    UserName      = username,
                    Password      = password,
                    LoginProvider = serviceProvider,
                    OpenId        = openId,
                    Headimgurl    = headimgurl,
                    Sex           = sex,
                    NickName      = nickName,
                    Email         = email,
                    UnionId       = unionid,
                    introducer    = introducer,
                    Province      = province,
                    City          = city,
                    Platform      = platform,
                    SpreadId      = CurrentSpreadId
                };
                member = _iMemberService.Register(userModel);
            }
            else
            {
                member = _iMemberService.Register(username, password, platform, mobile, email, introducer, spreadId: CurrentSpreadId);
            }
            if (member != null)
            {
                Session.Remove(CHECK_CODE_KEY);
                MessageHelper helper = new MessageHelper();
                helper.ClearErrorTimes(member.UserName);
                if (!string.IsNullOrEmpty(email))
                {
                    helper.ClearErrorTimes(member.Email);
                }
                ClearDistributionSpreadCookie();
            }
            //TODO:ZJT  在用户注册的时候,检查此用户是否存在OpenId是否存在红包,存在则添加到用户预存款里
            _iBonusService.DepositToRegister(member.Id);
            //用户注册的时候,检查是否开启注册领取优惠券活动,存在自动添加到用户预存款里
            int num = CouponApplication.RegisterSendCoupon(member.Id, member.UserName);

            base.SetUserLoginCookie(member.Id);
            Application.MemberApplication.UpdateLastLoginDate(member.Id);
            _iMemberService.AddIntegel(member); //给用户加积分//执行登录后初始化相关操作
            return(Json <dynamic>(success: true, data: new { memberId = member.Id, num = num }));
        }
Exemplo n.º 8
0
 /// <summary>
 /// 解除门店平台映射
 /// </summary>
 /// <param name="shopId"></param>
 /// <param name="pType"></param>
 /// <param name="authType"></param>
 /// <returns></returns>
 public int SyncUnMapShopPlatformData(long shopId, PlatformType pType, AuthBussinessType authType)
 {
     LogUtil.Info(string.Format("开始同步解除门店授权平台数据", string.Empty));
     return(spServ.Delete(shopId, pType.GetHashCode(), authType.GetHashCode()));
 }
Exemplo n.º 9
0
        /// <summary>
        /// 同步门店平台数据
        /// </summary>
        /// <param name="shopId"></param>
        /// <param name="appAuthToken"></param>
        /// <param name="expiresIn"></param>
        /// <param name="refreshToken"></param>
        /// <param name="paltformType"></param>
        /// <param name="authType"></param>
        /// <param name="businessType"></param>
        /// <returns></returns>
        public int SyncShopPlatformData(string shopId, string appAuthToken, long expiresIn, string refreshToken, PlatformType paltformType, AuthBussinessType authType, BusinessType businessType, string pShopId = "", string source = "", string secret = "", string remark = "")
        {
            //同步平台数据
            LogUtil.Info(string.Format("开始同步门店授权【{0}】平台数据", paltformType.GetRemark()));
            var cnt        = 0;
            var platformId = paltformType.GetHashCode();
            var shop       = GetPlatformShopModel(platformId, appAuthToken, shopId, pShopId, source, secret);
            var db         = new RepositoryFactory().BaseRepository().BeginTrans();

            try
            {
                var dbNow        = TimeUtil.Now;
                var authPlatform = GetShopPlatformInfo(shopId.ToInt(), platformId, businessType.GetHashCode(), authType);
                if (authPlatform != null)
                {
                    authPlatform.AuthToken     = appAuthToken;
                    authPlatform.ExpiresIn     = expiresIn;
                    authPlatform.IsAutoConfirm = 1;

                    if (paltformType == PlatformType.Meituan)
                    {
                        //美团外卖
                        authPlatform.PlatformShopName = shop != null ? shop.name : string.Empty;
                        authPlatform.Mobile           = shop != null ? shop.phone : string.Empty;
                        authPlatform.ShopAddress      = shop != null ? shop.address : string.Empty;
                        authPlatform.BusinessScope    = shop != null ? shop.tagName : string.Empty;
                        authPlatform.Latitude         = shop != null ? shop.latitude : string.Empty;
                        authPlatform.Longitude        = shop != null ? shop.longitude : string.Empty;
                        authPlatform.PictureUrl       = shop != null ? shop.pictureUrl : string.Empty;
                        authPlatform.OpenTime         = shop != null ? shop.openTime : string.Empty;
                        authPlatform.ShippingFee      = shop != null ? shop.shippingFee : 0.00f;
                        authPlatform.PreBook          = shop != null ? shop.preBook : 0;
                        authPlatform.TimeSelect       = shop != null ? shop.timeSelect : 0;
                    }
                    else if (paltformType == PlatformType.Eleme)
                    {
                        //饿了么
                        if (shop != null && shop.error != null)
                        {
                            LogUtil.Error(shop.error.ToString());
                        }
                        var eShop = Yme.Util.JsonUtil.ToObject <Dictionary <string, object> >((shop != null && shop.result != null) ? shop.result.ToString() : string.Empty);
                        authPlatform.PlatformShopName  = (eShop != null && eShop["name"] != null) ? eShop["name"].ToString() : string.Empty;
                        authPlatform.PlatformShopId    = (eShop != null && eShop["id"] != null) ? eShop["id"].ToString() : string.Empty;
                        authPlatform.Mobile            = (eShop != null && eShop["mobile"] != null) ? eShop["mobile"].ToString() : string.Empty;
                        authPlatform.ShopAddress       = (eShop != null && eShop["addressText"] != null) ? eShop["addressText"].ToString() : string.Empty;
                        authPlatform.Latitude          = (eShop != null && eShop["latitude"] != null) ? eShop["latitude"].ToString() : string.Empty;
                        authPlatform.Longitude         = (eShop != null && eShop["longitude"] != null) ? eShop["longitude"].ToString() : string.Empty;
                        authPlatform.PictureUrl        = (eShop != null && eShop["imageUrl"] != null) ? eShop["imageUrl"].ToString() : string.Empty;
                        authPlatform.OpenTime          = (eShop != null && eShop["servingTime"] != null) ? eShop["servingTime"].ToString() : string.Empty;
                        authPlatform.RefreshToken      = refreshToken;
                        authPlatform.RefreshExpireTime = TimeUtil.Now.AddDays(ConfigUtil.EleReTokenExpiresDays);
                    }
                    else if (paltformType == PlatformType.Baidu)
                    {
                        //百度外卖
                        if (shop != null && shop.error != null)
                        {
                            LogUtil.Error(shop.error.ToString());
                        }
                        var category = string.Empty;
                        var bShop    = Yme.Util.JsonUtil.ToObject <Dictionary <string, object> >((shop != null && shop.data != null) ? shop.data.ToString() : string.Empty);
                        if (bShop != null)
                        {
                            if (!string.IsNullOrWhiteSpace(bShop["category1"]))
                            {
                                category = bShop["category1"].ToString();
                            }
                            if (!string.IsNullOrWhiteSpace(bShop["category2"]))
                            {
                                category += string.Format("-{0}", bShop["category2"].ToString());
                            }
                            if (!string.IsNullOrWhiteSpace(bShop["category3"]))
                            {
                                category += string.Format("-{0}", bShop["category3"].ToString());
                            }
                        }
                        authPlatform.PlatformShopName = (bShop != null && bShop["name"] != null) ? bShop["name"].ToString() : string.Empty;
                        authPlatform.PlatformShopId   = (bShop != null && bShop["baidu_shop_id"] != null) ? bShop["baidu_shop_id"].ToString() : string.Empty;
                        authPlatform.Mobile           = (bShop != null && bShop["service_phone"] != null) ? bShop["service_phone"].ToString() : string.Empty;
                        authPlatform.ShopAddress      = (bShop != null && bShop["address"] != null) ? bShop["address"].ToString() : string.Empty;
                        authPlatform.BusinessScope    = category;
                        authPlatform.Latitude         = (bShop != null && bShop["latitude"] != null) ? bShop["latitude"].ToString() : string.Empty;
                        authPlatform.Longitude        = (bShop != null && bShop["longitude"] != null) ? bShop["longitude"].ToString() : string.Empty;
                        authPlatform.PictureUrl       = (bShop != null && bShop["shop_logo"] != null) ? bShop["shop_logo"].ToString() : string.Empty;
                        authPlatform.OpenTime         = (bShop != null && bShop["business_time"] != null) ? bShop["business_time"].ToString() : string.Empty;
                        authPlatform.RefreshToken     = refreshToken;
                        authPlatform.Description      = remark;
                    }

                    authPlatform.ModifyUserId = paltformType.GetRemark();
                    authPlatform.ModifyDate   = dbNow;
                    db.Update(authPlatform);
                }
                else
                {
                    authPlatform               = new ShopPlatformEntity();
                    authPlatform.ShopId        = shopId.ToInt();
                    authPlatform.PlatformId    = platformId;
                    authPlatform.PlatformName  = paltformType.GetRemark();
                    authPlatform.BusinessType  = businessType.GetHashCode();
                    authPlatform.AuthBussiness = authType.GetHashCode();
                    authPlatform.AuthToken     = appAuthToken;
                    authPlatform.ExpiresIn     = expiresIn;
                    authPlatform.IsAutoConfirm = 1;

                    if (paltformType == PlatformType.Meituan)
                    {
                        //美团外卖
                        authPlatform.PlatformShopName = shop != null ? shop.name : string.Empty;
                        authPlatform.Mobile           = shop != null ? shop.phone : string.Empty;
                        authPlatform.ShopAddress      = shop != null ? shop.address : string.Empty;
                        authPlatform.BusinessScope    = shop != null ? shop.tagName : string.Empty;
                        authPlatform.Latitude         = shop != null ? shop.latitude : string.Empty;
                        authPlatform.Longitude        = shop != null ? shop.longitude : string.Empty;
                        authPlatform.PictureUrl       = shop != null ? shop.pictureUrl : string.Empty;
                        authPlatform.OpenTime         = shop != null ? shop.openTime : string.Empty;
                        authPlatform.ShippingFee      = shop != null ? shop.shippingFee : 0.00f;
                        authPlatform.PreBook          = shop != null ? shop.preBook : 0;
                        authPlatform.TimeSelect       = shop != null ? shop.timeSelect : 0;
                    }
                    else if (paltformType == PlatformType.Eleme)
                    {
                        //饿了么
                        if (shop != null && shop.error != null)
                        {
                            LogUtil.Error(shop.error.ToString());
                        }
                        var eShop = Yme.Util.JsonUtil.ToObject <Dictionary <string, object> >((shop != null && shop.result != null) ? shop.result.ToString() : string.Empty);
                        authPlatform.PlatformShopName  = (eShop != null && eShop["name"] != null) ? eShop["name"].ToString() : string.Empty;
                        authPlatform.PlatformShopId    = (eShop != null && eShop["id"] != null) ? eShop["id"].ToString() : appAuthToken;
                        authPlatform.Mobile            = (eShop != null && eShop["mobile"] != null) ? eShop["mobile"].ToString() : string.Empty;
                        authPlatform.ShopAddress       = (eShop != null && eShop["addressText"] != null) ? eShop["addressText"].ToString() : string.Empty;
                        authPlatform.Latitude          = (eShop != null && eShop["latitude"] != null) ? eShop["latitude"].ToString() : string.Empty;
                        authPlatform.Longitude         = (eShop != null && eShop["longitude"] != null) ? eShop["longitude"].ToString() : string.Empty;
                        authPlatform.PictureUrl        = (eShop != null && eShop["imageUrl"] != null) ? eShop["imageUrl"].ToString() : string.Empty;
                        authPlatform.OpenTime          = (eShop != null && eShop["servingTime"] != null) ? eShop["servingTime"].ToString() : string.Empty;
                        authPlatform.RefreshToken      = refreshToken;
                        authPlatform.RefreshExpireTime = TimeUtil.Now.AddDays(ConfigUtil.EleReTokenExpiresDays);
                        authPlatform.ModifyDate        = dbNow;
                    }
                    else if (paltformType == PlatformType.Baidu)
                    {
                        //百度外卖
                        if (shop != null && shop.errno != 0)
                        {
                            LogUtil.Error(shop.error.ToString());
                        }
                        var category = string.Empty;
                        var bShop    = Yme.Util.JsonUtil.ToObject <Dictionary <string, object> >((shop != null && shop.data != null) ? shop.data.ToString() : string.Empty);
                        if (bShop != null)
                        {
                            if (!string.IsNullOrWhiteSpace(bShop["category1"]))
                            {
                                category = bShop["category1"].ToString();
                            }
                            if (!string.IsNullOrWhiteSpace(bShop["category2"]))
                            {
                                category += string.Format("-{0}", bShop["category2"].ToString());
                            }
                            if (!string.IsNullOrWhiteSpace(bShop["category3"]))
                            {
                                category += string.Format("-{0}", bShop["category3"].ToString());
                            }
                        }
                        authPlatform.PlatformShopName = (bShop != null && bShop["name"] != null) ? bShop["name"].ToString() : string.Empty;
                        authPlatform.PlatformShopId   = (bShop != null && bShop["baidu_shop_id"] != null) ? bShop["baidu_shop_id"].ToString() : string.Empty;
                        authPlatform.Mobile           = (bShop != null && bShop["service_phone"] != null) ? bShop["service_phone"].ToString() : string.Empty;
                        authPlatform.ShopAddress      = (bShop != null && bShop["address"] != null) ? bShop["address"].ToString() : string.Empty;
                        authPlatform.BusinessScope    = category;
                        authPlatform.Latitude         = (bShop != null && bShop["latitude"] != null) ? bShop["latitude"].ToString() : string.Empty;
                        authPlatform.Longitude        = (bShop != null && bShop["longitude"] != null) ? bShop["longitude"].ToString() : string.Empty;
                        authPlatform.PictureUrl       = (bShop != null && bShop["shop_logo"] != null) ? bShop["shop_logo"].ToString() : string.Empty;
                        authPlatform.OpenTime         = (bShop != null && bShop["business_time"] != null) ? bShop["business_time"].ToString() : string.Empty;
                        authPlatform.RefreshToken     = refreshToken;
                        authPlatform.Description      = remark;
                    }

                    authPlatform.EnabledFlag  = EnabledFlagType.Valid.GetHashCode();
                    authPlatform.DeleteFlag   = DeleteFlagType.Valid.GetHashCode();
                    authPlatform.CreateUserId = paltformType.GetRemark();
                    authPlatform.CreateDate   = dbNow;
                    db.Insert(authPlatform);
                }

                //同步门店数据
                var platformList = GetShopPlatformList(shopId.ToInt(), businessType);
                if (platformList != null && platformList.Count > 0)
                {
                    var isFirstAuth = platformList.Count(d => d.AuthStasus == 1) == 0;
                    if (isFirstAuth)
                    {
                        var shopEntity = SingleInstance <ShopBLL> .Instance.GetShopById(shopId.ToInt());

                        if (shopEntity != null)
                        {
                            shopEntity.ShopName      = authPlatform.PlatformShopName;
                            shopEntity.ShopAddress   = authPlatform.ShopAddress;
                            shopEntity.BusinessScope = authPlatform.BusinessScope;
                            shopEntity.ModifyUserId  = paltformType.GetRemark();
                            shopEntity.ModifyDate    = dbNow;
                            db.Update(shopEntity);
                        }
                    }
                }

                db.Commit();
                cnt = 1;
            }
            catch (Exception ex)
            {
                db.Rollback();
                var msg = string.Format("同步门店平台数据失败,参考消息:{0}", ex.Message);
                LogUtil.Error(msg);
                throw new BusinessException(msg);
            }
            return(cnt);
        }