public ActionResult Management() { ActionResult action; try { SiteSettingsInfo siteSettings = Instance <ISiteSettingService> .Create.GetSiteSettings(); if (string.IsNullOrEmpty(siteSettings.WeixinAppId) || string.IsNullOrEmpty(siteSettings.WeixinAppSecret)) { action = RedirectToAction("UnConfig"); } else { action = View(); } } catch (Exception exception1) { Exception exception = exception1; Log.Info("微信红包进入出错:", (exception.InnerException == null ? exception : exception.InnerException)); throw exception; } return(action); }
// GET: Admin/SiteSetting public ActionResult Index() { SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); Mapper.CreateMap <SiteSettingsInfo, SiteSettingModel>().ForMember((SiteSettingModel a) => (dynamic)a.SiteIsOpen, (IMemberConfigurationExpression <SiteSettingsInfo> b) => b.MapFrom <bool>((SiteSettingsInfo s) => s.SiteIsClose)); return(base.View(Mapper.Map <SiteSettingsInfo, SiteSettingModel>(siteSettings))); }
public ActionResult SetPageFoot() { SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); ViewBag.PageFoot = siteSettings.PageFoot; return(View()); }
public SiteSettingsInfo GetSiteSettings() { SiteSettingsInfo siteSettingsInfo = null; if (Core.Cache.Exists(CacheKeyCollection.SiteSettings))//如果存在缓存,则从缓存中读取 { siteSettingsInfo = Core.Cache.Get <SiteSettingsInfo>(CacheKeyCollection.SiteSettings); } if (siteSettingsInfo == null) { //否则从数据库中读取,并将配置存入至缓存 //通过反射获取值 var values = Context.SiteSettingsInfo.FindAll().ToArray(); siteSettingsInfo = new SiteSettingsInfo(); var properties = siteSettingsInfo.GetType().GetProperties(); foreach (var property in properties) { if (property.Name != "Id") { var temp = values.FirstOrDefault(item => item.Key == property.Name); if (temp != null) { property.SetValue(siteSettingsInfo, Convert.ChangeType(temp.Value, property.PropertyType)); } } } Core.Cache.Insert(CacheKeyCollection.SiteSettings, siteSettingsInfo); } return(siteSettingsInfo); }
public SiteSettingsInfo GetSiteSettings() { SiteSettingsInfo siteSettingsInfo; if (Cache.Get("Cache-SiteSettings") == null) { IEnumerable <SiteSettingsInfo> array = context.SiteSettingsInfo.FindAll <SiteSettingsInfo>().ToArray(); siteSettingsInfo = new SiteSettingsInfo(); PropertyInfo[] properties = siteSettingsInfo.GetType().GetProperties(); for (int i = 0; i < properties.Length; i++) { PropertyInfo propertyInfo = properties[i]; if (propertyInfo.Name != "Id") { SiteSettingsInfo siteSettingsInfo1 = array.FirstOrDefault((SiteSettingsInfo item) => item.Key == propertyInfo.Name); if (siteSettingsInfo1 != null) { propertyInfo.SetValue(siteSettingsInfo, Convert.ChangeType(siteSettingsInfo1.Value, propertyInfo.PropertyType)); } } } Cache.Insert("Cache-SiteSettings", siteSettingsInfo); } else { siteSettingsInfo = (SiteSettingsInfo)Cache.Get("Cache-SiteSettings"); } return(siteSettingsInfo); }
private UserInfoJson GetWXUserHead(string openid) { SiteSettingsInfo siteSettings = Instance <ISiteSettingService> .Create.GetSiteSettings(); if (string.IsNullOrEmpty(siteSettings.WeixinAppId) && string.IsNullOrEmpty(siteSettings.WeixinAppSecret)) { throw new Exception("未配置公众号"); } //string str = AccessTokenContainer.TryGetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, false); string str = CommonApi.GetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret).access_token; // //UserInfoJson userInfoJson = UserApi.Info(str, openid, Language.zh_CN); var userInfoJson = CommonApi.GetUserInfo(str, openid); if (userInfoJson.errcode != ReturnCode.请求成功) { throw new HimallException(userInfoJson.errmsg); } UserInfoJson json = new UserInfoJson(); json.FillEntityWithXml(userInfoJson.ConvertEntityToXml <Senparc.Weixin.MP.Entities.WeixinUserInfoResult>()); return(json); }
public ActionResult Index() { if (base.Request.Url.AbsolutePath.EndsWith("/Capital/Index", StringComparison.OrdinalIgnoreCase) || base.Request.Url.AbsolutePath.EndsWith("/Capital", StringComparison.OrdinalIgnoreCase)) { return(this.Redirect(base.Url.RouteUrl("PayRoute") + "?area=mobile&platform=" + base.PlatformType.ToString() + "&controller=Capital&action=Index")); } CapitalInfo capitalInfo = this._iMemberCapitalService.GetCapitalInfo(base.CurrentUser.Id); decimal num = 0M; if (capitalInfo != null) { num = (from e in capitalInfo.Himall_CapitalDetail where e.SourceType == CapitalDetailInfo.CapitalDetailType.RedPacket select e).Sum <CapitalDetailInfo>((Func <CapitalDetailInfo, decimal>)(e => e.Amount)); ((dynamic)base.ViewBag).CapitalDetails = (from e in capitalInfo.Himall_CapitalDetail orderby e.CreateTime descending select e).Take <CapitalDetailInfo>(15); } ((dynamic)base.ViewBag).RedPacketAmount = num; ((dynamic)base.ViewBag).IsSetPwd = !string.IsNullOrWhiteSpace(base.CurrentUser.PayPwd); SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); ((dynamic)base.ViewBag).WithDrawMinimum = siteSettings.WithDrawMinimum; ((dynamic)base.ViewBag).WithDrawMaximum = siteSettings.WithDrawMaximum; return(base.View(capitalInfo)); }
/// <summary> /// 检查版本号 /// </summary> /// <param name="context"></param> public object GetInitVeCode(string vid) { string status = "NO"; var errorMsg = ""; if (string.IsNullOrEmpty(vid)) { errorMsg = "版本号不允许为空"; } SiteSettingsInfo sitesetting = SiteSettingApplication.GetSiteSettings(); long xcxvid = sitesetting.XcxHomeVersionCode; if (xcxvid > long.Parse(vid)) { errorMsg = "版本需要更新"; } else { status = "OK"; errorMsg = "版本不需要更新"; } var json = new { Status = status, Message = errorMsg }; return(json); }
public ActionResult InviteRegist(long id = 0L, string openId = "", string serviceProvider = "") { ViewBag.Introducer = id; UserMemberInfo memberByOpenId = ServiceHelper.Create <IMemberService>().GetMemberByOpenId(serviceProvider, openId); SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); InviteRuleInfo inviteRule = ServiceHelper.Create <IMemberInviteService>().GetInviteRule(); MemberIntegralExchangeRules integralChangeRule = ServiceHelper.Create <IMemberIntegralService>().GetIntegralChangeRule(); int num = (integralChangeRule == null ? 0 : integralChangeRule.IntegralPerMoney); ViewBag.WXLogo = siteSettings.WXLogo; if (!inviteRule.InviteIntegral.HasValue || num <= 0) { ViewBag.Money = "0.0"; } else { dynamic viewBag = base.ViewBag; int value = inviteRule.InviteIntegral.Value / num; viewBag.Money = value.ToString("f1"); } ViewBag.IsRegist = 0; if (memberByOpenId != null) { ViewBag.IsRegist = 1; } return(View(inviteRule)); }
/// <summary> /// 基本设置 /// </summary> /// <returns></returns> public ActionResult BasicSettings() { SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); if (string.IsNullOrEmpty(siteSettings.WeixinToken)) { siteSettings.WeixinToken = this.CreateKey(8); this._iSiteSettingService.SetSiteSettings(siteSettings); } SiteSettingModel model = new SiteSettingModel { WeixinAppId = string.IsNullOrEmpty(siteSettings.WeixinAppId) ? string.Empty : siteSettings.WeixinAppId.Trim(), WeixinAppSecret = string.IsNullOrEmpty(siteSettings.WeixinAppSecret) ? string.Empty : siteSettings.WeixinAppSecret.Trim(), WeixinToKen = siteSettings.WeixinToken.Trim() }; ((dynamic)base.ViewBag).Url = string.Format("{0}/m-Weixin/WXApi", CurrentUrlHelper.CurrentUrlNoPort()); if (DemoAuthorityHelper.IsDemo()) { model.WeixinAppId = "*".PadRight(model.WeixinAppId.Length, '*'); model.WeixinAppSecret = "*".PadRight(model.WeixinAppSecret.Length, '*'); ((dynamic)base.ViewBag).isDemo = true; } return(base.View(model)); }
public ActionResult ApplyWithDraw() { SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); //if (string.IsNullOrWhiteSpace(siteSettings.WeixinAppId) || string.IsNullOrWhiteSpace(siteSettings.WeixinAppSecret)) //{ // throw new HimallException("未配置公众号参数"); //} ////string str = "";//AccessTokenContainer.TryGetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, false); //SceneModel sceneModel = new SceneModel(QR_SCENE_Type.WithDraw) //{ // Object = base.CurrentSellerManager.Id.ToString() //}; int num = 0;//(new SceneHelper()).SetModel(sceneModel, 600); //CreateQrCodeResult createQrCodeResult = QrCodeApi.Create(str, 300, num, 10000); ViewBag.ticket = "";//createQrCodeResult.ticket; ViewBag.Sceneid = num; IMemberCapitalService memberCapitalService = ServiceHelper.Create <IMemberCapitalService>(); CapitalInfo capitalInfo = memberCapitalService.GetCapitalInfoByManagerId(base.CurrentSellerManager.Id); if (capitalInfo == null) { ViewBag.ApplyWithMoney = 0; } else { dynamic viewBag = base.ViewBag; decimal?balance = capitalInfo.Balance; viewBag.ApplyWithMoney = balance.Value; } base.ViewBag.IsSetPwd = (string.IsNullOrWhiteSpace(base.CurrentSellerManager.Password) ? false : true); return(View()); }
public ActionResult Index() { SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); ViewBag.Logo = siteSettings.Logo; ViewBag.Keyword = siteSettings.Keyword; ViewBag.Hotkeywords = siteSettings.Hotkeywords; dynamic viewBag = base.ViewBag; IEnumerable <ImageAdInfo> imageAds = ServiceHelper.Create <ISlideAdsService>().GetImageAds(0); viewBag.ImageAdsTop = imageAds.Where((ImageAdInfo p) => { if (p.Id == 14) { return(true); } return(p.Id == 15); }).ToList(); ImageAdInfo[] array = ServiceHelper.Create <ISlideAdsService>().GetImageAds(0).Where((ImageAdInfo p) => { if (p.Id <= 0) { return(false); } return(p.Id <= 8); }).ToArray(); return(View(array)); }
public ActionResult Edit() { SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); Mapper.CreateMap <SiteSettingsInfo, SiteSettingModel>().ForMember((SiteSettingModel a) => a.SiteIsOpen, (IMemberConfigurationExpression <SiteSettingsInfo> b) => b.MapFrom <bool>((SiteSettingsInfo s) => s.SiteIsClose)); return(View(Mapper.Map <SiteSettingsInfo, SiteSettingModel>(siteSettings))); }
public void SaveSetting(string key, object value) { if (value == null) { throw new ArgumentNullException("值不能为null"); } //检查Key是否存在 PropertyInfo[] properties = typeof(SiteSettingsInfo).GetProperties(); if (properties.FirstOrDefault(item => item.Name == key) == null) { throw new ApplicationException("未找到" + key + "对应的配置项"); } var siteSetting = Context.SiteSettingsInfo.FindBy(item => item.Key == key).FirstOrDefault(); if (siteSetting == null) { siteSetting = new SiteSettingsInfo(); Context.SiteSettingsInfo.Add(siteSetting); } siteSetting.Key = key; siteSetting.Value = value.ToString(); Context.SaveChanges(); Core.Cache.Remove(CacheKeyCollection.SiteSettings); }
public void AutoConfirmOrder() { int num; try { SiteSettingsInfo siteSettings = Instance <ISiteSettingService> .Create.GetSiteSettings(); if (siteSettings == null) { num = 7; } else { num = (siteSettings.NoReceivingTimeout == 0 ? 7 : siteSettings.NoReceivingTimeout); } DateTime dateTime = DateTime.Now.AddDays(-num); List <GiftOrderInfo> list = ( from a in context.GiftOrderInfo where (a.ShippingDate < dateTime) && (int)a.OrderStatus == 3 select a).ToList(); foreach (GiftOrderInfo nullable in list) { nullable.OrderStatus = GiftOrderInfo.GiftOrderStatus.Finish; nullable.CloseReason = "完成过期未确认收货的礼品订单"; nullable.FinishDate = new DateTime?(DateTime.Now); } context.SaveChanges(); } catch (Exception exception1) { Exception exception = exception1; Log.Error(string.Concat("AutoConfirmGiftOrder:", exception.Message, "/r/n", exception.StackTrace)); } }
public JsonResult ApplyWithDrawSubmit(string openid, string nickname, decimal amount, string pwd, int applyType = 1) { if (!MemberApplication.VerificationPayPwd(base.CurrentUser.Id, pwd)) { throw new HimallException("支付密码不对,请重新输入!"); } if (!((applyType != UserWithdrawType.ALiPay.GetHashCode()) || base.CurrentSiteSetting.Withdraw_AlipayEnable)) { throw new HimallException("不支持支付宝提现方式!"); } CapitalInfo capitalInfo = this._iMemberCapitalService.GetCapitalInfo(base.CurrentUser.Id); if (amount > capitalInfo.Balance) { throw new HimallException("提现金额不能超出可用金额!"); } if (amount <= 0M) { throw new HimallException("提现金额不能小于等于0!"); } if (string.IsNullOrWhiteSpace(openid) && (applyType == UserWithdrawType.WeiChat.GetHashCode())) { openid = WebHelper.GetCookie("Himall-User_OpenId"); } if (string.IsNullOrWhiteSpace(nickname) && (applyType == UserWithdrawType.ALiPay.GetHashCode())) { throw new HimallException("数据异常,真实姓名不可为空!"); } if (!string.IsNullOrWhiteSpace(openid) && (applyType == UserWithdrawType.WeiChat.GetHashCode())) { openid = SecureHelper.AESDecrypt(openid, "Mobile"); SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); if (!string.IsNullOrWhiteSpace(siteSettings.WeixinAppId) && !string.IsNullOrWhiteSpace(siteSettings.WeixinAppSecret)) { WeixinUserInfoResult userInfo = CommonApi.GetUserInfo(AccessTokenContainer.TryGetToken(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, false), openid); if (userInfo != null) { nickname = userInfo.nickname; } } } if (string.IsNullOrWhiteSpace(openid)) { throw new HimallException("数据异常,OpenId或收款账号不可为空!"); } ApplyWithDrawInfo model = new ApplyWithDrawInfo { ApplyAmount = amount, ApplyStatus = ApplyWithDrawInfo.ApplyWithDrawStatus.WaitConfirm, ApplyTime = DateTime.Now, MemId = base.CurrentUser.Id, OpenId = openid, NickName = nickname, ApplyType = new UserWithdrawType?((UserWithdrawType)applyType) }; this._iMemberCapitalService.AddWithDrawApply(model); return(base.Json(new { success = true })); }
public void UpdateSiteSettings(SiteSettingsInfo siteSettingsInfo) { SiteSettingsInfo site = GetSiteSettings(siteSettingsInfo.Key); site.Value = siteSettingsInfo.Value; context.SaveChanges(); Cache.Remove("Cache-SiteSettings"); }
public BonusService() { SiteSettingsInfo siteSettings = Instance <ISiteSettingService> .Create.GetSiteSettings(); if (!string.IsNullOrEmpty(siteSettings.WeixinAppId) || !string.IsNullOrEmpty(siteSettings.WeixinAppSecret)) { init(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret); } }
public BonusController() { _siteSetting = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); if (string.IsNullOrWhiteSpace(_siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(_siteSetting.WeixinAppSecret)) { throw new HimallException("未配置公众号参数"); } _bonusService = ServiceHelper.Create <IBonusService>(); }
public UserInviteController(ISiteSettingService iSiteSettingService, IMemberInviteService iMemberInviteService, IMemberIntegralService iMemberIntegralService ) { _iMemberInviteService = iMemberInviteService; _iMemberIntegralService = iMemberIntegralService; _iSiteSettingService = iSiteSettingService; this._siteSetting = _iSiteSettingService.GetSiteSettings(); }
public BonusController(IBonusService iBonusService, ISiteSettingService iSiteSettingService) { _iBonusService = iBonusService; _iSiteSettingService = iSiteSettingService; this._siteSetting = _iSiteSettingService.GetSiteSettings(); if (string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppId) || string.IsNullOrWhiteSpace(this._siteSetting.WeixinAppSecret)) { throw new HimallException("未配置公众号参数"); } }
public DistributionShopController(IDistributionService iDistributionService, IMemberService iMemberService, IMessageService iMessageService , IRegionService iRegionService, ISiteSettingService iSiteSettingService, IShopService iShopService) { _iDistributionService = iDistributionService; _iMemberService = iMemberService; _iMessageService = iMessageService; _iRegionService = iRegionService; _iSiteSettingService = iSiteSettingService; this._siteSetting = _iSiteSettingService.GetSiteSettings(); _iShopService = iShopService; }
public JsonResult UpdateSetting(string typeid) { typeid = typeid.Substring(5); SiteSettingsInfo sitesettinginfo = ServiceHelper.Create<ISiteSettingService>().GetSiteSettings("RecommandIndexImg"); sitesettinginfo.Value = typeid; ServiceHelper.Create<ISiteSettingService>().UpdateSiteSettings(sitesettinginfo); Result result = new Result(); result.success = true; result.msg = "OK"; return Json(result); }
public JsonResult SaveWeiXinSettings(string weixinAppId, string WeixinAppSecret) { Result result = new Result(); SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); siteSettings.WeixinAppId = weixinAppId.Trim(); siteSettings.WeixinAppSecret = WeixinAppSecret.Trim(); ServiceHelper.Create <ISiteSettingService>().SetSiteSettings(siteSettings); result.success = true; return(Json(result)); }
/// <summary> /// 文件列表 /// </summary> /// <param name="pageIdx"></param> /// <param name="pageSize"></param> /// <returns></returns> public JsonResult GetWXMaterialList(int pageIdx, int pageSize) { SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); if (string.IsNullOrWhiteSpace(siteSettings.WeixinAppId)) { throw new HimallException("未配置微信公众号"); } int offset = (pageIdx - 1) * pageSize; return(this.Json((object)this._iWXMsgTemplateService.GetMediaMsgTemplateList(siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, offset, pageSize))); }
public JsonResult Edit(SiteSettingModel siteSettingModel) { Result result = new Result(); SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); siteSettings.NoReceivingTimeout = siteSettingModel.NoReceivingTimeout; siteSettings.UnpaidTimeout = siteSettingModel.UnpaidTimeout; siteSettings.SalesReturnTimeout = siteSettingModel.SalesReturnTimeout; ServiceHelper.Create <ISiteSettingService>().SetSiteSettings(siteSettings); result.success = true; return(Json(result)); }
/// <summary> /// 下单页面 /// </summary> /// <param name="Id"></param> /// <returns></returns> public ActionResult SubmitOrder(string Id) { if (!string.IsNullOrEmpty(Id)) { var model = ServiceHelper.Create <IProductService>().GetProduct(long.Parse(Id)); model.ShopName = ServiceHelper.Create <IShopService>().GetShopName(model.ShopId); ViewBag.model = model; } ChemCloud.Service.Order.Business.OrderBO _orderBO = new ChemCloud.Service.Order.Business.OrderBO(); long orderid = _orderBO.GenerateOrderNumber(); ViewBag.billno = orderid; int CoinType = int.Parse(ConfigurationManager.AppSettings["CoinType"] == null ? "1" : ConfigurationManager.AppSettings["CoinType"]); List <ProductSpec> listspec = ServiceHelper.Create <IProductService>().GetProductSpec(long.Parse(Id))._ProductSpec.ToList(); listspec = listspec.Where(q => q.CoinType == CoinType).ToList(); ViewBag.ProductSpec = listspec; ViewBag.ProConType = ConfigurationManager.AppSettings["CoinType"]; string InsurancefeeMaxValue = "1"; SiteSettingsInfo siteSettings = ServiceHelper.Create <ISiteSettingService>().GetSiteSettings(); if (siteSettings != null) { if (!string.IsNullOrWhiteSpace(siteSettings.InsurancefeeMaxValue)) { InsurancefeeMaxValue = siteSettings.InsurancefeeMaxValue; } } ViewBag.InsurancefeeMaxValue = InsurancefeeMaxValue; IOrderService orderService = ServiceHelper.Create <IOrderService>(); ViewBag.InvoiceTitle = orderService.GetInvoiceTitles(base.CurrentUser.Id); //发票单位 ViewBag.InvoiceContext = orderService.GetInvoiceContexts(); //发票内容 ViewBag.orderAddressInfo = ServiceHelper.Create <IorderAddressService>().GetUserorderAddressByUserId(base.CurrentUser.Id); /*判断是否已经添加了购物地址*/ string iseditshippingaddress = "0"; List <ShippingAddressInfo> item = ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddressByUserId(base.CurrentUser.Id).ToList(); if (item.Count > 0) { iseditshippingaddress = "1"; } ViewBag.iseditshippingaddress = iseditshippingaddress; return(View(ServiceHelper.Create <IShippingAddressService>().GetUserShippingAddressByUserId(base.CurrentUser.Id))); }
public JsonResult SetKeyWords(string keyword, string hotkeywords) { ISiteSettingService siteSettingService = ServiceHelper.Create <ISiteSettingService>(); SiteSettingsInfo siteSettings = siteSettingService.GetSiteSettings(); siteSettings.Hotkeywords = hotkeywords; siteSettings.Keyword = keyword; siteSettingService.SetSiteSettings(siteSettings); return(Json(new Result() { success = true })); }
/// <summary> /// 文件 /// </summary> /// <param name="mediaid"></param> /// <returns></returns> public ActionResult GetMedia(string mediaid) { SiteSettingsInfo siteSettings = this._iSiteSettingService.GetSiteSettings(); if (string.IsNullOrWhiteSpace(siteSettings.WeixinAppId)) { throw new HimallException("未配置微信公众号"); } MemoryStream memoryStream = new MemoryStream(); this._iWXMsgTemplateService.GetMedia(mediaid, siteSettings.WeixinAppId, siteSettings.WeixinAppSecret, (Stream)memoryStream); return((ActionResult)this.File(memoryStream.ToArray(), "Image/png")); }
public void SetSiteSettingsTest() { var service = Instance <ISiteSettingService> .Create; SiteSettingsInfo setting = new SiteSettingsInfo() { CustomerTel = "A123456", SiteName = "A这是站点名", ICPNubmer = "A123456789", SiteIsClose = true }; service.SetSiteSettings(setting); }