public static string MemberAutoToDistributor(MemberInfo memberinfo) { Globals.Debuglog("开始自动生成分销商请求", "_DebuglogMemberAutoToDistributor.txt"); if (memberinfo == null) { return("用户不存在"); } if (GetDistributorInfo(memberinfo.UserId) != null) { return("用户已是分销商"); } SiteSettings masterSettings = SettingsManager.GetMasterSettings(true); string stroname = string.Empty; if (string.IsNullOrEmpty(memberinfo.OpenId)) { stroname = Globals.GetStoreNameByUserIDAndName(memberinfo.UserId, memberinfo.UserName, memberinfo.OpenId, masterSettings.SiteName); } else { stroname = Globals.GetStoreNameByUserIDAndName(0, memberinfo.UserName, memberinfo.OpenId, masterSettings.SiteName); if (IsExiteDistributorsByStoreName(stroname) > 0) { stroname = Globals.GetStoreNameByUserIDAndName(memberinfo.UserId, memberinfo.UserName, memberinfo.OpenId, masterSettings.SiteName); } } DistributorsInfo distributors = new DistributorsInfo { RequestAccount = "", StoreName = stroname, StoreDescription = masterSettings.ShopIntroduction, Logo = masterSettings.DistributorLogoPic, BackImage = "", CellPhone = memberinfo.CellPhone, ReferralUserId = memberinfo.ReferralUserId, UserId = memberinfo.UserId }; DistributorGradeInfo isDefaultDistributorGradeInfo = DistributorGradeBrower.GetIsDefaultDistributorGradeInfo(); if (isDefaultDistributorGradeInfo == null) { return("默认分销商等级未设置"); } distributors.DistriGradeId = isDefaultDistributorGradeInfo.GradeId; Globals.Debuglog("开始自动生成分销商请求2", "_DebuglogMemberAutoToDistributor.txt"); string str3 = AutoAddDistributors(distributors, memberinfo); if (str3 == "1") { Globals.Debuglog(string.Concat(new object[] { "自动生成分销商(", distributors.UserId, ")[", distributors.StoreName, "]" }), "_DebuglogMemberAutoToDistributor.txt"); return("1"); } Globals.Debuglog("自动生成分销商失败:" + str3, "_DebuglogMemberAutoToDistributor.txt"); return("0"); }