Pārlūkot izejas kodu

任务修改为生产运行

kobe6258 8 mēneši atpakaļ
vecāks
revīzija
cec518ff04

+ 0 - 12
domian/task/task_service.go

@@ -10,15 +10,6 @@ type TaskDTO struct {
 	Detail   string
 }
 
-func InitTask(dto TaskDTO) (taskId int, err error) {
-	initTask := convertToTask(dto)
-	taskId, err = task.InitTask(initTask)
-	if err != nil {
-		logger.Error("创建任务记录失败:%v", err)
-		return
-	}
-	return
-}
 func InitAndStartTask(dto TaskDTO) (taskId int, err error) {
 	initTask := convertToTask(dto)
 	initTask.Status = task.StatusProcess
@@ -29,10 +20,7 @@ func InitAndStartTask(dto TaskDTO) (taskId int, err error) {
 	}
 	return
 }
-func StartTask(taskId int) {
-	task.UpdateTaskStatusById(taskId, task.StatusProcess)
 
-}
 func UpdateAndFailedTask(taskId int, detail string) {
 	task.UpdateDetailsAndStatusById(taskId, task.StatusFailed, detail)
 }

+ 62 - 0
eta_mini_ht_api/conf/app.conf

@@ -0,0 +1,62 @@
+appname = wechat
+httpport = 80
+run_mode = dev
+runmode = dev
+autorender = false
+copyrequestbody = true
+EnableDocs = true
+sqlconn =
+file.path="./conf"
+file.notice="海通小程序注册用户须知.txt"
+file.disclaimer="海通免责声明.txt"
+file.publicKey ="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAIwpWwsvZB2bZSSuFzjv5GE+spQdnd5sW2bDjnGM9hw8Zf1kXuOO2ThuokXgr0iHjQU5WHbrkcefUcvJmQ9NLJ0CAwEAAQ=="
+[dev]
+#系统配置
+
+#验证码长度
+auth.code.length=6
+#redis配置
+#redis.host = 192.168.77.130:6379,127.0.0.1:6379
+redis.host = 192.168.77.130:6379
+redis.password = ""
+redis.db = 0
+redis.maxidle = 50
+redis.maxactive = 100
+redis.timeout = 300
+
+#HT
+ht.es_report_index = "ht_test_report_v1"
+ht.es_media_index="ht_test_media_v1"
+ht.task="false"
+#ht.config_path="/home/code/config/eta_mini_ht_api/conf/app.conf"
+#ht.es_report_index = "report_index"
+#ht.es_media_index="media_index"
+ht.response.encode="false"
+ht.response.des_code="5filp4vSvLVQK8SLioNlKm3q"
+#wechat配置
+#wechat.appid = wx49f965502877530a
+#wechat.secret= eef0b899951d5d5074915e1f56c5e87a
+wechat.appid = wxcc4ac5526a578908
+wechat.secret= a289a3a3289e4ede54932216931ed16f
+#短信
+sms.sms_type = "juhe"
+sms.juhe.tlp_id="254663"
+sms.juhe.expire_minute=3
+sms.juhe.key="4c8504c49dd335e99cfd7b6a3a9e2415"
+sms.emas.url="root:199118@(localhost:3306)/emas?timeout=5000ms&readTimeout=5000ms&writeTimeout=5000ms&charset=utf8mb4&parseTime=true&loc=Local"
+sms.emas.expire_minute=3
+sms.emas.template="【期海通行】您的期海通行小程序验证码为:{{.Code}},请在{{.ExpireMinute}}分钟内完成验证。"
+#database配置
+database.driver = "mysql"
+database.url="hz_technology:hongze@2021@tcp(rm-uf67kg347rhjfep5c1o.mysql.rds.aliyuncs.com:3306)/test_eta_mini_master_ht?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true"
+#database.url="root:199118@tcp(localhost:3306)/wechat?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true"
+#eta数据库配置
+eta.database.url= "hz_technology:hongze@2021@tcp(rm-uf67kg347rhjfep5c1o.mysql.rds.aliyuncs.com:3306)/test_v2_hongze_rddp?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true"
+#钢联数据库配置
+gl.database.url= "hz_technology:hongze@2021@tcp(rm-uf67kg347rhjfep5c1o.mysql.rds.aliyuncs.com:3306)/test_eta_mini_master_ht?charset=utf8mb4&loc=Asia%2FShanghai&parseTime=true"
+#ES配置
+#es.url="http://192.168.77.130:9200"
+es.url="http://es-cn-nif227b580019rgw6.public.elasticsearch.aliyuncs.com:9200"
+es.username="elastic"
+es.password="hongze@2021"
+#es.password="DV=NPV7pTEbRJ4JnMNnt"

+ 57 - 0
eta_mini_ht_api/conf/log/log_config.json

