/// <summary>
        /// 检查是否登录
        /// </summary>
        /// <returns></returns>
        // GET: Base
        public bool CheckIsLogin()
        {
            if (Session["acount"] == null || string.IsNullOrEmpty(Session["acount"].ToString()))
            {
                return(false);
            }

            ViewData["platformName"] = WebConfigeOpert.GetPlatformName();
            return(true);
        }
        /// <summary>
        /// 注册检查
        /// </summary>
        /// <returns></returns>
        private string CheckSignature()
        {
            if (!string.IsNullOrEmpty(Request["echoStr"]))
            {
                var signature = Request["signature"];
                var timestamp = Request["timestamp"];
                var nonce     = Request["nonce"];
                var token     = WebConfigeOpert.GetWXtoken();

                bool checkReslut = new WXApiOpert().CheckSignature(signature, timestamp, nonce, token);

                return(checkReslut ? Request["echoStr"] : string.Empty);
            }

            return(string.Empty);
        }
        /// <summary>
        /// 微信API入口
        /// </summary>
        /// <returns></returns>
        public string Index()
        {
            //// 只有在第一次服务搭建的时候开启,后面注释掉该代码
            /// CheckSignature();
            try
            {
                MwxMessage wx  = GetWxMessage();
                string     res = "";

                string sendMessage = string.Empty;
                if (wx.MsgType == "text")
                {
                    if (wx.Content == "待送货订单")
                    {
                        ///// 查询待送货订单
                        //// 包括3条数据
                        //// 1、总待送货
                        //// 2、半小时内需要送货的订单数
                        //// 3、今天内需要送货的订单数
                        sendMessage = this.GetSendGoodesCount();
                    }
                    else
                    {
                        //// 记录一条日志信息
                        sendMessage = string.Format("您好, {0}已收到你消息。!", WebConfigeOpert.GetPlatformName());
                    }
                }

                if (!string.IsNullOrEmpty(sendMessage))
                {
                    res = new WXApiOpert().GetSendMessage(wx, sendMessage);
                }

                return(res);
            }
            catch (Exception)
            {
                return(string.Empty);
            }
        }
 public marketController()
 {
     ViewData["platformName"] = WebConfigeOpert.GetPlatformName();
     ViewData["PalteWebSite"] = WebConfigeOpert.GetPalteWebSite();
 }
Exemplo n.º 5
0
 // GET: Login
 public ActionResult Index()
 {
     Session.Abandon();//清除全部Session
     ViewData["platformName"] = WebConfigeOpert.GetPlatformName();
     return(View());
 }