🐛 时间超出int范围

This commit is contained in:
微凉
2020-12-26 18:11:17 +08:00
parent 52cddc431a
commit 4af469efed
9 changed files with 86 additions and 7 deletions

71
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,71 @@
name: Build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest]
go-version: [1.15]
name: Build
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Get dependencies
run: |
sudo apt-get update
sudo apt-get -y install gcc-mingw-w64-x86-64
sudo apt-get -y install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
sudo apt-get -y install gcc-aarch64-linux-gnu libc6-dev-arm64-cross
go get -v -t -d ./...
if [ -f Gopkg.toml ]; then
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
dep ensure
fi
- name: Build linux
run: |
CC=gcc CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o alist_linux_amd64 alist.go
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o alist_linux_arm64 alist.go
CC=arm-linux-gnueabihf-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -o alist_linux_arm alist.go
- name: Build windows
run: |
CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o alist_windows_amd64.exe alist.go
- name: Upload artifacts linux_amd64
uses: actions/upload-artifact@v2
with:
name: alist_linux_amd64
path: alist_linux_amd64
- name: Upload artifacts linux_arm64
uses: actions/upload-artifact@v2
with:
name: alist_linux_arm64
path: alist_linux_arm64
- name: Upload artifacts linux_arm
uses: actions/upload-artifact@v2
with:
name: alist_linux_arm
path: alist_linux_arm
- name: Upload artifacts windows_amd64
uses: actions/upload-artifact@v2
with:
name: alist_windows_amd64
path: alist_windows_amd64.exe

View File

@ -3,13 +3,14 @@
</p>
<p align="center">
<a href="https://github.com/Xhofe/alist/releases"><img src="https://img.shields.io/github/release/Xhofe/alist" alt="Release version"></a>
<a href="https://github.com/Xhofe/alist/actions?query=workflow%3ARelease"><img src="https://github.com/Xhofe/alist/workflows/Release/badge.svg" alt="Release status"></a>
<a href="https://github.com/Xhofe/alist/actions?query=workflow%3ABuild"><img src="https://github.com/Xhofe/alist/workflows/Build/badge.svg" alt="Build status"></a>
<a href="https://github.com/Xhofe/alist/releases"><img src="https://img.shields.io/github/downloads/Xhofe/alist/latest/total" alt="Downloads"></a>
<a href="https://github.com/Xhofe/alist/blob/main/LICENSE"><img src="https://img.shields.io/github/license/Xhofe/alist" alt="License"></a>
<a href="https://pay.xhofe.top">
<img src="https://img.shields.io/badge/%24-donate-ff69b4.svg" alt="donate">
</a>
</p>
---
### 这是什么?

View File

@ -175,6 +175,7 @@ func DoPost(url string,request interface{},auth bool) (body []byte, err error) {
if body, err = ioutil.ReadAll(resp.Body); err != nil {
log.Errorf("读取api返回内容失败")
}
log.Debugf("请求返回信息:%s",string(body))
return
}

View File

@ -18,8 +18,8 @@ type UserInfo struct {
DomainId string `json:"domain_id"`
UserId string `json:"user_id"`
Avatar string `json:"avatar"`
CreatedAt int `json:"created_at"`
UpdatedAt int `json:"updated_at"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Email string `json:"email"`
NickName string `json:"nick_name"`
Phone string `json:"phone"`
@ -66,8 +66,8 @@ type File struct {
ContentType string `json:"content_type"`
Crc64Hash string `json:"crc_64_hash"`
DownloadUrl string `json:"download_url"`
PunishFlag int `json:"punish_flag"`
Size int `json:"size"`
PunishFlag int64 `json:"punish_flag"`
Size int64 `json:"size"`
Thumbnail string `json:"thumbnail"`
Url string `json:"url"`
ImageMediaMetadata map[string]interface{} `json:"image_media_metadata"`

View File

@ -7,6 +7,7 @@ import (
)
func InitAliDrive() bool {
log.Infof("初始化阿里云盘...")
//首先token_login
if conf.Conf.AliDrive.RefreshToken == "" {
tokenLogin,err:=alidrive.TokenLogin()

View File

@ -2,9 +2,11 @@ package bootstrap
import (
"github.com/Xhofe/alist/conf"
log "github.com/sirupsen/logrus"
"net/http"
)
func InitClient() {
log.Infof("初始化client...")
conf.Client=&http.Client{}
}

View File

@ -39,11 +39,11 @@ func printASC() {
func start() {
InitLog()
printASC()
InitClient()
if !ReadConf(conf.Con) {
log.Errorf("读取配置文件时出现错误,启动失败.")
return
}
InitClient()
if !InitAliDrive() {
log.Errorf("初始化阿里云盘出现错误,启动失败.")
return
@ -54,9 +54,9 @@ func start() {
func server() {
baseServer:="0.0.0.0:"+conf.Conf.Server.Port
log.Infof("Starting server @ %s",baseServer)
r:=gin.Default()
serv.InitRouter(r)
log.Infof("Starting server @ %s",baseServer)
err:=r.Run(baseServer)
if err!=nil {
log.Errorf("Server failed start:%s",err.Error())

View File

@ -9,6 +9,7 @@ import (
)
func ReadConf(config string) bool {
log.Infof("读取配置文件...")
if !utils.Exists(config) {
log.Infof("找不到配置文件:%s",config)
return false

View File

@ -4,9 +4,11 @@ import (
"github.com/Xhofe/alist/conf"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus"
)
func InitRouter(engine *gin.Engine) {
log.Infof("初始化路由...")
engine.Use(CrosHandler())
InitApiRouter(engine)
}