/// <summary>
        /// 提交申请销售员
        /// </summary>
        /// <returns></returns>
        public JsonResult <Result <bool> > PostApplyDistributor(PostSaveShopConfigModel model)
        {
            CheckUserLogin();
            var             sitesettings       = SiteSettingApplication.SiteSettings;
            DistributorInfo currentDistributor = DistributionApplication.GetDistributor(CurrentUser.Id);

            if (sitesettings.DistributorApplyNeedQuota > 0)
            {
                var _u = MemberApplication.GetMember(CurrentUser.Id);
                if (_u.NetAmount < sitesettings.DistributorApplyNeedQuota)
                {
                    return(Json(ErrorResult <bool>("需要累计消费金额达到" + sitesettings.DistributorApplyNeedQuota + "元才可申请哦!")));
                }
            }
            if (currentDistributor == null)
            {
                currentDistributor = new DistributorInfo
                {
                    MemberId = CurrentUser.Id
                };
            }
            if (string.IsNullOrWhiteSpace(currentDistributor.ShopLogo))
            {
                currentDistributor.ShopLogo = CurrentUser.Photo;
            }
            if (string.IsNullOrWhiteSpace(model.logoUrl))
            {
                if (currentDistributor == null || string.IsNullOrWhiteSpace(currentDistributor.ShopLogo))
                {
                    return(Json(ErrorResult <bool>("请上传小店logo!")));
                }
            }
            if (string.IsNullOrWhiteSpace(model.shopName))
            {
                return(Json(ErrorResult <bool>("请填写小店名称!")));
            }
            if (model.shopName.Length > 10)
            {
                return(Json(ErrorResult <bool>("小店名称不能超过10个字符!")));
            }
            if (currentDistributor != null)
            {
                if (currentDistributor.DistributionStatus == (int)DistributorStatus.NotAvailable)
                {
                    return(Json(ErrorResult <bool>("您己经被清退,不可以申请!")));
                }
                if (currentDistributor.DistributionStatus == (int)DistributorStatus.Audited)
                {
                    return(Json(ErrorResult <bool>("您己经是销售员,不可以重复申请!")));
                }
                if (currentDistributor.DistributionStatus == (int)DistributorStatus.UnAudit)
                {
                    return(Json(ErrorResult <bool>("您己经提交销售员申请,请耐心等待!")));
                }
            }

            string shoplogo = currentDistributor != null ? currentDistributor.ShopLogo : "";

            if (!string.IsNullOrWhiteSpace(model.logoUrl))
            {
                //shoplogo = DownloadWxImage(model.logoWXmediaId);
                shoplogo = model.logoUrl;
            }
            if (string.IsNullOrWhiteSpace(shoplogo))
            {
                return(Json(ErrorResult <bool>("请上传小店logo!")));
            }
            var    oldname  = Path.GetFileName(shoplogo);
            string ImageDir = string.Empty;

            if (!string.IsNullOrWhiteSpace(shoplogo))
            {
                //转移图片
                string relativeDir = DISTRIBUTOR_LOGO_PATH;
                Random ra          = new Random();
                string fileName    = DateTime.Now.ToString("yyyyMMddHHmmssffffff") + ra.Next(4) + ".jpg";
                if (shoplogo.Replace("\\", "/").Contains("/temp/"))//只有在临时目录中的图片才需要复制
                {
                    var de = shoplogo.Substring(shoplogo.LastIndexOf("/temp/"));
                    Core.HimallIO.CopyFile(de, relativeDir + fileName, true);
                    shoplogo = relativeDir + fileName;
                }  //目标地址
                else if (shoplogo.Contains("/Storage"))
                {
                    shoplogo = shoplogo.Substring(shoplogo.LastIndexOf("/Storage"));
                }
            }
            var d = DistributionApplication.ApplyDistributor(CurrentUser.Id, shoplogo, model.shopName);

            if (d == null)
            {
                return(Json(ErrorResult <bool>("申请失败,系统异常!")));
            }
            if (d.DistributionStatus == (int)DistributorStatus.Audited)
            {
                return(JsonResult(true, "申请销售员成功!"));
            }
            return(JsonResult(true, "提交销售员申请成功!"));
        }
        /// <summary>
        /// 提交申请销售员
        /// </summary>
        /// <returns></returns>
        public JsonResult PostApplyDistributor(string logoWXmediaId, string shopname)
        {
            if (SiteSettings.DistributorApplyNeedQuota > 0)
            {
                var _u = MemberApplication.GetMember(CurrentUser.Id);
                if (_u.NetAmount < SiteSettings.DistributorApplyNeedQuota)
                {
                    throw new MallException("需要累计消费金额达到" + SiteSettings.DistributorApplyNeedQuota + "元才可申请哦");
                }
            }
            if (CurrentDistributor == null)
            {
                CurrentDistributor = new DistributorInfo
                {
                    MemberId = CurrentUser.Id
                };
            }
            if (string.IsNullOrWhiteSpace(CurrentDistributor.ShopLogo))
            {
                CurrentDistributor.ShopLogo = CurrentUser.Photo;
            }
            if (string.IsNullOrWhiteSpace(logoWXmediaId))
            {
                if (CurrentDistributor == null || string.IsNullOrWhiteSpace(CurrentDistributor.ShopLogo))
                {
                    throw new MallException("请上传小店logo");
                }
            }
            if (string.IsNullOrWhiteSpace(shopname))
            {
                throw new MallException("请填写小店名称");
            }
            if (shopname.Length > 10)
            {
                throw new MallException("小店名称不能超过10个字符");
            }
            if (CurrentDistributor != null)
            {
                if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.NotAvailable)
                {
                    return(Json(new Result {
                        success = true, msg = "您己经被清退,不可以申请!", code = 12
                    }));
                }
                if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.Audited)
                {
                    return(Json(new Result {
                        success = true, msg = "您己经是销售员,不可以重复申请!", code = 11
                    }));
                }
                if (CurrentDistributor.DistributionStatus == (int)DistributorStatus.UnAudit)
                {
                    return(Json(new Result {
                        success = true, msg = "您己经提交销售员申请,请耐心等待!", code = 13
                    }));
                }
            }

            string shoplogo = CurrentDistributor != null ? CurrentDistributor.ShopLogo : "";

            if (!string.IsNullOrWhiteSpace(logoWXmediaId))
            {
                shoplogo = DownloadWxImage(logoWXmediaId);
            }
            if (string.IsNullOrWhiteSpace(shoplogo))
            {
                throw new MallException("请上传小店logo");
            }
            var    oldname  = Path.GetFileName(shoplogo);
            string ImageDir = string.Empty;

            if (!string.IsNullOrWhiteSpace(shoplogo))
            {
                //转移图片
                string relativeDir = DISTRIBUTOR_LOGO_PATH;
                Random ra          = new Random();
                string fileName    = DateTime.Now.ToString("yyyyMMddHHmmssffffff") + ra.Next(4) + ".jpg";
                if (shoplogo.Replace("\\", "/").Contains("/temp/"))//只有在临时目录中的图片才需要复制
                {
                    var de = shoplogo.Substring(shoplogo.LastIndexOf("/temp/"));
                    Core.MallIO.CopyFile(de, relativeDir + fileName, true);
                    shoplogo = relativeDir + fileName;
                }  //目标地址
                else if (shoplogo.Contains("/Storage"))
                {
                    shoplogo = shoplogo.Substring(shoplogo.LastIndexOf("/Storage"));
                }
            }

            var d = DistributionApplication.ApplyDistributor(CurrentUser.Id, shoplogo, shopname);

            if (d == null)
            {
                return(Json(new Result {
                    success = false, msg = "申请失败,系统异常!", code = 41
                }));
            }
            if (d.DistributionStatus == (int)DistributorStatus.Audited)
            {
                return(Json(new Result {
                    success = true, msg = "申请销售员成功!"
                }));
            }
            return(Json(new Result {
                success = true, msg = "提交销售员申请成功!", code = 21
            }));
        }