|
@@ -8,7 +8,6 @@ import (
|
|
"github.com/tealeg/xlsx"
|
|
"github.com/tealeg/xlsx"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
- "io"
|
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
"log"
|
|
"log"
|
|
mu "mfw/util"
|
|
mu "mfw/util"
|
|
@@ -28,6 +27,7 @@ import (
|
|
|
|
|
|
var (
|
|
var (
|
|
rpre = regexp.MustCompile("https://www.jianyu360.cn/article/content/")
|
|
rpre = regexp.MustCompile("https://www.jianyu360.cn/article/content/")
|
|
|
|
+ rpre1 = regexp.MustCompile("https://www.jianyu360.cn/article/bdprivate/")
|
|
rsuf = regexp.MustCompile("(.html).*")
|
|
rsuf = regexp.MustCompile("(.html).*")
|
|
AddSpiderCode = "sdxzbiddingsjzypc" // 新增bidding数据spider_code
|
|
AddSpiderCode = "sdxzbiddingsjzypc" // 新增bidding数据spider_code
|
|
)
|
|
)
|
|
@@ -623,9 +623,16 @@ func (jy *RepairRule) SearchJyurl() {
|
|
if jy.Method() == "POST" {
|
|
if jy.Method() == "POST" {
|
|
|
|
|
|
jyurl := jy.GetString("jyurl")
|
|
jyurl := jy.GetString("jyurl")
|
|
- jyurl = rpre.ReplaceAllString(jyurl, "")
|
|
|
|
- jyurl = rsuf.ReplaceAllString(jyurl, "")
|
|
|
|
- new_id := qu.CommonDecodeArticle("content", jyurl)[0]
|
|
|
|
|
|
+ new_id := ""
|
|
|
|
+ if strings.Contains(jyurl, "content") {
|
|
|
|
+ jyurl1 := rpre.ReplaceAllString(jyurl, "")
|
|
|
|
+ jyurl1 = rsuf.ReplaceAllString(jyurl1, "")
|
|
|
|
+ new_id = qu.CommonDecodeArticle("content", jyurl1)[0]
|
|
|
|
+ } else if strings.Contains(jyurl, "bdprivate") {
|
|
|
|
+ jyurl1 := rpre1.ReplaceAllString(jyurl, "")
|
|
|
|
+ jyurl1 = rsuf.ReplaceAllString(jyurl1, "")
|
|
|
|
+ new_id = qu.CommonDecodeArticle("bdprivate", jyurl1)[0]
|
|
|
|
+ }
|
|
qu.Debug(new_id)
|
|
qu.Debug(new_id)
|
|
if !mongodb.IsObjectIdHex(new_id) {
|
|
if !mongodb.IsObjectIdHex(new_id) {
|
|
jy.ServeJson(map[string]interface{}{
|
|
jy.ServeJson(map[string]interface{}{
|
|
@@ -1144,6 +1151,7 @@ func (jy *RepairRule) UpFileRecord() {
|
|
func (jy *RepairRule) UpFile() {
|
|
func (jy *RepairRule) UpFile() {
|
|
defer qu.Catch()
|
|
defer qu.Catch()
|
|
if jy.Method() == "POST" {
|
|
if jy.Method() == "POST" {
|
|
|
|
+ user := jy.GetSession("user").(map[string]interface{})
|
|
identity := jy.GetString("identity")
|
|
identity := jy.GetString("identity")
|
|
var id string
|
|
var id string
|
|
if len(identity) == 24 {
|
|
if len(identity) == 24 {
|
|
@@ -1180,12 +1188,12 @@ func (jy *RepairRule) UpFile() {
|
|
}
|
|
}
|
|
bt, _ := ioutil.ReadAll(res.Body)
|
|
bt, _ := ioutil.ReadAll(res.Body)
|
|
key := GetHashKey(bt) + TypeByExt(filename)
|
|
key := GetHashKey(bt) + TypeByExt(filename)
|
|
- b, err := OssPutObject(key, io.Reader(res.Body))
|
|
|
|
|
|
+ b, err := OssPutObject(key, bytes.NewReader(bt))
|
|
if b {
|
|
if b {
|
|
tmp := make(map[string]interface{})
|
|
tmp := make(map[string]interface{})
|
|
tmp["org_url"] = download
|
|
tmp["org_url"] = download
|
|
tmp["filename"] = filename
|
|
tmp["filename"] = filename
|
|
- tmp["ftype"] = TypeByExt(filename)
|
|
|
|
|
|
+ tmp["ftype"] = strings.Replace(TypeByExt(filename), ".", "", -1)
|
|
tmp["fid"] = key
|
|
tmp["fid"] = key
|
|
tmp["url"] = "oss"
|
|
tmp["url"] = "oss"
|
|
br := bytes.NewReader(bt)
|
|
br := bytes.NewReader(bt)
|
|
@@ -1225,7 +1233,7 @@ func (jy *RepairRule) UpFile() {
|
|
} else {
|
|
} else {
|
|
tmp := make(map[string]interface{})
|
|
tmp := make(map[string]interface{})
|
|
for i, att := range atts {
|
|
for i, att := range atts {
|
|
- tmp[strconv.Itoa(i)] = att
|
|
|
|
|
|
+ tmp[strconv.Itoa(i+1)] = att
|
|
}
|
|
}
|
|
attsMap["attachments"] = tmp
|
|
attsMap["attachments"] = tmp
|
|
}
|
|
}
|
|
@@ -1253,7 +1261,7 @@ func (jy *RepairRule) UpFile() {
|
|
jy.ServeJson(map[string]interface{}{
|
|
jy.ServeJson(map[string]interface{}{
|
|
"rep": true,
|
|
"rep": true,
|
|
})
|
|
})
|
|
- Mgo.Save("jy_upfile_log", bson.M{"infoid": id, "value": "上传附件", "createtime": time.Now().Unix()})
|
|
|
|
|
|
+ Mgo.Save("jy_upfile_log", bson.M{"infoid": id, "value": "上传附件", "createtime": time.Now().Unix(), "modifyuser": user["name"]})
|
|
|
|
|
|
} else {
|
|
} else {
|
|
_ = jy.Render("repair/jy_file_upload.html")
|
|
_ = jy.Render("repair/jy_file_upload.html")
|