_Comment_GetCommentContentsByIds=`SELECT * FROM @comment_content WHERE comment_id IN (?)`
_Comment_GetCommentCount=`SELECT count(*) FROM @comment WHERE post_id=? AND is_del=0`
_Comment_GetCommentReplyById=`SELECT * FROM @comment_reply WHERE id=? AND is_del=0`
_Comment_GetCommentThumbs=`SELECT user_id, tweet_id, comment_id, reply_id, comment_type, is_thumbs_up, is_thumbs_down FROM @tweet_comment_thumbs WHERE user_id=? AND tweet_id=?`
_Comment_GetCommentThumbs=`SELECT user_id, tweet_id, comment_id, reply_id, comment_type, is_thumbs_up, is_thumbs_down FROM @tweet_comment_thumbs WHERE user_id=? AND tweet_id=?`
_Comment_GetCommmentRepliesByIds=`SELECT * FROM @comment_reply WHERE comment_id IN (?) ORDER BY id ASC`
_Comment_GetDefaultComments=`SELECT * FROM @comment WHERE post_id=? AND is_del=0 ORDER BY is_essence DESC, id ASC LIMIT ? OFFSET ?`
_Comment_GetHotsComments=`SELECT c.* FROM @comment c LEFT JOIN @comment_metric m ON c.id=m.comment_id WHERE c.post_id=? AND c.is_del=0 AND m.is_del=0 ORDER BY is_essence DESC, m.rank_score DESC, c.id DESC LIMIT ? OFFSET ?`
_CommentManage_DecrCommentReplyCount=`UPDATE @comment SET reply_count=reply_count-1, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_DecrCommentReplyCount=`UPDATE @comment SET reply_count=reply_count-1, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_DeleteComment=`UPDATE @comment SET deleted_on=?, is_del=1 WHERE id=? AND is_del=0`
_CommentManage_DeleteCommentReply=`UPDATE @comment_reply SET deleted_on=?, is_del=1 WHERE id=? AND is_del=0`
_CommentManage_DeleteCommentThumbs=`UPDATE @tweet_comment_thumbs SET deleted_on=?, is_del=1 WHERE user_id=? AND tweet_id=? AND comment_id=? AND is_del=0`
@ -42,8 +42,8 @@ const (
_CommentManage_GetIssenceStatusById=`SELECT is_essence FROM @comment WHERE id=?`
_CommentManage_GetCommentReplyThumb=`SELECT * FROM @tweet_comment_thumbs WHERE user_id=? AND tweet_id=? AND comment_id=? AND reply_id=? AND comment_type=1 AND is_del=0`
_CommentManage_GetTweetCommentThumb=`SELECT * FROM @tweet_comment_thumbs WHERE user_id=? AND tweet_id=? AND comment_id=? AND comment_type=0 AND is_del=0`
_CommentManage_HighlightComment=`UPDATE @comment SET is_essence=1-is_essence, modified_on=? WHERE id=? AND user_id=? AND is_del=0`
_CommentManage_IncrCommentReplyCount=`UPDATE @comment SET reply_count=reply_count+1, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_HighlightComment=`UPDATE @comment SET is_essence=1-is_essence, modified_on=? WHERE id=? AND user_id=? AND is_del=0`
_CommentManage_IncrCommentReplyCount=`UPDATE @comment SET reply_count=reply_count+1, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_UpdateCommentThumbsCount=`UPDATE @comment SET thumbs_up_count=?, thumbs_down_count=?, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_UpdateReplyThumbsCount=`UPDATE @comment_reply SET thumbs_up_count=?, thumbs_down_count=?, modified_on=? WHERE id=? AND is_del=0`
_CommentManage_UpdateThumbsUpdownComment=`UPDATE @tweet_comment_thumbs SET is_thumbs_up=:is_thumbs_up, is_thumbs_down=:is_thumbs_down, modified_on=:modified_on WHERE id=:id AND is_del=0`
@ -69,8 +69,8 @@ const (
_FollowingManager_CreateFollowing=`INSERT INTO @following (user_id, follow_id, created_on) VALUES (?, ?, ?)`
_FollowingManager_DeleteFollowing=`UPDATE @following SET is_del=1, deleted_on=? WHERE user_id=? AND follow_id=? AND is_del=0`
_FollowingManager_ExistFollowing=`SELECT 1 FROM @following WHERE user_id=? AND follow_id=? AND is_del=0`
_FollowingManager_ListFollowings=`SELECT u.id user_id, u.username username, u.nickname nickname, u.avatar avatar, u.created_on created_on FROM @following f JOIN @user u ON f.user_id=u.id WHERE f.follow_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_FollowingManager_ListFollows=`SELECT u.id user_id, u.username username, u.nickname nickname, u.avatar avatar, u.created_on created_on FROM @following f JOIN @user u ON f.follow_id=u.id WHERE f.user_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_FollowingManager_ListFollowings=`SELECT u.id user_id, u.username username, u.nickname nickname, u.avatar avatar, u.created_on created_on FROM @following f JOIN @user u ON f.user_id=u.id WHERE f.follow_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_FollowingManager_ListFollows=`SELECT u.id user_id, u.username username, u.nickname nickname, u.avatar avatar, u.created_on created_on FROM @following f JOIN @user u ON f.follow_id=u.id WHERE f.user_id=? AND f.is_del=0 ORDER BY u.nickname ASC LIMIT ? OFFSET ?`
_Message_CountAllMessages=`SELECT count(*) FROM @message WHERE (receiver_user_id=? OR (sender_user_id=? AND type=4)) AND is_del=0`
_Message_CountRequestingMessages=`SELECT count(*) FROM @message WHERE receiver_user_id=? AND type=5 AND is_del=0`
_Message_CountSystemMessages=`SELECT count(*) FROM @message WHERE receiver_user_id=? AND type IN (1, 2, 3, 99) AND is_del=0`
@ -91,14 +91,14 @@ const (
_Security_UsePhoneCaptcha=`UPDATE @captcha SET use_times=use_times+1, modified_on=? WHERE id=? AND is_del=0`
_ShipIndex_IndexByAdmin=`SELECT * FROM @post WHERE is_del=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexByGuest=`SELECT * FROM @post WHERE visibility=90 AND is_del=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexBySelf=`SELECT * FROM @post WHERE is_del=0 AND (visibility=90 OR (visibility=0 AND user_id=?) OR (visibility=50 AND user_id IN (?))) ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexBySelf=`SELECT * FROM @post WHERE is_del=0 AND (visibility=90 OR (visibility=0 AND user_id=?) OR (visibility=50 AND user_id IN (?))) ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_ShipIndex_IndexCountByAdmin=`SELECT count(*) FROM @post WHERE is_del=0`
_ShipIndex_IndexCountByGuest=`SELECT count(*) FROM @post WHERE visibility=90 AND is_del=0`
_ShipIndex_IndexCountBySelf=`SELECT count(*) FROM @post WHERE is_del=0 AND (visibility=90 OR (visibility=0 AND user_id=?) OR (visibility=50 AND user_id IN (?)))`
_ShipIndex_IndexCountBySelf=`SELECT count(*) FROM @post WHERE is_del=0 AND (visibility=90 OR (visibility=0 AND user_id=?) OR (visibility=50 AND user_id IN (?)))`
_SimpleIndex_Index=`SELECT * FROM @post WHERE visibility=90 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_SimpleIndex_IndexCount=`SELECT count(*) FROM @post WHERE visibility=90`
_TrendsManager_CountIndexTrends=`SELECT count(*) FROM @user_relation r JOIN @user u ON r.he_uid=u.id JOIN @user_metric m ON r.he_uid=m.user_id WHERE r.user_id=? AND m.is_del=0 AND m.tweets_count>0`
_TrendsManager_GetIndexTrends=`SELECT u.username username, u.nickname nickname, u.avatar avatar FROM @user_relation r JOIN @user u ON r.he_uid=u.id JOIN @user_metric m ON r.he_uid=m.user_id WHERE r.user_id=? AND m.is_del=0 AND m.tweets_count>0 ORDER BY r.style ASC LIMIT ? OFFSET ?`
_TrendsManager_CountIndexTrends=`SELECT count(*) FROM @user_relation r JOIN @user u ON r.he_uid=u.id JOIN @user_metric m ON r.he_uid=m.user_id WHERE r.user_id=? AND m.is_del=0 AND m.tweets_count>0`
_TrendsManager_GetIndexTrends=`SELECT u.username username, u.nickname nickname, u.avatar avatar FROM @user_relation r JOIN @user u ON r.he_uid=u.id JOIN @user_metric m ON r.he_uid=m.user_id WHERE r.user_id=? AND m.is_del=0 AND m.tweets_count>0 ORDER BY r.style ASC LIMIT ? OFFSET ?`
_Tweet_CountFollowingTweets=`SELECT count(*) FROM @post WHERE user_id=? AND is_del=0`
_Tweet_CountFollowingTweetsFollow=`SELECT count(*) FROM @post WHERE (user_id=? OR (visibility>=60 AND user_id IN(?))) AND is_del=0`
_Tweet_CountFollowingTweetsFriend=`SELECT count(*) FROM @post WHERE (user_id=? OR (visibility>=50 AND user_id IN(?))) AND is_del=0`
@ -115,13 +115,13 @@ const (
_Tweet_GetPostById=`SELECT * FROM @post WHERE id=? AND is_del=0`
_Tweet_GetPostContentById=`SELECT * FROM @post_content WHERE id=? AND is_del=0`
_Tweet_GetPostContentsByIds=`SELECT * FROM @post_content WHERE post_id IN (?) AND is_del=0`
_Tweet_GetUserPostCollection=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.post_id = ? AND s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY P.ID DESC`
_Tweet_GetUserPostCollectionCount=`SELECT count(*) FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) )`
_Tweet_GetUserPostCollections=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY s.ID DESC, P.ID DESC LIMIT ? OFFSET ?`
_Tweet_GetUserPostCollection=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.post_id = ? AND s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY P.ID DESC`
_Tweet_GetUserPostCollectionCount=`SELECT count(*) FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) )`
_Tweet_GetUserPostCollections=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_collection s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY s.ID DESC, P.ID DESC LIMIT ? OFFSET ?`
_Tweet_GetUserPostCount=`SELECT count(*) FROM @post WHERE user_id=? AND visibility IN (?)`
_Tweet_GetUserPostStar=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.post_id = ? AND s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY P.ID DESC`
_Tweet_GetUserPostStarCount=`SELECT count(*) FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) )`
_Tweet_GetUserPostStars=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY s.ID DESC, P.ID DESC LIMIT ? OFFSET ?`
_Tweet_GetUserPostStar=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.post_id = ? AND s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY P.ID DESC`
_Tweet_GetUserPostStarCount=`SELECT count(*) FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) )`
_Tweet_GetUserPostStars=`SELECT s.*, P.ID "post.id", P.user_id "post.user_id", P.comment_count "post.comment_count", P.collection_count "post.collection_count", P.upvote_count "post.upvote_count", P.share_count "post.share_count", P.visibility "post.visibility", P.is_top "post.is_top", P.is_essence "post.is_essence", P.is_lock "post.is_lock", P.latest_replied_on "post.latest_replied_on", P.tags "post.tags", P.attachment_price "post.attachment_price", P.ip "post.ip", P.ip_loc "post.ip_loc", P.is_del "post.is_del", P.created_on "post.created_on", P.modified_on "post.modified_on", P.deleted_on "post.deleted_on" FROM @post_star s JOIN @post P ON s.post_id = P.ID WHERE s.user_id = ? AND s.is_del = 0 AND ( visibility >= 50 OR ( visibility = 0 AND P.user_id = ? ) ) ORDER BY s.ID DESC, P.ID DESC LIMIT ? OFFSET ?`
_Tweet_GetUserPosts=`SELECT * FROM @post WHERE user_id=? AND visibility IN (?) ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_TweetHelp_GetPostContentByIds=`SELECT id, post_id, content, type, sort FROM @post_content WHERE post_id IN (?) AND is_del=0`
_TweetHelp_GetUsersByIds=`SELECT id, username, nickname, status, avatar, is_admin FROM @user WHERE id IN (?) AND is_del=0`
@ -158,26 +158,26 @@ const (
_TweetMetrics_GetMotivationFactor=`SELECT motivation_factor FROM @post_metric WHERE post_id=? AND is_del=0`
_TweetMetrics_UpdateRankScore=`UPDATE @post_metric SET rank_score=?, modified_on=? WHERE post_id=? AND is_del=0`
_TweetMetrics_UpsertTweetMetric=`INSERT INTO @post_metric (post_id, rank_score, created_on) VALUES (?, ?, ?)`
_Tweet_UserCommentTweetsByFriend=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=50 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsByGuest=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=90 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsBySelf=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsByFriend=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=50 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsByGuest=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=90 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsBySelf=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserCommentTweetsCountByFriend=`SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=50`
_Tweet_UserCommentTweetsCountByGuest=`SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=? AND visibility>=90`
_Tweet_UserCommentTweetsCountBySelf=`SELECT count(*) FROM @post_by_comment WHERE is_del=0 AND comment_user_id=?`
_Tweet_UserMediaTweetsByFriend=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility>=50 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsByGuest=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility=90 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsBySelf=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsByFriend=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility>=50 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsByGuest=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility=90 ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsBySelf=`SELECT id, user_id, comment_count, collection_count, upvote_count, share_count, visibility, is_top, is_essence, is_lock, latest_replied_on, tags, attachment_price, ip, ip_loc, created_on, modified_on, deleted_on, is_del FROM @post_by_media WHERE is_del=0 AND user_id=? ORDER BY latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserMediaTweetsCountByFriend=`SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility>=50`
_Tweet_UserMediaTweetsCountByGuest=`SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=? AND visibility>=90`
_Tweet_UserMediaTweetsCountBySelf=`SELECT count(*) FROM @post_by_media WHERE is_del=0 AND user_id=?`
_Tweet_UserStarTweetsByAdmin=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByFriend=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=50 ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByGuest=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=90 ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsBySelf=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>90 OR (post.visibility>=90 AND post.user_id=?)) ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsCountByAdmin=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=?`
_Tweet_UserStarTweetsCountByFriend=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=50`
_Tweet_UserStarTweetsCountByGuest=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=90`
_Tweet_UserStarTweetsCountBySelf=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>90 OR (post.visibility>=90 AND post.user_id=?))`
_Tweet_UserStarTweetsByAdmin=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByFriend=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=50 ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsByGuest=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=90 ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsBySelf=`SELECT star.*, post.ID "post.id", post.created_on "post.created_on", post.modified_on "post.modified_on", post.deleted_on "post.deleted_on", post.is_del "post.is_del", post.user_id "post.user_id", post.comment_count "post.comment_count", post.collection_count "post.collection_count", post.share_count "post.share_count", post.upvote_count "post.upvote_count", post.visibility "post.visibility", post.is_top "post.is_top", post.is_essence "post.is_essence", post.is_lock "post.is_lock", post.latest_replied_on "post.latest_replied_on", post.tags "post.tags", post.attachment_price "post.attachment_price", post.ip "post.ip", post.ip_loc "post.ip_loc" FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>90 OR (post.visibility>=90 AND post.user_id=?)) ORDER BY post.latest_replied_on DESC LIMIT ? OFFSET ?`
_Tweet_UserStarTweetsCountByAdmin=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=?`
_Tweet_UserStarTweetsCountByFriend=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=50`
_Tweet_UserStarTweetsCountByGuest=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND post.visibility>=90`
_Tweet_UserStarTweetsCountBySelf=`SELECT count(*) FROM @post_star star JOIN @post post ON star.post_id = post.ID WHERE star.is_del=0 AND star.user_id=? AND (post.visibility<>90 OR (post.visibility>=90 AND post.user_id=?))`
_UserManage_GetAnyUsers=`SELECT * FROM @user WHERE is_del=0 ORDER BY id ASC limit 6`
_UserManage_GetRegisterUserCount=`SELECT count(*) FROM @user WHERE is_del=0`
@ -187,7 +187,7 @@ const (
_UserManage_GetUsersByIds=`SELECT * FROM @user WHERE id IN (?) AND is_del=0`
_UserManage_GetUsersByKeyword=`SELECT * FROM @user WHERE username LIKE ? AND is_del=0 limit 6`
_UserManage_UpdateUser=`UPDATE @user SET username=:username, nickname=:nickname, phone=:phone, password=:password, salt=:salt, status=:status, avatar=:avatar, balance=:balance, is_admin=:is_admin, modified_on=:modified_on WHERE id=? AND is_del=0`
_UserManage_UserProfileByName=`SELECT u.id, u.username, u.nickname, u.phone, u.status, u.avatar, u.balance, u.is_admin, u.created_on, m.tweets_count FROM @user u LEFT JOIN @user_metric m ON u.id=m.user_id WHERE u.username=? AND u.is_del=0`
_UserManage_UserProfileByName=`SELECT u.id, u.username, u.nickname, u.phone, u.status, u.avatar, u.balance, u.is_admin, u.created_on, m.tweets_count FROM @user u LEFT JOIN @user_metric m ON u.id=m.user_id WHERE u.username=? AND u.is_del=0`
_UserMetrics_AddUserMetric=`INSERT INTO @user_metric (user_id, created_on) VALUES (?, ?)`
_UserMetrics_DeleteUserMetric=`UPDATE @user_metric SET is_del=1, deleted_on=? WHERE user_id=? AND is_del=0`
_UserMetrics_GetTweetsCount=`SELECT tweets_count FROM @user_metric WHERE user_id=? AND is_del=0`
_CommentManage_HighlightComment=`UPDATE @comment SET is_essence=1-is_essence, modified_on=? WHERE id=? AND user_id=? AND is_del=0 RETURNING is_essence`
_CommentManage_HighlightComment=`UPDATE @comment SET is_essence=1-is_essence, modified_on=? WHERE id=? AND user_id=? AND is_del=0 RETURNING is_essence`
_Tweet_ListIndexHotsTweets=`SELECT post.* FROM @post post LEFT JOIN @post_metric metric ON post.id=metric.post_id WHERE post.visibility>=90 AND post.is_del=0 ORDER BY post.is_top DESC, metric.rank_score DESC NULLS LAST, post.latest_replied_on DESC LIMIT ? OFFSET ?`