public DataTable CheckMyNotes([FromBody] MyNotes json) { DataTable dt = null; try { if (json.userid > 0 && json.id > 0) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT * FROM EP_MyNotes WHERE UserId={0} AND ID ={1}", json.userid, json.id); EPData ep = new EPData(); dt = ep.GetData(sb.ToString()); } else { dt = GetTable("false", "参数错误"); } } catch (Exception ex) { dt = GetTable("false", ex.Message); Log.WriteError(ex, "我的笔记(CheckMyNotes)"); } return(dt); }
public void AddMyCollectionVideosWatchCounts([FromBody] MyCollectionVideos json) { try { if (json.userid > 0 && json.id > 0) { StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"UPDATE EP_MyCollectionVideos SET WatchCounts = WatchCounts+1,MyWatchCounts =MyWatchCounts +1 WHERE UserId = {0} AND ID ={1};", json.userid, json.id); EPData ep = new EPData(); ep.GetData(sb.ToString()); } } catch (Exception ex) { Log.WriteError(ex, "我的收藏视屏(AddMyCollectionVideosWatchCounts)"); } }
public DataTable UserRegister([FromBody] RegisterInfo json) { DataTable dt = null; try { EPData ep = new EPData(); ValidInfo valid = ep.UserRegisterByCp(json); if (valid.valid) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT 'true' AS IsSuccess,'' AS Error,* FROM dbo.EP_User WHERE Phone = '{0}'", json.account); dt = ep.GetData(sb.ToString()); } else { dt = new DataTable(); dt.Columns.Add("IsSuccess", typeof(string)); dt.Columns.Add("Error", typeof(string)); DataRow dr = dt.NewRow(); dr["IsSuccess"] = valid.valid.ToString(); dr["Error"] = valid.errmsg; dt.Rows.Add(dr); } } catch (Exception ex) { dt = new DataTable(); dt.Columns.Add("IsSuccess", typeof(string)); dt.Columns.Add("Error", typeof(string)); DataRow dr = dt.NewRow(); dr["IsSuccess"] = "false"; dr["Error"] = ex.Message; dt.Rows.Add(dr); Log.WriteError(ex, "注册(UserRegister)"); } return(dt); }
public DataTable GetMyMessages([FromBody] User json) { DataTable dt = null; try { if (json.userid > 0 && !string.IsNullOrWhiteSpace(json.isread)) { StringBuilder sb = new StringBuilder(); sb.AppendFormat("SELECT * FROM EP_MyMessages WHERE UserId={0} ", json.userid); switch (json.isread) { case "0": break; case "1": sb.Append(" AND IsRead=1"); break; case "2": sb.Append(" AND IsRead=0"); break; } sb.Append(" ORDER BY CreatTime DESC"); EPData ep = new EPData(); dt = ep.GetData(sb.ToString()); } else { dt = GetTable("false", "参数错误"); } } catch (Exception ex) { dt = GetTable("false", ex.Message); Log.WriteError(ex, "我的消息(GetMyMessages)"); } return(dt); }
public DataTable DeleteMyNotes([FromBody] User json) { DataTable dt = null; try { if (json.userid > 0 && !string.IsNullOrWhiteSpace(json.noteids)) { string noteids = json.noteids.Trim(','); StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"DELETE EP_MyNotes WHERE UserId={0} AND ID IN({1}); BEGIN IF (@@ROWCOUNT >=0) BEGIN SELECT 'true' AS IsSuccess,'' AS Error END ELSE BEGIN SELECT 'false' AS IsSuccess,'删除我的笔记失败' AS Error END END ", json.userid, noteids); EPData ep = new EPData(); dt = ep.GetData(sb.ToString()); } else { dt = GetTable("false", "参数错误"); } } catch (Exception ex) { dt = GetTable("false", ex.Message); Log.WriteError(ex, "我的笔记(DeleteMyNotes)"); } return(dt); }
public DataTable SetMyMessagesIsRead([FromBody] User json) { DataTable dt = null; try { if (json.userid > 0 && !string.IsNullOrWhiteSpace(json.msgids)) { string msgids = json.msgids.Trim(','); StringBuilder sb = new StringBuilder(); sb.AppendFormat(@"UPDATE EP_MyMessages SET IsRead = 1 WHERE ID IN ({0}) BEGIN IF(@@ROWCOUNT >= 0) BEGIN SELECT 'true' AS IsSuccess, '' AS Error END ELSE BEGIN SELECT 'false' AS IsSuccess, '设置已读失败' AS Error END END", msgids); EPData ep = new EPData(); dt = ep.GetData(sb.ToString()); } else { dt = GetTable("false", "参数错误"); } } catch (Exception ex) { dt = GetTable("false", ex.Message); Log.WriteError(ex, "我的消息(SetMyMessagesIsRead)"); } return(dt); }
public DataTable GetMyCollections([FromBody] User json) { DataTable dt = null; try { if (json.userid > 0) { EPData ep = new EPData(); dt = ep.GetData("SELECT * FROM EP_MyCollections WHERE UserId ={0} ORDER BY CreatTime DESC" + json.userid); } else { dt = GetTable("false", "参数错误"); } } catch (Exception ex) { dt = GetTable("false", ex.Message); Log.WriteError(ex, "我的收藏(GetMyCollection)"); } return(dt); }