From c37fde42c755fd330604ee512a3421b9ba2c3c30 Mon Sep 17 00:00:00 2001 From: sweta kumari Date: Wed, 3 Jan 2018 11:31:42 +0530 Subject: [PATCH] socioboard 3.0 update socioboard 3.0 update --- .vs/Socioboard/v14/.suo | Bin 319488 -> 335872 bytes .../Controllers/FacebookController.cs | 28 ++++++ .../Controllers/NotificationsController.cs | 60 ++++++++++- .../controllers/facebookfeedscontroller.js | 6 -- .../controllers/facebookreportcontroller.js | 43 +------- .../controllers/fbpagedetreportcontroller.js | 58 +++++------ .../controllers/notificationallcontroller.js | 35 ++++++- .../views/reports/facebookpagedetreport.html | 6 +- .../views/reports/facebookpagereport.html | 4 +- .../views/reports/facebookreport.html | 6 +- .../views/settings/notification_all.html | 16 +-- .../FacebookReports/FacebookPageReports.cs | 95 ++++++++++++++++-- 12 files changed, 252 insertions(+), 105 deletions(-) diff --git a/.vs/Socioboard/v14/.suo b/.vs/Socioboard/v14/.suo index d8076e02c3c3adedcb9bfe49e3b228df78718433..38fae7b8cad01bed11eb143cec4818df9c0f187f 100644 GIT binary patch delta 7603 zcmdU!dt8-O*2mAAsW&L=)yNa=7Mj*Ffa-926Mo3;AU_KaDZxX9l-oqZU8}`4*V2+ z51s{ggTJF*8{`(SL3d*Yl-Zyfji*5l1gpUP;Bk-yeg)QH?hHr-Lvrg@MlU^>`rg!9s)h=S=nXK zen?CPKW0$fnVtsy1@c{OP@Tty^lpRxU+f8&(+1rNe$=44=6__+P!#{EC^<6?kY z>FGDt1m>#WVd%!Wz=iSeLOBV35A@SNK)w$?@Wwl87Cr6`s`__Jrni&T_$vJ_fB0XQ z>vP>bWW$>Gr*dP-nDzUuuaOA1a85MY^-f@vg(n)Z>F@pXQtq$`O0TIam2ESYgjG_l z@l{x-Z(p>PTyA_9ntjboP2Yw43d7ac-eiwy4cKq93uDmTG3MATIzsM2PJcgC)eBs1 z$mea$%TeRofkU`q3FY`4MD$2k)NZ3VW4s*h^A3_e?@n4mHva$=*T%YBMX&de;S=;; z4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q_)+>hsdl|yphZ1QsEFy<)WEZx}PUf3=GCE zSMyM`?qj#U$j!5{xq|!4_O(3r2U<){wB}5=VL=KPTHz~;asCQnLRW=2f}tzLb$Rgx zvDpu+8~JcKypEs$F}gqGl`>Ehs{j{Oib7dv5;b9XHJcY;{drn%(NgK<6|u3+rQfP_M)I`P1>-Ye>WDseJaWo!x8|%K+CqMFn=2a2wh`7A@E@TI68P zS&@tkc`~}Xc#@oJ6FT6SNjw(o&Wb8L_j~fK&YQekmit7iABH|G=F85{g~f<0j>P%n zggdUOL(oeuw^4M;j4NUe!{XP)Mm1iLZ0iz>nO-1*aFvlQQri%L9s9(1S${*2n@xX| z7i0ZPWT;(5VjgJjOS5VZkVSI3MZG_sNT2yZ?VF0?%y~c4>c3 zw2;abB2q>M87~gOkSak}cdeK_)^Feo{9E6By}!i!etLgzZDh}2V;M--2cpc3IlIV# azIip{&J_?Y!&}7{php?uFP@WaLi`UX0jClG diff --git a/src/Api.Socioboard/Controllers/FacebookController.cs b/src/Api.Socioboard/Controllers/FacebookController.cs index 889a21911..289916426 100644 --- a/src/Api.Socioboard/Controllers/FacebookController.cs +++ b/src/Api.Socioboard/Controllers/FacebookController.cs @@ -13,6 +13,7 @@ using Socioboard.Facebook.Data; using Microsoft.AspNetCore.Cors; using Domain.Socioboard.Models.Mongo; +using MongoDB.Bson; // For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860 @@ -133,7 +134,34 @@ public IActionResult ReconnectFbAccount(string accessToken, long groupId, long u int res = Api.Socioboard.Repositories.FacebookRepository.ReFacebookAccount(profile, FbUser.getFbFriends(accessToken), dbr, userId, ngrp.id, Domain.Socioboard.Enum.FbProfileType.FacebookProfile, accessToken, reconnect, _redisCache, _appSettings, _logger); if (res == 1) { + + MongoRepository repofb = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings); + try + { + var result = repofb.Find(t => t.profileId == fbacc.FbUserId ); + var task = Task.Run(async () => + { + return await result; + }); + int count = task.Result.Count; + + IList lstFbFeeds = task.Result; + if(count>0) + { + FilterDefinition filter = new BsonDocument("profileId", lstFbFeeds.FirstOrDefault().profileId); + var update = Builders.Update.Set("status", true); + repofb.Update(update, filter); + + } + } + catch (Exception ex) + { + + } + return Ok("Facebook account Reconnect Successfully"); + + } else { diff --git a/src/Api.Socioboard/Controllers/NotificationsController.cs b/src/Api.Socioboard/Controllers/NotificationsController.cs index 462e2501f..b8a5ae0c1 100644 --- a/src/Api.Socioboard/Controllers/NotificationsController.cs +++ b/src/Api.Socioboard/Controllers/NotificationsController.cs @@ -140,6 +140,64 @@ public IActionResult UpdateNotifications(long userId) } - + [HttpGet("ChangePasswordDetail")] + public IActionResult ChangePasswordDetail(long userId) + { + try + { + + MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings); + DatabaseRepository dbr = new DatabaseRepository(_logger, _env); + List datalst = dbr.Find(t => t.UserId == userId).ToList(); + Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); + var result = mongorepo.Find(t => t.userId == userId && t.status==false); + var task = Task.Run(async () => + { + return await result; + }); + int count = task.Result.Count; + IList lstfbpasschange = task.Result; + + + if (count>0) + { + return Ok(userDet); + } + else + { + return NotFound(); + } + } + catch (Exception ex) + { + return NotFound(); + } + + + } + + [HttpGet("getfbchangeprofile")] + public IActionResult getfbchangeprofile(long userId) + { + MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail", _appSettings); + DatabaseRepository dbr = new DatabaseRepository(_logger, _env); + List datalst = dbr.Find(t => t.UserId == userId).ToList(); + Domain.Socioboard.Models.User userDet = dbr.FindSingle(t => t.Id == userId); + var result = mongorepo.Find(t => t.userId == userId && t.status==false); + var task = Task.Run(async () => + { + return await result; + }); + int count = task.Result.Count; + IList lstfbpasschange = task.Result; + if (count>0) + { + return Ok(lstfbpasschange.FirstOrDefault().profileId); + } + else + { + return NotFound(); + } + } } } diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedscontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedscontroller.js index c8c7fc1b9..d7c3220be 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedscontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookfeedscontroller.js @@ -217,20 +217,14 @@ SocioboardApp.controller('FacebookFeedsController', function ($rootScope, $scope $scope.reconnect(value.fbProfileType); ac = true; } - }); - if (!ac) { $scope.reconnect(null); } - } - - }, function (reason) { $scope.error = reason.data; }); - }; $scope.confirmation = function () { diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookreportcontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookreportcontroller.js index 7e6eed931..185fcd554 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookreportcontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/facebookreportcontroller.js @@ -1,6 +1,6 @@ 'use strict'; -SocioboardApp.controller('FacebookreportController', function ($rootScope, $scope, $http, $timeout, apiDomain,domain) { +SocioboardApp.controller('FacebookreportController', function ($rootScope, $scope, $http, $timeout, apiDomain) { //alert('helo'); $scope.$on('$viewContentLoaded', function () { $('#Fbfeedsdetails').DataTable({ @@ -71,46 +71,9 @@ SocioboardApp.controller('FacebookreportController', function ($rootScope, $scop } //addaed by me end for total fans - $scope.reconnect = function (xyz) { - $http.get(domain + '/socioboard/recfbcont?id=' + $scope.selectedProfile + '&fbprofileType=' + xyz) - .then(function (response) { - window.location.href = response.data; - - }, function (reason) { - $scope.error = reason.data; - }); - - }; - - $scope.fbprofiles = function () { - - console.log($scope.selectedProfile); - $http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId) - .then(function (response) { - console.log(response.data) - if (response.data != null) { - var ac = false; - $scope.profiledet = response.data; - angular.forEach($scope.profiledet, function (value, key) { - if (value.fbUserId == $scope.selectedProfile) { - $scope.reconnect(value.fbProfileType); - ac = true; - } - - }); - - if (!ac) { - $scope.reconnect(null); - } - - } - - - }, function (reason) { - $scope.error = reason.data; - }); + - }; + $scope.getData = function (profileId, days) { diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/fbpagedetreportcontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/fbpagedetreportcontroller.js index 1ca6bcf62..dec188214 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/fbpagedetreportcontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/fbpagedetreportcontroller.js @@ -95,45 +95,45 @@ SocioboardApp.controller('FbpagedetreportController', function ($rootScope, $sco } //for fbpage daily report details-------end - $scope.reconnect = function (xyz) { - $http.get(domain + '/socioboard/recfbcont?id=' + $stateParams.profileId + '&fbprofileType=' + xyz) - .then(function (response) { - window.location.href = response.data; + // $scope.reconnect = function (xyz) { + // $http.get(domain + '/socioboard/recfbcont?id=' + $stateParams.profileId + '&fbprofileType=' + xyz) + // .then(function (response) { + // window.location.href = response.data; - }, function (reason) { - $scope.error = reason.data; - }); + // }, function (reason) { + // $scope.error = reason.data; + // }); - }; + //}; - $scope.fbprofiles = function () { + //$scope.fbprofiles = function () { - $http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId) - .then(function (response) { - console.log(response.data) - if (response.data != null) { - var ac = false; - $scope.profiledet = response.data; - angular.forEach($scope.profiledet, function (value, key) { - if (value.fbUserId == $stateParams.profileId) { - $scope.reconnect(value.fbProfileType); - ac = true; - } + // $http.get(apiDomain + '/api/Facebook/GetFacebookProfilesOnlyforReconn?groupId=' + $rootScope.groupId) + // .then(function (response) { + // console.log(response.data) + // if (response.data != null) { + // var ac = false; + // $scope.profiledet = response.data; + // angular.forEach($scope.profiledet, function (value, key) { + // if (value.fbUserId == $stateParams.profileId) { + // $scope.reconnect(value.fbProfileType); + // ac = true; + // } - }); + // }); - if (!ac) { - $scope.reconnect(null); - } + // if (!ac) { + // $scope.reconnect(null); + // } - } + // } - }, function (reason) { - $scope.error = reason.data; - }); + // }, function (reason) { + // $scope.error = reason.data; + // }); - }; + //}; diff --git a/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js b/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js index f48d1e29a..55b8d4404 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js +++ b/src/Socioboard/wwwroot/contents/socioboard/controllers/notificationallcontroller.js @@ -28,7 +28,7 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco $scope.changepass = function () { - $http.get(apiDomain + '/api/Notifications/ChangePasswordDetail?userId=' + $rootScope.user.Id ) + $http.get(apiDomain + '/api/Notifications/ChangePasswordDetail?userId=' + $rootScope.user.Id+'&user' ) .then(function (response) { $scope.lstChangePass = response.data; console.log($scope.lstChangePass); @@ -44,6 +44,39 @@ SocioboardApp.controller('NotificationAllController', function ($rootScope, $sco $scope.changepass(); + + $scope.getfbprofileId = function () { + + $http.get(apiDomain + '/api/Notifications/getfbchangeprofile?userId=' + $rootScope.user.Id) + .then(function (response) { + $scope.lstfbprofile = response.data; + // console.log($scope.lstfbprofile); + //var abc = $scope.lstfbprofile; + + //$scope.notifycount = $scope.notifycount + 10; + + }, function (reason) { + $scope.error = reason.data; + }); + // end codes to load recent Feeds + } + $scope.getfbprofileId(); + + $scope.reconnect = function () { + var facebookid = $scope.lstfbprofile; + console.log($scope.lstfbprofile); + // console.log("abcd", $scope.lstfbprofile.userPrimaryEmail); + $http.get(domain + '/socioboard/recfbcont?id=' + facebookid + '&fbprofileType=' + 0) + .then(function (response) { + window.location.href = response.data; + + }, function (reason) { + $scope.error = reason.data; + }); + + }; + + // start codes to load recent Feeds $scope.loadmore = function () { $("#load_more_toggle").addClass("hide"); diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagedetreport.html b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagedetreport.html index a7aff713b..5c94834c4 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagedetreport.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagedetreport.html @@ -2,11 +2,7 @@

- Showing last 90 days report ({{fromDate | date}} - {{toDate | date}}) - - Reconnect    - - + Showing last 90 days report ({{fromDate | date}} - {{toDate | date}})

diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagereport.html b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagereport.html index 79f870e3e..518eede12 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagereport.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookpagereport.html @@ -16,9 +16,7 @@
15 30 60 - 90 - Reconnect - + 90
diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookreport.html b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookreport.html index acabde37a..734999d74 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookreport.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/reports/facebookreport.html @@ -16,16 +16,12 @@
15 30 60 - 90 - - Reconnect    - + 90
-
diff --git a/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html b/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html index 10f020b26..f3e823b81 100644 --- a/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html +++ b/src/Socioboard/wwwroot/contents/socioboard/views/settings/notification_all.html @@ -23,17 +23,19 @@
Your notifications
    -
  • +
  • -
    - - For {{lstChangePass.userPrimaryEmail}} account password has change , please reconnect your account !! -
    -
  • {{notify.socialprofileName}} diff --git a/src/SocioboardDataServices/Reports/FacebookReports/FacebookPageReports.cs b/src/SocioboardDataServices/Reports/FacebookReports/FacebookPageReports.cs index df09d19a5..adbc0c5bc 100644 --- a/src/SocioboardDataServices/Reports/FacebookReports/FacebookPageReports.cs +++ b/src/SocioboardDataServices/Reports/FacebookReports/FacebookPageReports.cs @@ -22,37 +22,42 @@ public static void CreateFacebookPageReport() { try { + int c = 0; DatabaseRepository dbr = new DatabaseRepository(); List lstFbAcc = dbr.Find(t => t.IsAccessTokenActive && t.IsActive && t.FbProfileType == Domain.Socioboard.Enum.FbProfileType.FacebookPage).ToList(); - + //lstFbAcc = lstFbAcc.Where(t => t.FbUserId.Contains("790900144392091")).ToList(); foreach (var item in lstFbAcc) { - if (item.lastpagereportgenerated.AddHours(24) <= DateTime.UtcNow) - { - CreateReports(item.FbUserId, item.AccessToken, item.Is90DayDataUpdated); + //if (item.lastpagereportgenerated.AddHours(24) <= DateTime.UtcNow) + //{ + CreateReports(item.FbUserId, item.AccessToken, item.Is90DayDataUpdated,item.UserId); item.Is90DayDataUpdated = true; item.lastpagereportgenerated = DateTime.UtcNow; dbr.Update(item); cache.Delete(Domain.Socioboard.Consatants.SocioboardConsts.CacheTwitterMessageReportsByProfileId + item.FbUserId); - } + Console.WriteLine(c++); + Console.WriteLine("updated "+item.FbUserId); + + // } } Thread.Sleep(60000); } catch (Exception ex) { Console.WriteLine("issue in web api calling" + ex.StackTrace); - Thread.Sleep(600000); + Thread.Sleep(60000); } } } - public static void CreateReports(string ProfileId, string AccessToken, bool is90daysupdated) + public static void CreateReports(string ProfileId, string AccessToken, bool is90daysupdated,long userId) { int day = 1; if (!is90daysupdated) { day = 90; } + double since = SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow.AddDays(-day)); double until = SBHelper.ConvertToUnixTimestamp(DateTime.UtcNow); JObject pageobj = new JObject(); @@ -80,6 +85,12 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 JObject jofacebooksharing_typeUrlobj = new JObject(); JObject jofacebookagegenderUrlobj = new JObject(); + MongoRepository mongorepofb = new MongoRepository("FacebookPasswordChangeUserDetail"); + + string errormsg = null; + string ispasschange = null; + string msg = null; + #region likes try @@ -96,10 +107,14 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 { string facebooknewfanUrl = "https://graph.facebook.com/v2.7/" + ProfileId + "/insights/page_fan_adds?pretty=0&since=" + since.ToString() + "&suppress_http_code=1&until=" + until.ToString() + "&access_token=" + AccessToken; string outputface = getFacebookResponse(facebooknewfanUrl); + ispasschange = outputface; likesobj = JArray.Parse(JArray.Parse(JObject.Parse(outputface)["data"].ToString())[0]["values"].ToString()); } catch (Exception ex) { + errormsg = ispasschange; + msg = getBetween(errormsg, "e\":\"", ":"); + } #endregion #region unlikes @@ -107,10 +122,12 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 { string facebookunlikjeUrl = "https://graph.facebook.com/v2.7/" + ProfileId + "/insights/page_fan_removes?pretty=0&since=" + since.ToString() + "&suppress_http_code=1&until=" + until.ToString() + "&access_token=" + AccessToken; string outputfaceunlike = getFacebookResponse(facebookunlikjeUrl); + ispasschange = outputfaceunlike; unlikesobj = JArray.Parse(JArray.Parse(JObject.Parse(outputfaceunlike)["data"].ToString())[0]["values"].ToString()); } catch (Exception ex) { + errormsg = ispasschange; } #endregion #region impression @@ -226,6 +243,52 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 { } + try + { + if (msg == "Error validating access token") + { + + DatabaseRepository dbr = new DatabaseRepository(); + Domain.Socioboard.Models.Facebookaccounts lstFbAcc = dbr.Single(t => t.FbUserId == ProfileId); + Domain.Socioboard.Models.User lstUser = dbr.Single(t => t.Id == lstFbAcc.UserId); + Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail fbdetailpass = new Domain.Socioboard.Models.Mongo.FacebookPasswordChangeUserDetail(); + fbdetailpass.Id = ObjectId.GenerateNewId(); + fbdetailpass.strId = ObjectId.GenerateNewId().ToString(); + fbdetailpass.userId = userId; + fbdetailpass.profileId = ProfileId; + fbdetailpass.message = msg; + fbdetailpass.userPrimaryEmail = lstUser.EmailId; + fbdetailpass.dateValue = DateTime.Today.ToString(); + fbdetailpass.status = false; + + try + { + MongoRepository mongorepo = new MongoRepository("FacebookPasswordChangeUserDetail"); + var ret = mongorepo.Find(t => t.profileId == fbdetailpass.profileId); + var task = Task.Run(async () => + { + return await ret; + }); + if (task.Result != null) + { + if (task.Result.Count() < 1) + { + mongorepo.Add(fbdetailpass); + } + } + } + catch (Exception ex) + { + } + + } + } + catch (Exception ex) + { + + } + + #endregion foreach (JObject obj in likesobj) { @@ -827,7 +890,7 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 try { MongoRepository mongorepo = new MongoRepository("FacaebookPageDailyReports"); - var ret = mongorepo.Find(t => t.date == facebookReportViewModal.date); + var ret = mongorepo.Find(t => t.date == facebookReportViewModal.date && t.pageId == facebookReportViewModal.pageId); var task = Task.Run(async () => { return await ret; @@ -850,6 +913,22 @@ public static void CreateReports(string ProfileId, string AccessToken, bool is90 } + + public static string getBetween(string strSource, string strStart, string strEnd) + { + int Start, End; + if (strSource.Contains(strStart) && strSource.Contains(strEnd)) + { + Start = strSource.IndexOf(strStart, 0) + strStart.Length; + End = strSource.IndexOf(strEnd, Start); + return strSource.Substring(Start, End - Start); + } + else + { + return ""; + } + } + public static string getFacebookResponse(string Url) { var facebooklistpagerequest = (HttpWebRequest)WebRequest.Create(Url);