rdluck 3 năm trước cách đây
mục cha
commit
49621d3856
2 tập tin đã thay đổi với 20 bổ sung5 xóa
  1. 9 0
      models/data_source_longzhong.go
  2. 11 5
      services/data_source_longzhong.go

+ 9 - 0
models/data_source_longzhong.go

@@ -402,3 +402,12 @@ WHERE price_id = ? `
 	_, err = o.Raw(sql, item.Standard, item.ModelName, item.Unit, item.AreaName, item.PriceType, item.Memo, item.MarketName, item.ManufactureName, item.PriceId).Exec()
 	return
 }
+
+
+func GetDisplayTime(longzhonginfoId int)(display_time string,err error)  {
+	o := orm.NewOrm()
+	o.Using("edb")
+	sql := ` SELECT max(a.display_time) AS display_time FROM longzhongdata AS a WHERE a.longzhonginfo_id=? `
+	err = o.Raw(sql, longzhonginfoId).QueryRow(&display_time)
+	return
+}

+ 11 - 5
services/data_source_longzhong.go

@@ -241,6 +241,12 @@ func GetLzProductDetail() (err error) {
 	for _, v := range infoList {
 		totalPage := 10
 		for i := 1; i <= totalPage; i++ {
+
+			displayTime, _ := models.GetDisplayTime(v.LongzhonginfoId)
+			if displayTime != "" {
+				startDate = displayTime
+			}
+
 			fmt.Println("page:", i, totalPage)
 			timestamp := fmt.Sprintf("%d", time.Now().Unix())
 			token := utils.MD5(username + timestamp + utils.MD5(password))
@@ -582,7 +588,7 @@ func LzExportExcel() {
 			if len(dataList) <= 0 {
 				for n := 0; n < dataMax; n++ {
 					rowIndex := 5 + n
-					row:= sheetNew.Row(rowIndex)
+					row := sheetNew.Row(rowIndex)
 					row.AddCell()
 					row.AddCell()
 					row.AddCell()
@@ -601,7 +607,7 @@ func LzExportExcel() {
 					dataLen := dataMax - len(dataList)
 					for n := 0; n < dataLen; n++ {
 						rowIndex := (endRowIndex + 1) + n
-						row:= sheetNew.Row(rowIndex)
+						row := sheetNew.Row(rowIndex)
 						row.AddCell()
 						row.AddCell()
 						row.AddCell()
@@ -891,7 +897,7 @@ func LzPriceExportExcel() {
 			if len(dataList) <= 0 {
 				for n := 0; n < dataMax; n++ {
 					rowIndex := 8 + n
-					row:= sheetNew.Row(rowIndex)
+					row := sheetNew.Row(rowIndex)
 					row.AddCell()
 					row.AddCell()
 					row.AddCell()
@@ -902,7 +908,7 @@ func LzPriceExportExcel() {
 				endRowIndex := 0
 				for rk, dv := range dataList {
 					rowIndex := 8 + rk
-					row:= sheetNew.Row(rowIndex)
+					row := sheetNew.Row(rowIndex)
 					row.AddCell().SetValue(dv.PriceDate)
 					row.AddCell().SetFloat(dv.Price)
 					row.AddCell().SetFloat(dv.LowPrice)
@@ -915,7 +921,7 @@ func LzPriceExportExcel() {
 					dataLen := dataMax - len(dataList)
 					for n := 0; n < dataLen; n++ {
 						rowIndex := (endRowIndex + 1) + n
-						row:= sheetNew.Row(rowIndex)
+						row := sheetNew.Row(rowIndex)
 						row.AddCell()
 						row.AddCell()
 						row.AddCell()