@@ -0,0 +1,57 @@
+{
+  "filepath": "./etalogs",
+  "appenders": [
+    {
+      "type": "console",
+      "rotate": true,
+      "level": "info",
+      "color": true
+    },
+    {
+      "type": "file",
+      "filename": "file/error.log",
+      "maxlines": 1000000,
+      "maxsize": 268435456,
+      "daily": true,
+      "maxdays": 7,
+      "rotate": true,
+      "level": "error",
+      "color": true
+    },
+    {
+      "type": "file",
+      "filename": "file/info.log",
+      "maxlines": 1000000,
+      "maxsize": 268435456,
+      "daily": true,
+      "maxdays": 30,
+      "rotate": true,
+      "level": "info",
+      "color": true
+    },
+    {
+      "filter": "apiRequest",
+      "type": "file",
+      "filename": "api/api.log",
+      "maxlines": 1000000,
+      "maxsize": 268435456,
+      "daily": true,
+      "maxdays": 30,
+      "rotate": true,
+      "level": "info",
+      "color": true
+    },
+    {
+      "filter": "coin,orm....*",
+      "type": "file",
+      "filename": "db/db.log",
+      "maxlines": 1000000,
+      "maxsize": 268435456,
+      "daily": false,
+      "maxdays": 30,
+      "rotate": true,
+      "level": "info",
+      "color": true
+    }
+  ]
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
eta_mini_ht_api/conf/海通免责声明.txt


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
eta_mini_ht_api/conf/海通小程序注册用户须知.txt


BIN
eta_mini_ht_api/eta_mini_ht_api


+ 1 - 1
task/eta/author/eta_author_task.go

@@ -55,6 +55,6 @@ func convert(author eta.ReportAuthor) financial_analyst.FinancialAnalystDTO {
 	}
 }
 func init() {
-	authorTask := base.NewTask(taskName, cron, new(AuthorTask), base.DEV)
+	authorTask := base.NewTask(taskName, cron, new(AuthorTask), base.PROD)
 	base.RegisterTask(&authorTask)
 }

+ 1 - 1
task/message/notice_task.go

@@ -38,6 +38,6 @@ type NoticeTask struct {
 }
 
 func init() {
-	reportTask := base.NewTask(taskName, cron, new(NoticeTask), base.DEV)
+	reportTask := base.NewTask(taskName, cron, new(NoticeTask), base.PROD)
 	base.RegisterTask(&reportTask)
 }

+ 0 - 79
task/report/report_task.go

@@ -1,79 +0,0 @@
-package report
-
-//
-//import (
-//	"encoding/json"
-//	logger "eta/eta_mini_ht_api/common/component/log"
-//	"eta/eta_mini_ht_api/common/contants"
-//	"eta/eta_mini_ht_api/domian/report"
-//	"eta/eta_mini_ht_api/models/eta"
-//	"eta/eta_mini_ht_api/models/ht"
-//	"eta/eta_mini_ht_api/task/base"
-//	"sync"
-//)
-//
-//var (
-//	taskName base.TaskType = "ETAReportSyncTask"
-//	cron                   = "0/10 * * * * *"
-//)
-//
-//// Execute Task ETA取研报的数据
-//func (re *ReportTask) Execute(taskDetail *base.TaskDetail) error {
-//	logger.Info(contants.TaskFormat, "同步ETA研报库开始")
-//	var wg sync.WaitGroup
-//	wg.Add(2)
-//	//ETA报告
-//	go func() {
-//		defer wg.Done()
-//		id, err := report.GetETALatestReportId()
-//		var etaReportList []eta.ETAReport
-//		etaReportList, err = eta.GetETAReports(id)
-//		if err != nil {
-//			logger.Error("获取ETA研报列表失败:%v", err)
-//		}
-//		if len(etaReportList) > 0 {
-//			var list []byte
-//			list, err = json.Marshal(etaReportList)
-//			if err == nil {
-//				taskDetail.Content = string(list)
-//			}
-//			err = report.SyncETAReportList(etaReportList)
-//			if err != nil {
-//				logger.Error("同步ETA研报列表失败:%v", err)
-//			}
-//		}
-//		logger.Info(contants.TaskFormat, "同步ETA研报库结束")
-//	}()
-//	//HT报告
-//	go func() {
-//		defer wg.Done()
-//		id, err := report.GetHTLatestReportId()
-//		var htReportList []ht.HTReport
-//		htReportList, err = ht.GetHTReports(id)
-//		if err != nil {
-//			logger.Error("获取ETA研报列表失败:%v", err)
-//		}
-//		if len(htReportList) > 0 {
-//			var list []byte
-//			list, err = json.Marshal(htReportList)
-//			if err == nil {
-//				taskDetail.Content = string(list)
-//			}
-//			bool,err = report.SyncHTReportList(htReportList)
-//			if err != nil {
-//				logger.Error("同步ETA研报列表失败:%v", err)
-//			}
-//		}
-//		logger.Info(contants.TaskFormat, "同步ETA研报库结束")
-//	}()
-//	wg.Wait()
-//	return nil
-//}
-//
-//type ReportTask struct {
-//}
-//
-//func init() {
-//	reportTask := base.NewTask(taskName, cron, new(ReportTask), base.FORBIDDEN)
-//	base.RegisterTask(&reportTask)
-//}

+ 1 - 1
task/report/report_update_task.go

@@ -120,6 +120,6 @@ type ReportUpdateTask struct {
 }
 
 func init() {
-	reportTask := base.NewTask(updateTaskName, updateCron, new(ReportUpdateTask), base.DEV)
+	reportTask := base.NewTask(updateTaskName, updateCron, new(ReportUpdateTask), base.PROD)
 	base.RegisterTask(&reportTask)
 }

+ 1 - 1
task/sms/code_expired_task.go

@@ -26,6 +26,6 @@ type SMSTask struct {
 }
 
 func init() {
-	smsTask := base.NewTask(taskName, cron, new(SMSTask), base.DEV)
+	smsTask := base.NewTask(taskName, cron, new(SMSTask), base.PROD)
 	base.RegisterTask(&smsTask)
 }

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels