Ejemplo n.º 1
0
        // GET: /<controller>/
        public IActionResult Index(string key)
        {
            ViewData["key"] = key;
            var     db   = new MongoDBTool().GetMongoCollection <We7Temp>();
            We7Temp data = null;

            if (hostingEnvironment.IsDevelopment())
            {
                data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault();
            }
            else
            {
                data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key)));
            }

            if (data == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            ViewData["we7Data"] = data.Data;
            JObject jObject = (JObject)JsonConvert.DeserializeObject(data.Data);
            string  uniacid = (string)jObject["uniacid"];

            if (!string.IsNullOrEmpty(uniacid))
            {
                HttpContext.Session.PushWe7Data(data.Data);
            }
            //hasIdentity = true;
            return(RedirectToAction("Index", "Merchant"));
        }
Ejemplo n.º 2
0
        // GET: /<controller>/
        public IActionResult Index(string key)
        {
            ViewData["key"] = key;
            var     db   = new MongoDBTool().GetMongoCollection <We7Temp>();
            We7Temp data = null;

            if (MainConfig.IsDev)
#pragma warning disable CS0162 // Unreachable code detected
            {
                data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault();
            }
#pragma warning restore CS0162 // Unreachable code detected
            else
            {
                data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key)));
            }

            if (data == null)
            {
                return(RedirectToAction("Index", "Error"));
            }
            ViewData["we7Data"] = data.Data;
            var jObject = (JObject)JsonConvert.DeserializeObject(data.Data);
            var uniacid = (string)jObject["uniacid"];
            if (!string.IsNullOrEmpty(uniacid))
            {
                HttpContext.Session.PushWe7Data(data.Data);
            }
            //hasIdentity = true;
            return(RedirectToAction("Index", "Merchant"));
        }
Ejemplo n.º 3
0
        public IActionResult Test()
        {
            var collection = new MongoDBTool().GetMongoCollection <WeChatCountModel>();
            var filter     = Builders <WeChatCountModel> .Filter;
            var filterSum  = (filter.Eq("CountDataList.DataType", WeChatCountType.周的画像) |
                              filter.Eq("CountDataList.DataType", WeChatCountType.月的画像) |
                              filter.Eq("CountDataList.DataType", WeChatCountType.昨天的画像));
            var list = collection.Find(filterSum).ToList();

            return(list.ToJsonSuccess(this));
        }
        private static void DoResetSAOT(object state)
        {
            var collection = new MongoDBTool().GetMongoCollection<AccountModel>();
            var accountList = collection.Find(Builders<AccountModel>.Filter.Empty).ToList();
            accountList.ForEach(x =>
            {
                if (x.LastRefreshTime.DayOfYear <= DateTime.Now.DayOfYear - 1)
                {
                    collection.UpdateOne(y => y.uniacid.Equals(x.uniacid) && y.AccountID.Equals(x.AccountID),
                        Builders<AccountModel>.Update.Set(y => y.CanShareTimes, 5).Set(y => y.CanOpenJackTimes, 2));
                }

            });
        }
Ejemplo n.º 5
0
        // GET: /<controller>/
        public IActionResult Index(string key)
        {
            if (key == null)
            {
                return(new RedirectToActionResult("Index", "WebError", new { errorType = ErrorType.ErrorNoUserOrTimeOut }));
            }
            ViewData["key"] = key;
            var     db   = new MongoDBTool().GetMongoCollection <We7Temp>();
            We7Temp data = null;

            if (MainConfig.IsDev || hostingEnvironment.IsDevelopment())
            {
                data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault();
            }
            else
            {
                data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key)));
            }

            if (data == null)
            {
                return(new RedirectToActionResult("Index", "WebError", new { errorType = ErrorType.ErrorNoUserOrTimeOut }));
            }
            ViewData["we7Data"] = data.Data;
            JObject jObject = (JObject)JsonConvert.DeserializeObject(data.Data);
            string  uniacid = (string)jObject["uniacid"];

            if (!string.IsNullOrEmpty(uniacid))
            {
                HttpContext.Session.PushWe7Data(data.Data);
            }
            //hasIdentity = true;
            //var urlReferrer = HttpContext.Request.Headers["referer"].FirstOrDefault();

            //if (urlReferrer!=null)
            //{
            //    var urlBase = urlReferrer.ToString();
            //    HttpContext.SetReferrer(urlBase);
            //}
            //HttpContext.SetReferrer(JsonConvert.SerializeObject(HttpContext.Request.Headers));

            string preUrl = Request.Headers["Referer"];

            if (HttpContext.GetReferrer() == null && preUrl != null)
            {
                HttpContext.SetReferrer(preUrl);
            }
            return(RedirectToAction("Index", "Merchant"));
        }
        /// <summary>
        /// 根据openId 查询用户信息
        /// </summary>
        /// <param name="openId"></param>
        /// <returns></returns>
        public string FindPersonInfo(string openId)
        {
            var collectiion = new MongoDBTool().GetMongoCollection <AccountCard>("AccountCard");
            var filter      = Builders <AccountCard> .Filter.Eq(x => x.OpenId, openId);

            var         list        = collectiion.Find <AccountCard>(f => f.OpenId.Equals(openId));
            AccountCard accountCard = null;

            accountCard = list.FirstOrDefault();
            //驼峰
            //string jsonString = JsonConvert.SerializeObject(new BaseResponseModel<AccountCard>() { JsonData = accountCard, StatusCode = (int)ActionParams.code_ok },new JsonSerializerSettings { ContractResolver=new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()});
            string jsonString = JsonConvert.SerializeObject(new BaseResponseModel <AccountCard>()
            {
                JsonData = accountCard, StatusCode = (int)ActionParams.code_ok
            });

            return(jsonString);
        }