app.tiding.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. using BizCom;
  2. using SQLData;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace SiteCore.Handler
  10. {
  11. public partial class app
  12. {
  13. public void get_modelsms()
  14. {
  15. int uid = getDecodeInt("uid");
  16. if (uid == 0)
  17. {
  18. conError("找不到会员");
  19. return;
  20. }
  21. string sql = "select typecode,(select count(0) from s_tiding where typecode=b.typecode and touserid=b.touserid and isread=0) as c,(select top 1 con from view_tiding where typecode=b.typecode and touserid=b.touserid order by atime desc) as lcon from view_tiding as b where touserid=" + uid + " group by typecode,touserid";
  22. DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  23. conGridJson(dt.Rows.Count, Utils.Serialization.JsonString.DataTable2LowerAjaxJson(dt));
  24. }
  25. public void get_msm()
  26. {
  27. int uid = getDecodeInt("uid");
  28. if (uid == 0)
  29. {
  30. conError("找不到会员");
  31. return;
  32. }
  33. string sql = "select count(0) from s_tiding where touserid="+uid+" and isread=0";
  34. object result = DbHelper.DbConn.ExecuteScalar(sql);
  35. if (result == null) conSuccess("0");
  36. else conSuccess(result.ToString());
  37. //DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
  38. //conGridJson(dt.Rows.Count, Utils.Serialization.JsonString.DataTable2LowerAjaxJson(dt));
  39. }
  40. public void get_mysms()
  41. {
  42. int uid = getDecodeInt("uid");
  43. if (uid == 0)
  44. {
  45. conError("找不到会员");
  46. return;
  47. }
  48. string typecode = GetPostString("typecode");
  49. DataStruct dStruct = GetPostStruct();
  50. List<string> lw = new List<string>();
  51. if(typecode.Length>0)lw.Add("typecode='" + typecode + "'");
  52. lw.Add("touserid=" + uid);
  53. dStruct.Fileds = "id,username,userpic,tid,mainid,typecode,title,con,atime as time,isread";
  54. dStruct.MainWhere = string.Join(" and ", lw.ToArray());
  55. dStruct.Order = "atime desc";
  56. DataTable dt = WebCache.GetData("view_tiding", dStruct);
  57. conGridJson(dStruct.TotalCount, Utils.Serialization.JsonString.DataTable2LowerAjaxJson(dt));
  58. }
  59. public void read_mysms()
  60. {
  61. int uid = getDecodeInt("uid");
  62. if (uid == 0)
  63. {
  64. conError("找不到会员");
  65. return;
  66. }
  67. if (UrlPostParmsCheck("smsids"))
  68. {
  69. string smsIds = GetPostString("smsids");
  70. string sql = "update s_tiding set isread=1 where touserid=" + uid + " and mainid in(" + smsIds + ")";
  71. //STiding.ExecuteNonQuery(sql);
  72. conSuccess("消息己读");
  73. return;
  74. }
  75. conError("错误的参数");
  76. }
  77. public void read_ewu_sms()
  78. {
  79. int uid = getDecodeInt("uid");
  80. if (uid == 0)
  81. {
  82. conError("找不到会员");
  83. return;
  84. }
  85. if (UrlPostParmsCheck("mainid"))
  86. {
  87. string mainid = GetPostString("mainid");
  88. string sql = "update s_tiding set isread=1 where mainid=" + mainid + " and touserid=" + uid;
  89. //STiding.ExecuteNonQuery(sql);
  90. conSuccess("消息己读");
  91. return;
  92. }
  93. }
  94. public void clear_mysms()
  95. {
  96. int uid = getDecodeInt("uid");
  97. if (uid == 0)
  98. {
  99. conError("找不到会员");
  100. return;
  101. }
  102. if (UrlPostParmsCheck("smsids"))
  103. {
  104. string smsIds = GetPostString("smsids");
  105. string sql = "delete from s_tiding where touserid=" + uid + " and id in(" + smsIds + ")";
  106. //STiding.ExecuteNonQuery(sql);
  107. conSuccess("清除消息");
  108. return;
  109. }
  110. conError("错误的参数");
  111. }
  112. }
  113. }