@@ -49,14 +49,29 @@ func (self TopicLogic) Publish(ctx context.Context, me *model.Me, form url.Value
49
49
50
50
_ , err = self .Modify (ctx , me , form )
51
51
if err != nil {
52
- objLog .Errorln ("Publish Topic modif error:" , err )
52
+ objLog .Errorln ("Publish Topic modify error:" , err )
53
53
return
54
54
}
55
55
56
56
nid := goutils .MustInt (form .Get ("nid" ))
57
- if nid != topic .Nid {
58
- DefaultFeed .modifyTopicNode (tid , nid )
59
- }
57
+
58
+ go func () {
59
+ // 不是作者自己修改,且是调整节点,扣除铜币
60
+ if topic .Uid != me .Uid && topic .Nid != nid {
61
+ node := DefaultNode .FindOne (nid )
62
+ award := - 500
63
+ if node .ShowIndex {
64
+ award = - 30
65
+ }
66
+ desc := fmt .Sprintf (`主题节点被管理员调整为 <a href="/go/%s">%s</a>` , node .Ename , node .Name )
67
+ user := DefaultUser .FindOne (ctx , "uid" , topic .Uid )
68
+ DefaultUserRich .IncrUserRich (user , model .MissionTypeModify , award , desc )
69
+ }
70
+
71
+ if nid != topic .Nid {
72
+ DefaultFeed .modifyTopicNode (tid , nid )
73
+ }
74
+ }()
60
75
} else {
61
76
usernames := form .Get ("usernames" )
62
77
form .Del ("usernames" )
@@ -392,7 +407,7 @@ func (TopicLogic) FindHotNodes(ctx context.Context) []map[string]interface{} {
392
407
return nil
393
408
}
394
409
395
- nids := make ([]int , 0 , hotNum )
410
+ nids := make ([]int , 0 , 15 )
396
411
for rows .Next () {
397
412
var nid , topicnum int
398
413
err = rows .Scan (& nid , & topicnum )
@@ -407,7 +422,8 @@ func (TopicLogic) FindHotNodes(ctx context.Context) []map[string]interface{} {
407
422
nodes := make ([]map [string ]interface {}, 0 , hotNum )
408
423
409
424
topicNodes := GetNodesByNids (nids )
410
- for _ , topicNode := range topicNodes {
425
+ for _ , nid := range nids {
426
+ topicNode := topicNodes [nid ]
411
427
if ! topicNode .ShowIndex {
412
428
continue
413
429
}
0 commit comments