| | |
| | | { |
| | | List<tbl_sms_task> list = new List<tbl_sms_task>(); |
| | | string[] Out = System.Configuration.ConfigurationManager.AppSettings["OutUserid"].Trim().Split(','); |
| | | |
| | | string U_sql = "select userid,parentuserid from tbl_user where isuse=1 and isdelete=0"; |
| | | DataSet U_ds1 = da.ExecuteDataSet(CommandType.Text, U_sql); |
| | | DataTable U_dt = U_ds1.Tables[0]; |
| | | List<GetUserID> IGetID = new List<GetUserID>(); |
| | | foreach (DataRow item in U_dt.Rows) |
| | | { |
| | | IGetID.Add(new GetUserID{ |
| | | UserID = item[0].ToString(), |
| | | ParentuserID = item[1].ToString() |
| | | }); |
| | | } |
| | | List<GetUserID> GetID = GetSonUsserID(Out, IGetID); |
| | | |
| | | string[] I_Out = new string[GetID.Count]; |
| | | int i = 0; |
| | | foreach (var item in GetID) |
| | | { |
| | | I_Out[i] = item.UserID; |
| | | i++; |
| | | } |
| | | Log4netService.Debug($"è¿æ»¤ID个æ°:{GetID.Count}"); |
| | | try |
| | | { |
| | | string time = DateTime.Now.AddHours(-1).ToString("yyyy-MM-dd HH:mm"); |
| | | string sql = $"select TaskID,UserID,MsgContent,ReadError,IsAudit from tbl_sms_task where CreateTime>= '{time}'and IsAudit=0 and ReadError like '%åå
宿%' and MsgContent not like '%å_é%' and MsgContent not like '%é订%' and MsgContent not like '%é_T%' and MsgContent not like '%.c%' and MsgContent not like '%ç¹å¯¹ç¹%')"; |
| | | string sql = $"select TaskID,UserID,MsgContent,ReadError,IsAudit from tbl_sms_task where CreateTime>= '{time}'and IsAudit=0 and ReadError like '%åå
宿%' and msgContent not like '%é' and MsgContent not like '%å_é%' and MsgContent not like '%é订%' and MsgContent not like '%é_T%' and MsgContent not like '%.c%' and MsgContent not like '%ç¹å¯¹ç¹%'"; |
| | | DataSet ds = da.ExecuteDataSet(CommandType.Text, sql); |
| | | DataTable dt = ds.Tables[0]; |
| | | if (dt.Rows.Count > 0) |
| | | { |
| | | foreach (DataRow dr in dt.Rows) |
| | | { |
| | | if (!Out.Contains(dr["UserID"].ToString().Trim())) |
| | | if (!I_Out.Contains(dr["UserID"].ToString().Trim())) |
| | | { |
| | | int taskid = int.Parse(dr["TaskID"].ToString()); |
| | | int userid = int.Parse(dr["UserID"].ToString()); |
| | |
| | | } |
| | | else |
| | | { |
| | | Console.WriteLine($"åå¨è¿æ»¤IDï¼{dr["UserID"].ToString().Trim()},è·³è¿è¯¥IDå
容"); |
| | | Console.WriteLine($"ãå®¡æ ¸æä½ãåå¨è¿æ»¤IDï¼{dr["UserID"].ToString().Trim()},è·³è¿è¯¥IDå
容"); |
| | | Log4netService.Debug($"ãå®¡æ ¸æä½ãåå¨è¿æ»¤IDï¼{dr["UserID"].ToString().Trim()},è·³è¿è¯¥IDå
容ï¼{dr["MsgContent"]}"); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// éå½è·åè·ååID |
| | | /// </summary> |
| | | /// <param name="UserID">ä¼ å
¥ä¸çº§ID</param> |
| | | /// <param name="GetID">ä¼ å
¥è´¦å·è¡¨</param> |
| | | /// <returns></returns> |
| | | public static List<GetUserID> GetSonUsserID(string[] UserID, List<GetUserID> GetID) |
| | | { |
| | | List<GetUserID> LGetID = new List<GetUserID>(); |
| | | List<GetUserID> LID = new List<GetUserID>(); |
| | | for (int i = 0; i < UserID.Length; i++) |
| | | { |
| | | LID.AddRange(GetID.Where(a => a.ParentuserID == UserID[i]).ToList());//å°GetIDä¸ç¬¦åä¸çº§IDçææåIDä¼ å
¥LID |
| | | |
| | | } |
| | | if (LID.Count != 0)//é彿¡ä»¶ |
| | | { |
| | | string[] SonID = new string[LID.Count]; |
| | | int i = 0; |
| | | foreach (var item in LID) |
| | | { |
| | | //Console.WriteLine($"éå½ IDï¼{item.ParentuserID} åIDï¼{item.UserID}"); |
| | | SonID[i] = item.UserID; |
| | | i++; |
| | | }//å°åIDè½¬ææ°ç» |
| | | //for (int l = 0; l < SonID.Length; l++) |
| | | //{ |
| | | // Console.WriteLine($"éè¦éå½çIDï¼{SonID[l]}"); |
| | | //} |
| | | |
| | | for (int h = 0; h < UserID.Length; h++) |
| | | { |
| | | LGetID.Add(new GetUserID |
| | | { |
| | | UserID = UserID[h].ToString(), |
| | | ParentuserID = 0.ToString() |
| | | }); |
| | | } |
| | | LGetID.AddRange(GetSonUsserID(SonID, GetID)); |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < UserID.Length; i++) |
| | | { |
| | | LGetID.Add(new GetUserID |
| | | { |
| | | UserID = UserID[i].ToString(), |
| | | ParentuserID = 0.ToString() |
| | | }); |
| | | } |
| | | return LGetID; |
| | | } |
| | | return LGetID; |
| | | } |
| | | |
| | | public class GetUserID |
| | | { |
| | | public string UserID { get; set; } |
| | | public string ParentuserID { get; set; } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ´æ°å®¡æ ¸ç¶æ |
| | | /// </summary> |
| | | /// <param name="audit"></param> |