Merge branch 'r/paopao-ce-plus' into r/paopao-ce-xtra

r/paopao-ce-xtra
Michael Li 1 year ago
commit 5ec836dcf5
No known key found for this signature in database

@ -72,10 +72,10 @@ 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=0 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=0 OR (visibility=1 AND user_id=?) OR (visibility=2 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=0 OR (visibility=1 AND user_id=?) OR (visibility=2 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=0 AND is_del=0`
_ShipIndex_IndexCountBySelf = `SELECT count(*) FROM @post WHERE is_del=0 AND (visibility=0 OR (visibility=1 AND user_id=?) OR (visibility=2 AND user_id IN ?))`
_ShipIndex_IndexCountBySelf = `SELECT count(*) FROM @post WHERE is_del=0 AND (visibility=0 OR (visibility=1 AND user_id=?) OR (visibility=2 AND user_id IN (?)))`
_SimpleIndex_Index = `SELECT * FROM @post WHERE visibility=0 ORDER BY is_top DESC, latest_replied_on DESC LIMIT ? OFFSET ?`
_SimpleIndex_IndexCount = `SELECT count(*) FROM @post WHERE visibility=0`
_Tweet_GetAnyPostCount = `SELECT count(*) FROM @post WHERE visibility IN (?)`

@ -88,14 +88,15 @@ func (s *topicSrvA) UpsertTags(userId int64, tags []string) (res cs.TagInfoList,
return
}
func (s *topicSrvA) DecrTagsById(ids []int64) error {
func (s *topicSrvA) DecrTagsById(ids []int64) (err error) {
if len(ids) == 0 {
return
}
return s.db.Withx(func(tx *sqlx.Tx) error {
var ids []int64
err := tx.InSelect(&ids, s.q.TagsByIdA, ids)
if err != nil {
return err
var newIds []int64
if err = tx.InSelect(&newIds, s.q.TagsByIdA, ids); err == nil {
_, err = tx.InExec(s.q.DecrTagsById, time.Now().Unix(), newIds)
}
_, err = tx.InExec(s.q.DecrTagsById, time.Now().Unix(), ids)
return err
})
}
@ -164,6 +165,9 @@ func (s *topicSrvA) StickTopic(userId int64, topicId int64) (res int8, err error
}
func (s *topicSrvA) tagsFormatA(userId int64, tags cs.TagList) (cs.TagList, error) {
if len(tags) == 0 {
return tags, nil
}
// 获取创建者User IDs
tagIds := []int64{}
for _, tag := range tags {

@ -353,7 +353,7 @@ FROM @post
WHERE is_del=0 AND
(visibility=0 OR
(visibility=1 AND user_id=?) OR
(visibility=2 AND user_id IN ?))
(visibility=2 AND user_id IN (?)))
ORDER BY is_top DESC, latest_replied_on DESC
LIMIT ? OFFSET ?;
@ -365,7 +365,7 @@ FROM @post
WHERE is_del=0 AND
(visibility=0 OR
(visibility=1 AND user_id=?) OR
(visibility=2 AND user_id IN ?));
(visibility=2 AND user_id IN (?)));
--------------------------------------------------------------------------------
-- simple_index sql dml

Loading…
Cancel
Save