Selaa lähdekoodia

Merge branch 'cygx_need_p1_781' of http://8.136.199.33:3000/hongze/hongze_open_api

xingzai 1 vuosi sitten
vanhempi
commit
47efc9b338

+ 1 - 1
controllers/chart.go

@@ -3,7 +3,7 @@ package controllers
 import (
 	"encoding/json"
 	"hongze/hongze_open_api/models/request/chart"
-	celuePushTable "hongze/hongze_open_api/models/tables/cygx_chart"
+	celuePushTable "hongze/hongze_open_api/models/tables/cygx/cygx_chart"
 	"hongze/hongze_open_api/utils"
 	"time"
 )

+ 1 - 1
controllers/report.go

@@ -6,7 +6,7 @@ import (
 	"hongze/hongze_open_api/logic"
 	"hongze/hongze_open_api/models/request/article"
 	"hongze/hongze_open_api/models/response/report"
-	celuePushTable "hongze/hongze_open_api/models/tables/article"
+	celuePushTable "hongze/hongze_open_api/models/tables/cygx/article"
 	"hongze/hongze_open_api/models/tables/rddp/classify"
 	tables "hongze/hongze_open_api/models/tables/report"
 	"hongze/hongze_open_api/models/tables/wx_user"

+ 15 - 1
controllers/yidong.go

@@ -5,7 +5,8 @@ import (
 	"fmt"
 	"hongze/hongze_open_api/models/request/yidong"
 	"hongze/hongze_open_api/models/tables/company_product"
-	cygxActivity "hongze/hongze_open_api/models/tables/cygx_activity"
+	cygxActivity "hongze/hongze_open_api/models/tables/cygx/cygx_activity"
+	"hongze/hongze_open_api/models/tables/cygx/cygx_three_api_log"
 	"hongze/hongze_open_api/services/alarm_msg"
 	servicesYidong "hongze/hongze_open_api/services/yidong"
 	"hongze/hongze_open_api/utils"
@@ -400,5 +401,18 @@ func (c *YiDongController) UserCheck() {
 	if total > 0 {
 		resp.Haspermission = true
 	}
+	//添加请求日志记录
+	itemApiLog := new(cygx_three_api_log.CygxThreeApiLog)
+	itemApiLog.CreateTime = time.Now()
+	itemApiLog.Source = 2
+	itemApiLog.Url = c.Ctx.Input.URI()
+	data, _ := json.Marshal(req)
+	jsonstr := string(data)
+	itemApiLog.Body = fmt.Sprint(jsonstr, "deMobile=", deMobile)
+	itemApiLog.Result = fmt.Sprint(resp)
+	_, errlog := cygx_three_api_log.AddCygxThreeApiLog(itemApiLog)
+	if errlog != nil {
+		go alarm_msg.SendAlarmMsg("易董校验用户是否有对应权限日志记录失败 AddCygxThreeApiLog:"+errlog.Error()+fmt.Sprint(req, "deMobile=", deMobile), 3)
+	}
 	c.OkDetailed(resp, "获取成功")
 }

+ 5 - 3
models/db_init.go

@@ -5,11 +5,12 @@ import (
 	_ "github.com/go-sql-driver/mysql"
 	"hongze/hongze_open_api/models/tables"
 	"hongze/hongze_open_api/models/tables/admin"
-	"hongze/hongze_open_api/models/tables/article"
 	"hongze/hongze_open_api/models/tables/company"
 	"hongze/hongze_open_api/models/tables/company_product"
-	"hongze/hongze_open_api/models/tables/cygx_activity"
-	"hongze/hongze_open_api/models/tables/cygx_chart"
+	"hongze/hongze_open_api/models/tables/cygx/article"
+	"hongze/hongze_open_api/models/tables/cygx/cygx_activity"
+	"hongze/hongze_open_api/models/tables/cygx/cygx_chart"
+	"hongze/hongze_open_api/models/tables/cygx/cygx_three_api_log"
 	"hongze/hongze_open_api/models/tables/day_new"
 	"hongze/hongze_open_api/models/tables/open_api_user"
 	"hongze/hongze_open_api/models/tables/qs_event"
@@ -46,6 +47,7 @@ func init() {
 		new(cygx_activity.CygxYidongActivitySignupLog),     //易董报名记录日志
 		new(cygx_activity.CygxYidongActivityExamineStatus), //易董审核记录日志
 		new(cygx_activity.CygxMySchedule),                  //易董审核通过之后添加我的日程
+		new(cygx_three_api_log.CygxThreeApiLog),            //易董审核通过之后添加我的日程
 	)
 	orm.Debug = true
 	orm.DebugLog = orm.NewLog(utils.Binlog)

+ 0 - 0
models/tables/article/cygx_article_celue_push.go → models/tables/cygx/article/cygx_article_celue_push.go


+ 0 - 0
models/tables/cygx_activity/cygx_activity.go → models/tables/cygx/cygx_activity/cygx_activity.go


+ 0 - 0
models/tables/cygx_chart/cygx_chart_celue_push.go → models/tables/cygx/cygx_chart/cygx_chart_celue_push.go


+ 22 - 0
models/tables/cygx/cygx_three_api_log/cygx_three_api_log.go

@@ -0,0 +1,22 @@
+package cygx_three_api_log
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+type CygxThreeApiLog struct {
+	Id         int       `orm:"column(id);pk"`
+	Url        string    `description:"链接"`
+	Body       string    `description:"请求参数"`
+	Result     string    `description:"返回参数"`
+	CreateTime time.Time `description:"活动模板,带P标签"`
+	Source     int       `description:"来源1,易董"`
+}
+
+// 添加日志记录
+func AddCygxThreeApiLog(item *CygxThreeApiLog) (lastId int64, err error) {
+	o := orm.NewOrm()
+	lastId, err = o.Insert(item)
+	return
+}