Pārlūkot izejas kodu

获取价格数据

rdluck 4 gadi atpakaļ
vecāks
revīzija
7769b8bf47

+ 1 - 1
models/data_source_longzhong.go

@@ -273,7 +273,7 @@ func GetLongzhongpriceinfoCount(unitid string) (count int, err error) {
 func GetLongzhongpriceinfo() (items []*Longzhongpriceinfo, err error) {
 	o := orm.NewOrm()
 	o.Using("edb")
-	sql := `SELECT * FROM longzhongpriceinfo `
+	sql := `SELECT * FROM longzhongpriceinfo WHERE product_name='纯碱' `
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }

+ 2 - 2
services/data_source_longzhong.go

@@ -728,8 +728,8 @@ func GetLzProductPriceData() (err error) {
 	}
 	username := "hzmd"
 	password := "HZMD2020"
-	startDate := time.Now().AddDate(0, 0, -1).Format(utils.FormatDate)
-	endDate := time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
+	startDate := "2017-01-01"//time.Now().AddDate(0, 0, -1).Format(utils.FormatDate)
+	endDate := "2017-12-31"//time.Now().AddDate(0, 0, 0).Format(utils.FormatDate)
 	for k, v := range priceInfoList {
 		fmt.Println(k, v)
 		getUrl := `https://openapi.oilchem.net/price/getPrice?password=` + password + `&type=` + v.InfoType + `&username=` + username + `&inStartDate=` + startDate + `&inEndDate=` + endDate + `&id=` + v.PriceId

+ 1 - 1
services/task.go

@@ -40,7 +40,7 @@ func Task123() {
 
 func Task() {
 	fmt.Println("start")
-	GetHistoryLzProductDetail()
+	GetLzProductPriceData()
 	fmt.Println("end")
 }