package routers import ( "fmt" "github.com/gin-gonic/gin" "wechathook/models" "wechathook/service" ) func GetSearch(c *gin.Context) { message := c.Query("message") result := service.SearchKeywordReplys(models.FindSetting("keywords").Value, message) finalReply := models.FindSetting("finalReply").Value replyTemplate := models.FindSetting("replyTemplate").Value if result == "" { result = finalReply } if replyTemplate != "" { result = fmt.Sprintf(replyTemplate, result) } c.String(200, result) }