Commit 348b56ab by 周业恒

Update upload.go

parent 50ae7908
Pipeline #15358 passed with stages
in 39 seconds
......@@ -6,6 +6,10 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/astaxie/beego/orm"
"github.com/rocketlaunchr/go-pool"
"github.com/xxjwxc/gowp/workpool"
"image"
"image/jpeg"
"image/png"
......@@ -22,19 +26,15 @@ import (
"regexp"
"strconv"
"strings"
"sync"
"time"
"github.com/aliyun/aliyun-oss-go-sdk/oss"
"github.com/astaxie/beego/orm"
"github.com/rocketlaunchr/go-pool"
"github.com/xxjwxc/gowp/workpool"
)
var (
WEBURL string = "http://offcn-live-svc"
//WEBURL string = "https://live.offcncloud.com"
client *http.Client
token string
//WEBURL string = "https://test-live.offcncloud.com"
once sync.Once
syncPool pool.Pool
)
const docUrl string = "http://doc.offcncloud.com/"
......@@ -335,13 +335,13 @@ func webToken() (*http.Client, string, error) {
if err != nil {
return &http.Client{}, "", err
}
log.Println("获取token == ", map2)
if _, ok := map2["code"]; !ok {
return &http.Client{}, "", errors.New("登录失败")
}
if _, ok := map2["code"].(float64); !ok {
return &http.Client{}, "", errors.New("登录失败")
}
if int(map2["code"].(float64)) == 200 {
//登录成功获取token
t_res, err := client.Get(WEBURL + "/web/admin")
......@@ -460,6 +460,7 @@ func CreateFileDataBase(room_file map[string]interface{}) error {
log.Println(err)
return err
}
log.Println("room_files response = ", map2)
if _, ok := map2["code"]; !ok {
......@@ -526,6 +527,7 @@ func pdfThumbnail(objectPath string, file *zip.File, bucket *oss.Bucket) ([]inte
defer fc1.Close()
return imageInfo, bucket.PutObject(objectPathName+fileName, fc1)
}
func uploadPacked(bucket *oss.Bucket, filename, contentHash,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment