Example #1
0
        public DataTable AddMyCollections([FromBody] MyCollections json)
        {
            DataTable dt = null;

            try
            {
                if (json.id > 0 && json.userid > 0)
                {
                    EPData    ep    = new EPData();
                    ValidInfo valid = ep.AddMyCollectionByCP(json);
                    if (valid.valid)
                    {
                        dt = GetTable("true", "");
                    }
                }
                else
                {
                    dt = GetTable("false", "参数错误");
                }
            }
            catch (Exception ex)
            {
                dt = GetTable("false", ex.Message);
                Log.WriteError(ex, "我的收藏(SettMyCollections)");
            }
            return(dt);
        }
Example #2
0
        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);
        }
Example #3
0
        public DataTable EditMyNotes([FromBody] MyNotes json)
        {
            DataTable dt = null;

            try
            {
                if (json.userid > 0 && json.id > 0)
                {
                    EPData ep = new EPData();
                    ep.EditMyNoteByCP(json);
                    dt = GetTable("true", "");
                    //SqlParameter[] sqlparam =null;
                    //sqlparam.(new SqlParameter() { });


                    //ep.EditMyNoteByCP("cp_EditMyNotes", sqlparam);
                }
                else
                {
                    dt = GetTable("false", "参数错误");
                }
            }
            catch (Exception ex)
            {
                dt = GetTable("false", ex.Message);
                Log.WriteError(ex, "我的笔记(EditMyNotes)");
            }
            return(dt);
        }
Example #4
0
 public void SendCode([FromBody] CodeInfo json)
 {
     try
     {
         string phone = json.phone;
         string code  = string.Empty;
         if (!string.IsNullOrWhiteSpace(phone))
         {
             Random rm = new Random();
             code = rm.Next(100000, 1000000).ToString();
             EPData ep = new EPData();
             if (ep.InsertCodeByCP("cp_VerificationCodeInsert", phone, code, json.codetype))
             {
                 //if (EPData.InsertCodeByCP("cp_VerificationCodeInsert", phone, code))
                 //{
                 //    Log.WriteCode(phone, code);
                 //}
                 //new MWSend().MWSendMsg(phone, code);
                 new WYSend().Send(phone, code);
             }
         }
     }
     catch (Exception ex)
     {
         Log.WriteError(ex, "发送验证码(SendCode)");
     }
 }
Example #5
0
 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)");
     }
 }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
Example #9
0
        public DataTable AddMyNotes([FromBody] MyNotes json)
        {
            DataTable dt = null;

            try
            {
                if (json.userid > 0)
                {
                    EPData    ep    = new EPData();
                    ValidInfo valid = ep.AddMyNotesByCp(json);
                    dt = GetTable(valid.valid, valid.errmsg);
                }
                else
                {
                    dt = GetTable("false", "参数错误");
                }
            }
            catch (Exception ex)
            {
                dt = GetTable("false", ex.Message);
                Log.WriteError(ex, "我的笔记(AddMyNotes)");
            }
            return(dt);
        }
Example #10
0
        public DataTable InsertMessagesToUser([FromBody] MyMessages json)
        {
            DataTable dt = null;

            try
            {
                if (!string.IsNullOrWhiteSpace(json.userids))
                {
                    EPData    ep    = new EPData();
                    ValidInfo valid = ep.InsertMessagesToUserByCP(json);
                    dt = GetTable(valid.valid.ToString(), valid.errmsg);
                }
                else
                {
                    dt = GetTable("false", "参数错误");
                }
            }
            catch (Exception ex)
            {
                dt = GetTable("false", ex.Message);
                Log.WriteError(ex, "我的消息(SendMessagesToUser)");
            }
            return(dt);
        }
Example #11
0
        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);
        }
Example #12
0
        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);
        }