no message

master
zcy 2020-11-12 12:08:22 +08:00
parent 077ddffa99
commit e762767234
8 changed files with 57 additions and 30 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"vue3snippets.enable-compile-vue-file-on-did-save-code": false
}

View File

@ -6,4 +6,4 @@
前端采用vue+iview框架
#### 安装教程
#### how to use?

7
controller/data.go Normal file
View File

@ -0,0 +1,7 @@
package controller
type RespBase struct {
Msg string
Status int
Data interface{}
}

View File

@ -1,11 +1,12 @@
package controller
import (
"background/config"
"background/db"
"bufio"
"bytes"
"errors"
"fmt"
"github.com/gin-gonic/gin"
"io/ioutil"
"log"
"net/smtp"
@ -14,8 +15,8 @@ import (
"strings"
"text/template"
"time"
"background/config"
"background/db"
"github.com/gin-gonic/gin"
)
type MailController struct {

37
controller/openapi.go Normal file
View File

@ -0,0 +1,37 @@
package controller
import (
"log"
"github.com/gin-gonic/gin"
)
type OpenApiController struct {
}
type DiffRequest struct {
Origin string `json:"origin"`
New string `json:"new"`
}
//from: 发送人邮箱
//to:接收邮件,可以是"290198252@qq.com;29019822@qq.com;2901982@qq.com" 邮箱之间用分号隔开
//template:模板名字
//content :网页模板的参数 key-value结构
//temp_data 模板内具体要替换的变量名字 Key-value结构
//generate 是否生成静态html
func (this *OpenApiController) OndiffCallback(c *gin.Context) {
var req DiffRequest
var resp RespBase
defer func() {
c.JSON(200, resp)
}()
e := c.Bind(&req)
if e != nil {
log.Println(e.Error())
resp.Msg = "ParaErr"
return
}
resp.Msg = "OK"
}

View File

@ -41,11 +41,6 @@ type SetUserGroupReq struct {
GroupName string `json:"group_name"`
UserIds []int `json:"user_ids"`
}
type RespBase struct {
Msg string
Status int
Data interface{}
}
func (this *UserController) Auth(c *gin.Context) {
var resp RespBase

View File

@ -1,18 +1 @@
package controller
import "github.com/gin-gonic/gin"
type WebHookController struct {
}
func (this *WebHookController) PushHook(c *gin.Context) {
resp := RespBase{"unkown error",-231,nil}
defer func() {
c.JSON(200,resp)
}()
repo := c.Param("repo")
if "" == repo{
return
}
}

View File

@ -97,7 +97,7 @@ func main() {
InitLogs()
InitRedisConfig()
InitMysql()
InitElasticSearch()
//InitElasticSearch()
//o := db.GetMongoDb()
//mgo = mgo
@ -172,9 +172,10 @@ func main() {
api.GET("doc_versions", nil) // 获取文章的某个版本
}
hookapi := r.Group("hookapi")
openapi := r.Group("openapi")
{
hookapi.POST("/push_hook/:repo", webhookController.PushHook)
openapi.POST("/diff")
}
e := r.Run(":" + strconv.Itoa(config.GetPort()))
if nil != e {