Exemplo n.º 1
0
 protected void Save_Btn_Click(object sender, EventArgs e)
 {
     PlatConfig.WXPay_APPID     = APPID_T.Text.Trim();
     PlatConfig.WXPay_APPSecret = APPSecret_T.Text.Trim();
     PlatConfig.WXPay_MCHID     = MCHID_T.Text.Trim();
     PlatConfig.WXPay_Key       = Key_T.Text.Trim();
     PlatConfig.Update();
     function.WriteSuccessMsg("配置更新成功");
 }
Exemplo n.º 2
0
 protected void Blog_Save_Btn_Click(object sender, EventArgs e)
 {
     //PlatConfig.SinaKey = Sina_Blog_Key_T.Text;
     //PlatConfig.SinaSecret = Sina_Blog_Secret_T.Text;
     //PlatConfig.SinaCallBack = Sina_Blog_CallBack_T.Text;
     PlatConfig.QQKey      = QQ_Blog_Key_T.Text;
     PlatConfig.QQCallBack = QQ_Blog_CallBack_T.Text;
     PlatConfig.Update();
     function.WriteErrMsg("博客信息配置完成");
 }
Exemplo n.º 3
0
        protected void Login_Save_Btn_Click(object sender, EventArgs e)
        {
            XmlNode     XApp = null;
            XmlDocument Xml  = thirdBll.GetXmlDoc();

            //----------------------------------------------------

            XApp = Xml.SelectSingleNode("SuppliersList/Baidu");
            XApp.Attributes["Key"].Value         = ABaidu.Value;
            XApp.Attributes["Secret"].Value      = SBaidu.Value;
            XApp.Attributes["CallBackUrl"].Value = UBaidu.Value;
            XApp.Attributes["Enable"].Value      = Baidu_Enable_Chk.Checked ? "1" : "0";

            XApp = Xml.SelectSingleNode("SuppliersList/BaiduTrans");
            XApp.Attributes["Key"].Value   = Baidu_Translate_Key_T.Text;
            XApp.Attributes["AppID"].Value = Baidu_Translate_Secret_T.Text;

            //XApp = Xml.SelectSingleNode("SuppliersList/Kaixin");
            //XApp.Attributes["Key"].Value = AKaixin.Value;
            //XApp.Attributes["Secret"].Value = SKaixin.Value;
            //XApp.Attributes["CallBackUrl"].Value = SKaixiuUrl.Value;

            XApp = Xml.SelectSingleNode("SuppliersList/QQ");
            XApp.Attributes["ID"].Value          = QQ_Login_APPID_T.Value;
            XApp.Attributes["Key"].Value         = QQ_Login_APPID_T.Value;
            XApp.Attributes["Secret"].Value      = QQ_Login_Key_T.Value;
            XApp.Attributes["CallBackUrl"].Value = QQ_Login_CallBack_T.Value;
            XApp.Attributes["Enable"].Value      = QQ_Enable_Chk.Checked ? "1" : "0";

            XApp = Xml.SelectSingleNode("SuppliersList/Sina");
            XApp.Attributes["Key"].Value         = "";
            XApp.Attributes["Secret"].Value      = "";
            XApp.Attributes["CallBackUrl"].Value = "";
            PlatConfig.SinaKey              = ASina.Value;
            PlatConfig.SinaSecret           = SSina.Value;
            PlatConfig.SinaCallBack         = SSinaURL.Value;
            XApp.Attributes["Enable"].Value = Sina_Enable_Chk.Checked ? "1" : "0";

            XApp = Xml.SelectSingleNode("SuppliersList/wechat");
            XApp.Attributes["ID"].Value          = WeChat_APPID_T.Text;
            XApp.Attributes["Key"].Value         = WeChat_APPID_T.Text;
            XApp.Attributes["Secret"].Value      = WeChat_Secret_T.Text;
            XApp.Attributes["CallBackUrl"].Value = WeChat_URL_T.Text;
            XApp.Attributes["Enable"].Value      = Wechat_Enable_Chk.Checked ? "1" : "0";
            PlatConfig.Update();
            Xml.Save(thirdBll.xmlPath);
            function.WriteSuccessMsg("保存成功");
        }
