You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
778 B
33 lines
778 B
package dao |
|
|
|
import ( |
|
"context" |
|
"fmt" |
|
|
|
"go-common/app/admin/main/reply/model" |
|
"go-common/library/log" |
|
) |
|
|
|
type event struct { |
|
Action string `json:"action"` |
|
Mid int64 `json:"mid"` |
|
Subject *model.Subject `json:"subject"` |
|
Reply *model.Reply `json:"reply"` |
|
Report *model.Report `json:"report,omitempty"` |
|
} |
|
|
|
// PubEvent pub reply event. |
|
func (d *Dao) PubEvent(c context.Context, action string, mid int64, sub *model.Subject, rp *model.Reply, report *model.Report) error { |
|
e := &event{ |
|
Action: action, |
|
Mid: mid, |
|
Subject: sub, |
|
Reply: rp, |
|
Report: report, |
|
} |
|
if sub == nil { |
|
log.Error("PubEvent failed,sub is nil!value: %v %v %v %v", action, mid, rp, report) |
|
return nil |
|
} |
|
return d.eventBus.Send(c, fmt.Sprint(sub.Oid), &e) |
|
}
|
|
|