|
@@ -19,7 +19,7 @@ import (
|
|
|
// "../../../routers/restful"
|
|
|
|
|
|
func GmUdSync(pastureId, farmId string) {
|
|
|
- fmt.Println(111)
|
|
|
+ UdBarFeedRemainPush(pastureId, farmId)
|
|
|
}
|
|
|
|
|
|
func UdBarSync(pastureId, farmId string) {
|
|
@@ -158,7 +158,7 @@ func UdUtirPush(pastureId, farmId string) error {
|
|
|
"code": "1",
|
|
|
"method": "uploadadddata",
|
|
|
"resultData": %s,
|
|
|
- "farmId": %s,
|
|
|
+ "farmId": "%s",
|
|
|
"rowCount": %d,
|
|
|
"errMessage": ""
|
|
|
},
|
|
@@ -218,7 +218,7 @@ dd.fname,
|
|
|
"code": "1",
|
|
|
"method": "uploaddiliverdata",
|
|
|
"resultData": %s,
|
|
|
- "farmId": %s,
|
|
|
+ "farmId": "%s",
|
|
|
"rowCount": %d,
|
|
|
"errMessage": ""
|
|
|
},
|
|
@@ -236,7 +236,7 @@ func UdBarFeedRemainPush(pastureId, farmId string) error {
|
|
|
|
|
|
tx := restful.Engine.NewSession()
|
|
|
defer tx.Close()
|
|
|
- now := time.Now().AddDate(0, 0, 0).Format("2006-01-02")
|
|
|
+ now := time.Now().AddDate(0, 0, -1).Format("2006-01-02")
|
|
|
dataList, err := tx.SQL(`SELECT
|
|
|
'' startTime,
|
|
|
'' endTime,
|
|
@@ -263,7 +263,7 @@ WHERE
|
|
|
"code": "1",
|
|
|
"method": "uploadoverplusdata",
|
|
|
"resultData": %s,
|
|
|
- "farmId": %s,
|
|
|
+ "farmId":"%s",
|
|
|
"rowCount": %d,
|
|
|
"errMessage": ""
|
|
|
},
|
|
@@ -273,6 +273,7 @@ WHERE
|
|
|
}`
|
|
|
reqJson = fmt.Sprintf(reqJson, string(dataByte), farmId, len(dataList))
|
|
|
// '0饲喂 1剩料 2原料 3栏舍 4配方 5栏舍牛头数 6库存',
|
|
|
+ fmt.Println(reqJson)
|
|
|
postPush(reqJson, 1, tx, pastureId)
|
|
|
return nil
|
|
|
}
|
|
@@ -319,7 +320,7 @@ WHERE
|
|
|
"code": "1",
|
|
|
"method": "getfeedtempletinfo",
|
|
|
"resultData": %s,
|
|
|
- "farmId": %s,
|
|
|
+ "farmId": "%s",
|
|
|
"rowCount": %d,
|
|
|
"errMessage": ""
|
|
|
},
|
|
@@ -355,7 +356,6 @@ func postPush(data string, msgtype int, tx *xorm.Session, pastureId string) {
|
|
|
defer resp.Body.Close()
|
|
|
body, _ := ioutil.ReadAll(resp.Body)
|
|
|
fmt.Println(string(body))
|
|
|
- fmt.Println("11111111111111", time.Now())
|
|
|
tx.Exec(` insert into saplog(pastureId,request,response,status,msgtext,createTime,msgtype,dataDate,url)
|
|
|
values(?,?,?,?,?,now(),?,now(),?)`, pastureId, data, string(body), "", "", msgtype, url)
|
|
|
|