Exemplo n.º 4
0
        public ActionResult Setting(int aid = 0)
        {
            if (aid <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }

            int pageType = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(aid);

            if (pageType <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "小程序模板不存在!", code = "500"
                }));
            }

            ViewBag.PageType = pageType;
            ViewBag.appId    = aid;
            PlatConfig platRemark = PlatConfigBLL.SingleModel.GetPlatConfig(aid, 3);//获取平台公告

            if (platRemark == null)
            {
                platRemark = new PlatConfig()
                {
                    Aid = aid, AddTime = DateTime.Now, ADImg = string.Empty, ConfigType = 3
                };
            }
            ViewBag.PlatRemark = platRemark;

            return(View(new PlatConfig()
            {
                Aid = aid, AddTime = DateTime.Now, ADImg = ""
            }));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取首页轮播图以及推荐商家
        /// </summary>
        /// <returns></returns>
        public ActionResult GetConfig()
        {
            returnObj      = new Return_Msg_APP();
            returnObj.code = "200";
            string appId = Context.GetRequest("appId", string.Empty);

            if (string.IsNullOrEmpty(appId))
            {
                returnObj.Msg = "参数错误";
                return(Json(returnObj));
            }

            int pageIndexAdImg   = Context.GetRequestInt("pageIndexAdImg", 1);
            int pageSizeAdImg    = Context.GetRequestInt("pageSizeAdImg", 10);
            int pageIndexTjStore = Context.GetRequestInt("pageIndexTjStore", 1);
            int pageSizeTjStore  = Context.GetRequestInt("pageSizeTjStore", 20);

            XcxAppAccountRelation r = _xcxAppAccountRelationBLL.GetModelByAppid(appId);

            if (r == null)
            {
                returnObj.Msg = "小程序未授权";
                return(Json(returnObj, JsonRequestBehavior.AllowGet));
            }

            string appname = "";
            OpenAuthorizerConfig openonfigmodel = OpenAuthorizerConfigBLL.SingleModel.GetModelByAppids(r.AppId);

            if (openonfigmodel != null)
            {
                appname = openonfigmodel.nick_name;
            }
            else
            {
                UserXcxTemplate userXcxModel = UserXcxTemplateBLL.SingleModel.GetModelByAppId(r.AppId);
                appname = userXcxModel?.Name;
            }
            int adImgCount, tjStoreCount = 0;
            List <PlatConfig> listADImg   = PlatConfigBLL.SingleModel.getListByaid(r.Id, out adImgCount, 0, pageSizeAdImg, pageIndexAdImg);
            List <PlatConfig> listTjStore = PlatConfigBLL.SingleModel.getListByaid(r.Id, out tjStoreCount, 1, pageSizeTjStore, pageIndexTjStore);

            string lngStr      = Context.GetRequest("lng", string.Empty);
            string latStr      = Context.GetRequest("lat", string.Empty);
            double lng         = 0.00;
            double lat         = 0.00;
            string curLocation = "未知城市";
            int    curCityCode = 0;

            if (!double.TryParse(lngStr, out lng) || !double.TryParse(latStr, out lat))
            {
                string IP = WebHelper.GetIP();

                IPToPoint iPToPoint = CommondHelper.GetLoctionByIP(IP);
                if (iPToPoint != null)
                {
                    lat    = iPToPoint.result.location.lat;
                    lng    = iPToPoint.result.location.lng;
                    lngStr = lng.ToString();
                    latStr = lat.ToString();
                    //log4net.LogHelper.WriteInfo(this.GetType(), $"IP={IP};{lat},{lng}");
                }
            }
            AddressApi addressinfo = AddressHelper.GetAddressByApi(lngStr, latStr);

            // log4net.LogHelper.WriteInfo(this.GetType(), Newtonsoft.Json.JsonConvert.SerializeObject(addressinfo));
            if (addressinfo != null && addressinfo.result != null && addressinfo.result.address_component != null)
            {
                curLocation = addressinfo.result.address_component.city;
                curCityCode = C_AreaBLL.SingleModel.GetCodeByName(curLocation);
            }


            listTjStore.ForEach(x =>
            {
                x.ObjName = x.ObjName.Length > 6 ? (x.ObjName.Substring(0, 5) + "...") : x.ObjName;
            });

            PlatConfig platConfigRemark = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 3);
            var        remarkObj        = new { haveRemark = false, remark = string.Empty, remarkOpenFrm = false };

            if (platConfigRemark != null && !string.IsNullOrEmpty(platConfigRemark.ADImg))
            {
                remarkObj = new { haveRemark = true, remark = platConfigRemark.ADImg, remarkOpenFrm = platConfigRemark.ObjId == 0 };
            }

            PlatConfig platOther = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 5);//获取平台其它设置

            if (platOther == null)
            {
                platOther = new PlatConfig()
                {
                    Aid = r.Id, AddTime = DateTime.Now, ConfigType = 5
                };
            }
            PlatOtherConfig platOtherConfig = new PlatOtherConfig();

            platOtherConfig.VirtualPV           = platOther.ADImgType;
            platOtherConfig.VirtualPlatMsgCount = platOther.ObjId;
            platOtherConfig.PlatMsgCount        = PlatMsgBLL.SingleModel.GetCountByAId(r.Id);
            platOtherConfig.PV = PlatStatisticalFlowBLL.SingleModel.GetPVCount(r.Id);

            int totalPV      = platOtherConfig.VirtualPV + platOtherConfig.PV;
            int totalMsgCout = platOtherConfig.PlatMsgCount + platOtherConfig.VirtualPlatMsgCount;

            PlatConfig platOfficialAccount = PlatConfigBLL.SingleModel.GetPlatConfig(r.Id, 6);//获取关注公众号设置

            if (platOfficialAccount == null)
            {
                platOfficialAccount = new PlatConfig()
                {
                    Aid = r.Id, AddTime = DateTime.Now, ConfigType = 6
                };
            }


            returnObj.dataObj = new
            {
                appname             = appname,
                ADImgs              = new { totalCount = adImgCount, list = listADImg },
                TjStores            = new { totalCount = tjStoreCount, list = listTjStore },
                Location            = new { curLocation = curLocation, curCityCode = curCityCode },
                platConfigRemark    = remarkObj,
                platOtherConfig     = new { TotalPV = totalPV > 100000?Convert.ToInt32(totalPV * 0.0001).ToString() + "万+": totalPV.ToString(), TotalMsgCount = totalMsgCout > 100000? Convert.ToInt32(totalMsgCout * 0.0001).ToString() + "万+": totalMsgCout.ToString() },
                platOfficialAccount = platOfficialAccount
            };
            returnObj.isok = true;
            returnObj.Msg  = "获取成功";
            return(Json(returnObj, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 6
0
        public ActionResult SaveConfig(PlatConfig platConfig)
        {
            result = new PlatReturnMsg();
            if (platConfig == null)
            {
                result.Msg = "数据不能为空";
                return(Json(result));
            }


            if (platConfig.Aid <= 0)
            {
                result.Msg = "appId非法";
                return(Json(result));
            }
            TransactionModel TranModel = new TransactionModel();
            int curCount = PlatConfigBLL.SingleModel.GetCountByType(platConfig.Aid, platConfig.ConfigType);

            switch (platConfig.ConfigType)
            {
            case 0:    //广告图
                if (curCount >= 5)
                {
                    result.Msg = "上限为5条";
                    return(Json(result));
                }
                break;

            case 1:    //推荐商家
                if (curCount >= 12)
                {
                    result.Msg = "上限为12家";
                    return(Json(result));
                }
                break;

            case 2:    //置顶商家
                if (curCount >= 30)
                {
                    result.Msg = "上限为30家";
                    return(Json(result));
                }

                PlatStore platStore = PlatStoreBLL.SingleModel.GetPlatStore(platConfig.ObjId, platConfig.isStoreID == 0 ? 1 : 0);
                if (platStore == null)
                {
                    result.Msg = "操作异常(商家不存在)";
                    return(Json(result));
                }
                if (platStore.Top == 1)
                {
                    result.Msg = "商家已置顶";
                    return(Json(result));
                }
                platStore.Top = 1;
                TranModel.Add(PlatStoreBLL.SingleModel.BuildUpdateSql(platStore, "Top"));

                break;
            }



            TranModel.Add(PlatConfigBLL.SingleModel.BuildAddSql(new PlatConfig()
            {
                Aid        = platConfig.Aid,
                ObjId      = platConfig.ObjId,
                ConfigType = platConfig.ConfigType,
                ADImgType  = platConfig.ADImgType,
                ADImg      = platConfig.ADImg,
                AddTime    = DateTime.Now,
                isStoreID  = platConfig.isStoreID,
                Name       = platConfig.Name
            }));


            //表示新增

            if (PlatConfigBLL.SingleModel.ExecuteTransactionDataCorect(TranModel.sqlArray))
            {
                result.isok = true;
                result.Msg  = "新增成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "新增失败";
                return(Json(result));
            }
        }
Exemplo n.º 7
0
        public ActionResult OtherSetting(int aid)
        {
            if (aid <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "参数错误!", code = "500"
                }));
            }

            int pageType = XcxAppAccountRelationBLL.SingleModel.GetXcxTemplateType(aid);

            if (pageType <= 0)
            {
                return(View("PageError", new PlatReturnMsg()
                {
                    Msg = "小程序模板不存在!", code = "500"
                }));
            }

            ViewBag.PageType = pageType;
            ViewBag.appId    = aid;

            #region 平台公告
            PlatConfig platRemark = PlatConfigBLL.SingleModel.GetPlatConfig(aid, 3);//获取平台公告
            if (platRemark == null)
            {
                platRemark = new PlatConfig()
                {
                    Aid = aid, AddTime = DateTime.Now, ADImg = string.Empty, ConfigType = 3, ObjId = 1
                };
            }
            ViewBag.PlatRemark = platRemark;
            #endregion

            #region 发帖量 访问量
            PlatConfig platOther = PlatConfigBLL.SingleModel.GetPlatConfig(aid, 5);//获取平台公告
            if (platOther == null)
            {
                platOther = new PlatConfig()
                {
                    Aid = aid, AddTime = DateTime.Now, ConfigType = 5
                };
            }
            PlatOtherConfig platOtherConfig = new PlatOtherConfig();
            platOtherConfig.VirtualPV           = platOther.ADImgType;
            platOtherConfig.VirtualPlatMsgCount = platOther.ObjId;
            platOtherConfig.PlatMsgCount        = PlatMsgBLL.SingleModel.GetCountByAId(aid);
            platOtherConfig.PV           = PlatStatisticalFlowBLL.SingleModel.GetPVCount(aid);
            platOtherConfig.PlatConfigId = platOther.Id;
            #endregion


            PlatConfig platOfficialAccount = PlatConfigBLL.SingleModel.GetPlatConfig(aid, 6);//获取关注公众号设置
            if (platOfficialAccount == null)
            {
                platOfficialAccount = new PlatConfig()
                {
                    Aid = aid, AddTime = DateTime.Now, ConfigType = 6
                };
            }
            ViewBag.PlatOfficialAccount = platOfficialAccount;



            return(View(platOtherConfig));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 更新排序/删除
        /// </summary>
        /// <returns></returns>
        public ActionResult UpdateConfig()
        {
            result = new PlatReturnMsg();
            int appId      = Utility.IO.Context.GetRequestInt("appId", 0);
            int id         = Utility.IO.Context.GetRequestInt("id", 0);
            int actionType = Utility.IO.Context.GetRequestInt("actionType", 0);//默认排序0 -1删除
            int sortNumber = Utility.IO.Context.GetRequestInt("sortNumber", 0);

            if (appId <= 0 || id <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }
            TransactionModel TranModel  = new TransactionModel();
            PlatConfig       platConfig = PlatConfigBLL.SingleModel.GetModel(id);

            if (platConfig == null || platConfig.Aid != appId)
            {
                result.Msg = "数据不存在";
                return(Json(result));
            }

            if (actionType == -1)
            {
                if (platConfig.ConfigType == 2)
                {
                    PlatStore platStore = PlatStoreBLL.SingleModel.GetPlatStore(platConfig.ObjId, platConfig.isStoreID == 0 ? 1 : 0);
                    if (platStore == null)
                    {
                        result.Msg = "操作异常(商家不存在)";
                        return(Json(result));
                    }
                    platStore.Top = 0;
                    TranModel.Add(PlatStoreBLL.SingleModel.BuildUpdateSql(platStore, "Top"));
                }



                platConfig.State = -1;
                TranModel.Add(PlatConfigBLL.SingleModel.BuildUpdateSql(platConfig, "State"));
            }
            else
            {
                platConfig.SortNumber = sortNumber;

                TranModel.Add(PlatConfigBLL.SingleModel.BuildUpdateSql(platConfig, "SortNumber"));
            }


            if (PlatConfigBLL.SingleModel.ExecuteTransactionDataCorect(TranModel.sqlArray))
            {
                result.isok = true;
                result.Msg  = "操作成功";
                return(Json(result));
            }
            else
            {
                result.Msg = "操作异常";
                return(Json(result));
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// 平台公告新增或者更新
        /// </summary>
        /// <returns></returns>
        public ActionResult SavePlatRemark()
        {
            result = new PlatReturnMsg();
            int    appId      = Utility.IO.Context.GetRequestInt("appId", 0);
            int    type       = Utility.IO.Context.GetRequestInt("type", 0);
            int    id         = Utility.IO.Context.GetRequestInt("id", 0);
            int    objId      = Utility.IO.Context.GetRequestInt("objId", 0);
            int    virtualPV  = Utility.IO.Context.GetRequestInt("virtualPV", 0);
            int    ADImgType  = Utility.IO.Context.GetRequestInt("ADImgType", 0);
            string platRemark = Utility.IO.Context.GetRequest("platRemark", string.Empty);

            if (appId <= 0)
            {
                result.Msg = "参数错误";
                return(Json(result));
            }

            PlatConfig platConfig = PlatConfigBLL.SingleModel.GetModel(id);

            if (platConfig == null || platConfig.State == -1)
            {
                //表示新增
                platConfig         = new PlatConfig();
                platConfig.Aid     = appId;
                platConfig.AddTime = DateTime.Now;
                platConfig.ObjId   = objId;
                if (type == 0)
                {
                    //表示公告
                    platConfig.ADImg      = platRemark;
                    platConfig.ConfigType = 3;
                    platConfig.ADImgType  = 2;
                }
                else if (type == 2)
                {
                    //表示关注公众号组件
                    platConfig.ConfigType = 6;
                    platConfig.ADImgType  = ADImgType;
                }
                else
                {
                    //表示虚拟访问量跟虚拟发帖量
                    platConfig.ConfigType = 5;
                    platConfig.ADImgType  = virtualPV;
                }



                id = Convert.ToInt32(PlatConfigBLL.SingleModel.Add(platConfig));
                if (id > 0)
                {
                    result.isok = true;
                    result.Msg  = "新增成功";
                    return(Json(result));
                }

                result.Msg = "新增异常";
                return(Json(result));
            }
            else
            {
                //表示更新
                string updateFiled = "ADImg,ObjId";
                platConfig.ObjId = objId;
                if (type == 0)
                {
                    platConfig.ADImg = platRemark;
                }
                else if (type == 2)
                {
                    //表示关注公众号组件
                    platConfig.ConfigType = 6;
                    platConfig.ADImgType  = ADImgType;
                    updateFiled           = "ADImgType,ObjId";
                }
                else
                {
                    platConfig.ADImgType = virtualPV;
                    updateFiled          = "ADImgType,ObjId";
                }

                if (PlatConfigBLL.SingleModel.Update(platConfig, updateFiled))
                {
                    result.isok = true;
                    result.Msg  = "更新成功";
                    return(Json(result));
                }

                result.Msg = "更新异常";
                return(Json(result));
            }
        }