|
@@ -53,18 +53,18 @@ func SyncRankingFromDalianSearch(dayNum int) (err error) {
|
|
|
endDate := time.Now().AddDate(0, 0, -dayNum).Format(utils.FormatDateTime)
|
|
|
//endDate := time.Now().Format(utils.FormatDateTime)
|
|
|
timeDate := utils.StrTimeToTime(endDate)
|
|
|
- currDate := timeDate.Format(utils.FormatDateUnSpace)
|
|
|
- year := timeDate.Year()
|
|
|
- month := timeDate.Format("01")
|
|
|
- var dayStr string
|
|
|
- day := timeDate.Day()
|
|
|
- if day < 10 {
|
|
|
- dayStr = "0" + strconv.Itoa(day)
|
|
|
- } else {
|
|
|
- dayStr = strconv.Itoa(day)
|
|
|
- }
|
|
|
- monthNum, _ := strconv.Atoi(month)
|
|
|
- month = strconv.Itoa(monthNum - 1) //获取时月份需要减一
|
|
|
+ //currDate := timeDate.Format(utils.FormatDateUnSpace)
|
|
|
+ //year := timeDate.Year()
|
|
|
+ //month := timeDate.Format("01")
|
|
|
+ //var dayStr string
|
|
|
+ //day := timeDate.Day()
|
|
|
+ //if day < 10 {
|
|
|
+ // dayStr = "0" + strconv.Itoa(day)
|
|
|
+ //} else {
|
|
|
+ // dayStr = strconv.Itoa(day)
|
|
|
+ //}
|
|
|
+ //monthNum, _ := strconv.Atoi(month)
|
|
|
+ //month = strconv.Itoa(monthNum - 1) //获取时月份需要减一
|
|
|
list, err := models.GetBaseFromTradeDalianDataList(timeDate.Format(utils.FormatDate))
|
|
|
if err != nil {
|
|
|
fmt.Println(err)
|
|
@@ -76,24 +76,24 @@ func SyncRankingFromDalianSearch(dayNum int) (err error) {
|
|
|
}
|
|
|
|
|
|
var ContractId string
|
|
|
- var CarietyCode string
|
|
|
+ //var CarietyCode string
|
|
|
var VarietyName string
|
|
|
//模拟form表单请求
|
|
|
url := "http://www.dce.com.cn/publicweb/quotesdata/memberDealPosiQuotes.html"
|
|
|
method := "POST"
|
|
|
payload := &bytes.Buffer{}
|
|
|
writer := multipart.NewWriter(payload)
|
|
|
- _ = writer.WriteField("memberDealPosiQuotes.variety", CarietyCode)
|
|
|
+ _ = writer.WriteField("memberDealPosiQuotes.variety", "c")
|
|
|
_ = writer.WriteField("memberDealPosiQuotes.trade_type", "0")
|
|
|
- _ = writer.WriteField("year", strconv.Itoa(year))
|
|
|
- _ = writer.WriteField("month", month)
|
|
|
- _ = writer.WriteField("day", dayStr)
|
|
|
- _ = writer.WriteField("contract.contract_id", ContractId)
|
|
|
- _ = writer.WriteField("contract.variety_id", CarietyCode)
|
|
|
- _ = writer.WriteField("currDate", currDate)
|
|
|
+ _ = writer.WriteField("year", strconv.Itoa(2024))
|
|
|
+ _ = writer.WriteField("month", "4")
|
|
|
+ _ = writer.WriteField("day", "10")
|
|
|
+ _ = writer.WriteField("contract.contract_id", "c2405")
|
|
|
+ _ = writer.WriteField("contract.variety_id", "c")
|
|
|
+ //_ = writer.WriteField("currDate", currDate)
|
|
|
err = writer.Close()
|
|
|
if err != nil {
|
|
|
- utils.FileLog.Info("获取指标失败:" + currDate + VarietyName + ContractId)
|
|
|
+ utils.FileLog.Info("获取指标失败:" + VarietyName + ContractId)
|
|
|
return err
|
|
|
}
|
|
|
client := &http.Client{}
|
|
@@ -112,7 +112,7 @@ func SyncRankingFromDalianSearch(dayNum int) (err error) {
|
|
|
defer res.Body.Close()
|
|
|
body, err := ioutil.ReadAll(res.Body)
|
|
|
if err != nil {
|
|
|
- msg := "失败提醒" + "RefreshDataFromDalian ErrMsg:" + err.Error() + "获取指标失败:" + currDate + VarietyName + ContractId
|
|
|
+ msg := "失败提醒" + "RefreshDataFromDalian ErrMsg:" + err.Error() + "获取指标失败:" + VarietyName + ContractId
|
|
|
go alarm_msg.SendAlarmMsg(msg, 3)
|
|
|
//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "RefreshDataFromDalian ErrMsg:"+err.Error()+"获取指标失败:"+currDate+VarietyName+ContractId, utils.EmailSendToUsers)
|
|
|
return err
|
|
@@ -274,7 +274,9 @@ func DoHtml(body, name, contractId string, dateTime time.Time, listDataMap map[s
|
|
|
tdText := td.Text()
|
|
|
tdText = strings.Replace(tdText, "(代客)", "", -1)
|
|
|
if tk == 0 { //名次
|
|
|
- rank = tdText
|
|
|
+ if tdText != " " {
|
|
|
+ rank = tdText
|
|
|
+ }
|
|
|
}
|
|
|
if tk == 1 { //会员简称
|
|
|
shortName = tdText
|
|
@@ -285,6 +287,11 @@ func DoHtml(body, name, contractId string, dateTime time.Time, listDataMap map[s
|
|
|
if tk == 3 { //增减
|
|
|
dealChange = strings.Replace(tdText, ",", "", -1)
|
|
|
}
|
|
|
+ if tk == 4 { //名次
|
|
|
+ if tdText != " " {
|
|
|
+ rank = tdText
|
|
|
+ }
|
|
|
+ }
|
|
|
if tk == 5 { //会员简称
|
|
|
buyName = tdText
|
|
|
}
|
|
@@ -295,6 +302,11 @@ func DoHtml(body, name, contractId string, dateTime time.Time, listDataMap map[s
|
|
|
buyChange = strings.Replace(tdText, ",", "", -1)
|
|
|
}
|
|
|
|
|
|
+ if tk == 8 { //名次
|
|
|
+ if tdText != " " {
|
|
|
+ rank = tdText
|
|
|
+ }
|
|
|
+ }
|
|
|
if tk == 9 { //会员简称
|
|
|
soldName = tdText
|
|
|
}
|