|
@@ -1,20 +1,11 @@
|
1
|
1
|
package main
|
2
|
2
|
|
3
|
3
|
import (
|
4
|
|
- //"context"
|
5
|
|
- "fmt"
|
6
|
|
- "gdyb/models"
|
7
|
4
|
_ "gdyb/routers"
|
8
|
5
|
//"gdyb/service"
|
9
|
6
|
"github.com/astaxie/beego"
|
10
|
7
|
//"github.com/qiniu/api.v7/auth/qbox"
|
11
|
8
|
//"github.com/qiniu/api.v7/storage"
|
12
|
|
-
|
13
|
|
- //"github.com/qiniu/api.v7/auth/qbox"
|
14
|
|
- //"github.com/qiniu/api.v7/storage"
|
15
|
|
- "os"
|
16
|
|
- "strconv"
|
17
|
|
- "time"
|
18
|
9
|
)
|
19
|
10
|
|
20
|
11
|
func init() {
|
|
@@ -786,38 +777,38 @@ type ResultSeventeen struct {
|
786
|
777
|
// }
|
787
|
778
|
//}
|
788
|
779
|
|
789
|
|
-func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
|
790
|
|
- Mkdir(miConfig.OrgName + "日志")
|
791
|
|
- //org_id,_ := beego.AppConfig.Int("org_id")
|
792
|
|
- month := time.Unix(1557042972, 0).Format("1")
|
793
|
|
- year := time.Now().Format("2006")
|
794
|
|
- month = time.Now().Format("01")
|
795
|
|
- day := time.Now().Format("02")
|
796
|
|
- file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
|
797
|
|
- file_name := file + ".txt"
|
798
|
|
- file_path := miConfig.OrgName + "日志" + "/" + file_name
|
799
|
|
- exist, _ := PathExists(file_path)
|
800
|
|
- if exist { //存在
|
801
|
|
- fmt.Println("存在")
|
802
|
|
- f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
|
803
|
|
- if err != nil {
|
804
|
|
- fmt.Println("read fail")
|
805
|
|
- }
|
806
|
|
- content := "\r\r\r"
|
807
|
|
- n, _ := f.Seek(0, 2)
|
808
|
|
- _, err = f.WriteAt([]byte(content), n)
|
809
|
|
-
|
810
|
|
- } else { //不存在
|
811
|
|
- fmt.Println("文件不存在,创建文件")
|
812
|
|
- f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
|
813
|
|
- defer f.Close()
|
814
|
|
- if err != nil {
|
815
|
|
- } else {
|
816
|
|
- _, err = f.Write([]byte("记录日志"))
|
817
|
|
- }
|
818
|
|
- }
|
819
|
|
-
|
820
|
|
-}
|
|
780
|
+//func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
|
|
781
|
+// Mkdir(miConfig.OrgName + "日志")
|
|
782
|
+// //org_id,_ := beego.AppConfig.Int("org_id")
|
|
783
|
+// month := time.Unix(1557042972, 0).Format("1")
|
|
784
|
+// year := time.Now().Format("2006")
|
|
785
|
+// month = time.Now().Format("01")
|
|
786
|
+// day := time.Now().Format("02")
|
|
787
|
+// file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
|
|
788
|
+// file_name := file + ".txt"
|
|
789
|
+// file_path := miConfig.OrgName + "日志" + "/" + file_name
|
|
790
|
+// exist, _ := PathExists(file_path)
|
|
791
|
+// if exist { //存在
|
|
792
|
+// fmt.Println("存在")
|
|
793
|
+// f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
|
|
794
|
+// if err != nil {
|
|
795
|
+// fmt.Println("read fail")
|
|
796
|
+// }
|
|
797
|
+// content := "\r\r\r"
|
|
798
|
+// n, _ := f.Seek(0, 2)
|
|
799
|
+// _, err = f.WriteAt([]byte(content), n)
|
|
800
|
+//
|
|
801
|
+// } else { //不存在
|
|
802
|
+// fmt.Println("文件不存在,创建文件")
|
|
803
|
+// f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
|
|
804
|
+// defer f.Close()
|
|
805
|
+// if err != nil {
|
|
806
|
+// } else {
|
|
807
|
+// _, err = f.Write([]byte("记录日志"))
|
|
808
|
+// }
|
|
809
|
+// }
|
|
810
|
+//
|
|
811
|
+//}
|
821
|
812
|
|
822
|
813
|
//func UploadLog(miConfig models.MedicalInsuranceOrgConfig) {
|
823
|
814
|
// //获取七牛云上的文件信息,不存在则表示没上传到七牛云,上传昨天日志信息
|