🐛 fixed comment reply list bug
This commit is contained in:
8
.idea/GOHCache.xml
generated
8
.idea/GOHCache.xml
generated
@@ -1751,7 +1751,7 @@
|
||||
<entry key="file://$PROJECT_DIR$/app/core/api/internal/middleware/casbinverify_middleware.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1731933523737" />
|
||||
<option name="lastModified" value="1732502377314" />
|
||||
<option name="schema">
|
||||
<list>
|
||||
<option value="CasbinVerifyMiddleware" />
|
||||
@@ -1775,7 +1775,7 @@
|
||||
<entry key="file://$PROJECT_DIR$/app/core/api/internal/svc/service_context.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1732275098629" />
|
||||
<option name="lastModified" value="1732502377305" />
|
||||
<option name="schema">
|
||||
<list>
|
||||
<option value="ServiceContext" />
|
||||
@@ -1878,7 +1878,7 @@
|
||||
<entry key="file://$PROJECT_DIR$/app/core/api/repository/casbinx/casbin.go">
|
||||
<value>
|
||||
<ScannedPath>
|
||||
<option name="lastModified" value="1732159281356" />
|
||||
<option name="lastModified" value="1732502718747" />
|
||||
</ScannedPath>
|
||||
</value>
|
||||
</entry>
|
||||
@@ -2477,6 +2477,6 @@
|
||||
<entry key="wechat_callback_logic" value="WechatCallbackLogic" />
|
||||
</map>
|
||||
</option>
|
||||
<option name="lastTimeChecked" value="1732450867228" />
|
||||
<option name="lastTimeChecked" value="1732555132343" />
|
||||
</component>
|
||||
</project>
|
@@ -66,7 +66,7 @@ func (l *GetReplyListLogic) GetReplyList(req *types.ReplyListRequest) (resp *typ
|
||||
replyUser.Nickname.As("reply_nickname"),
|
||||
).LeftJoin(commentUser, reply.UserID.EqCol(commentUser.UID)).
|
||||
LeftJoin(replyUser, reply.ReplyUser.EqCol(replyUser.UID)).
|
||||
Where(reply.TopicID.Eq(req.TopicId), reply.CommentType.Eq(constant.REPLY)).
|
||||
Where(reply.TopicID.Eq(req.TopicId), reply.ReplyID.Eq(req.CommentId), reply.CommentType.Eq(constant.REPLY)).
|
||||
Order(reply.Likes.Desc(), reply.CreatedAt.Desc()).
|
||||
ScanByPage(&replyQueryList, (req.Page-1)*req.Size, req.Size)
|
||||
if err != nil {
|
||||
|
@@ -10,11 +10,11 @@ import (
|
||||
)
|
||||
|
||||
type CasbinVerifyMiddleware struct {
|
||||
casbin *casbin.CachedEnforcer
|
||||
casbin *casbin.SyncedCachedEnforcer
|
||||
session *redisstore.RedisStore
|
||||
}
|
||||
|
||||
func NewCasbinVerifyMiddleware(casbin *casbin.CachedEnforcer, session *redisstore.RedisStore) *CasbinVerifyMiddleware {
|
||||
func NewCasbinVerifyMiddleware(casbin *casbin.SyncedCachedEnforcer, session *redisstore.RedisStore) *CasbinVerifyMiddleware {
|
||||
return &CasbinVerifyMiddleware{
|
||||
casbin: casbin,
|
||||
session: session,
|
||||
|
@@ -35,7 +35,7 @@ type ServiceContext struct {
|
||||
MongoClient *mongo.Database
|
||||
Session *redisstore.RedisStore
|
||||
Ip2Region *xdb.Searcher
|
||||
CasbinEnforcer *casbin.CachedEnforcer
|
||||
CasbinEnforcer *casbin.SyncedCachedEnforcer
|
||||
WechatPublic *officialAccount.OfficialAccount
|
||||
Sensitive *sensitive.Manager
|
||||
RotateCaptcha rotate.Captcha
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// NewCasbin creates a new casbinx enforcer with a mysql adapter and loads the policy from the file system.
|
||||
func NewCasbin(engine *gorm.DB) *casbin.CachedEnforcer {
|
||||
func NewCasbin(engine *gorm.DB) *casbin.SyncedCachedEnforcer {
|
||||
a, err := gormadapter.NewAdapterByDBUseTableName(engine, "sca_auth_", "permission_rule")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -25,12 +25,11 @@ func NewCasbin(engine *gorm.DB) *casbin.CachedEnforcer {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
e, err := casbin.NewCachedEnforcer(modelFile, a)
|
||||
e, err := casbin.NewSyncedCachedEnforcer(modelFile, a)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
e.EnableCache(true)
|
||||
e.SetExpireTime(60 * 60)
|
||||
err = e.LoadPolicy()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
Reference in New Issue
Block a user