Exemplo n.º 1
0
 public IActionResult SetYTX()
 {
     try
     {
         string   json       = new StreamReader(Request.Body).ReadToEnd();
         YTXModel qiNiuModel = JsonConvert.DeserializeObject <YTXModel>(json);
         qiNiuModel.AccountSID = qiNiuModel.AccountSID.Trim();
         qiNiuModel.AuthToken  = qiNiuModel.AuthToken.Trim();
         qiNiuModel.AppID      = qiNiuModel.AppID.Trim();
         thisData.SetYTX(HttpContext.Session.GetUniacID(), qiNiuModel);
         return(this.JsonSuccessStatus());
     }
     catch (Exception e)
     {
         e.Save();
         return(this.JsonErrorStatus());
     }
 }
Exemplo n.º 2
0
        internal void SetYTX(string uniacid, YTXModel qiNiuModel)
        {
            var companyCollection = mongo.GetMongoCollection <CompanyModel>();
            var company           = companyCollection.Find(x => x.uniacid.Equals(uniacid)).FirstOrDefault();

            if (company == null)
            {
                companyCollection.InsertOne(new CompanyModel()
                {
                    uniacid = uniacid,
                    YTX     = qiNiuModel
                });
            }
            else
            {
                companyCollection.UpdateOne(x => x.uniacid.Equals(uniacid), Builders <CompanyModel> .Update.Set(x => x.YTX, qiNiuModel));
            }
        }