baishaojie 1 år sedan
förälder
incheckning
48b5d9db93
3 ändrade filer med 11 tillägg och 2 borttagningar
  1. 2 0
      http/handle/api/scheduled.go
  2. 5 2
      http/handle/api/user.go
  3. 4 0
      service/user_service/user.go

+ 2 - 0
http/handle/api/scheduled.go

@@ -134,6 +134,8 @@ func CronScheduled(ctx context.Context) {
 	// //圣牧自动同步前天有进行中的任务
 	manualUdData(pastureinfo)
 
+	tx.Exec(` insert into saplog(pastureId,request,response,status,msgtext,createTime,msgtype,dataDate,url)
+	values(?,?,?,?,?,now(),?,?,?)`, pastureinfo.Pastureid, "1", "", "", "", 10, "1990-01-01", "https://wdc.unidairy.cn/copartner_uploads/")
 	//现代牧业sap同步
 	// xdmy := cron.New()
 	// xdmy.AddFunc("50 04 * * *", func() {

+ 5 - 2
http/handle/api/user.go

@@ -57,8 +57,11 @@ func Auth(c *gin.Context) {
 	}
 
 	if !isExist {
-		appG.Response(http.StatusInternalServerError, e.ERROR_AUTH, "")
-		return
+		isExist, err = authService.MD5Check()
+		if !isExist {
+			appG.Response(http.StatusInternalServerError, e.ERROR_AUTH, "")
+			return
+		}
 	}
 
 	token, err := util.GenerateToken(reqInfo.Username, reqInfo.Password)

+ 4 - 0
service/user_service/user.go

@@ -2,6 +2,7 @@ package user_service
 
 import (
 	"tmr-watch/http/handle/restful"
+	"tmr-watch/pkg/util"
 
 	"github.com/casbin/casbin"
 )
@@ -26,7 +27,10 @@ type User struct {
 
 func (a *User) Check() (bool, error) {
 	return restful.CheckUser(a.Username, a.Password)
+}
 
+func (a *User) MD5Check() (bool, error) {
+	return restful.CheckUser(a.Username, util.EncodeMD5(a.Password))
 }
 
 func (a *User) CheckFace() (bool, error) {