Commit 304921a2 by zhangjie

1. 支付修改为通联支付

parents 1af36708 85ce55c3
# 默认忽略的文件
/shelf/
/workspace.xml
# 数据源本地存储已忽略文件
/dataSources/
/dataSources.local.xml
# 基于编辑器的 HTTP 客户端请求
/httpRequests/
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="SqlNoDataSourceInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SqlResolveInspection" enabled="false" level="ERROR" enabled_by_default="false" />
</profile>
</component>
\ No newline at end of file
No preview for this file type
...@@ -7,8 +7,8 @@ import ( ...@@ -7,8 +7,8 @@ import (
) )
// UpdateDUpdateTaskBeginAt 更新下发时间 // UpdateDUpdateTaskBeginAt 更新下发时间
func UpdateDUpdateTaskBeginAt(devID uint32, devType,oldFirmware string) bool { // 考虑预处理 func UpdateDUpdateTaskBeginAt(devID uint32, devType, oldFirmware string) bool { // 考虑预处理
_, err := PgDb.Exec("UPDATE d_update_task SET old_firmware=$1,begin_at=$2,begin_count=begin_count+1 WHERE device_id=$3 AND dev_type=$4",oldFirmware, time.Now(), devID, devType) _, err := PgDb.Exec("UPDATE d_update_task SET old_firmware=$1,begin_at=$2,begin_count=begin_count+1 WHERE device_id=$3 AND dev_type=$4", oldFirmware, time.Now(), devID, devType)
if err == nil { if err == nil {
return true return true
} }
...@@ -24,7 +24,7 @@ func UpdateDUpdateTaskRespondAt(devID uint32, devType string) bool { // 考虑 ...@@ -24,7 +24,7 @@ func UpdateDUpdateTaskRespondAt(devID uint32, devType string) bool { // 考虑
return false return false
} }
func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, result uint8) bool { // 0 升级失败 1 升级成功 2 版本重复 func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, result uint8) bool { // 0未升级 1 升级失败 2 升级成功 3 版本重复 4 找不到固件
tx, err := PgDb.Begin() tx, err := PgDb.Begin()
if err != nil { if err != nil {
logger.Log.Error("DeleteDUpdateTaskAndInsertDUpdateRecord PgDb.Begin():", logger.Log.Error("DeleteDUpdateTaskAndInsertDUpdateRecord PgDb.Begin():",
...@@ -34,7 +34,7 @@ func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, resu ...@@ -34,7 +34,7 @@ func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, resu
defer clearTransaction(tx) defer clearTransaction(tx)
var devType, oldFirmware, createAt, beginAt, respondAt string var devType, oldFirmware, createAt, beginAt, respondAt string
var creatorID,beginCount uint32 var creatorID, beginCount uint32
// DELETE FROM d_update_task WHERE device_id=100004 AND new_firmware='FIRMWARETEST1' RETURNING dev_type,old_firmware,create_at,begin_at,creator_id,respond_at // DELETE FROM d_update_task WHERE device_id=100004 AND new_firmware='FIRMWARETEST1' RETURNING dev_type,old_firmware,create_at,begin_at,creator_id,respond_at
err = tx.QueryRow("DELETE FROM d_update_task WHERE device_id=$1 AND new_firmware=$2 RETURNING dev_type,old_firmware,create_at,begin_at,creator_id,respond_at,begin_count", // todoN 可以优化下sql先查来存了再删看是不是效率高 err = tx.QueryRow("DELETE FROM d_update_task WHERE device_id=$1 AND new_firmware=$2 RETURNING dev_type,old_firmware,create_at,begin_at,creator_id,respond_at,begin_count", // todoN 可以优化下sql先查来存了再删看是不是效率高
devID, devID,
...@@ -46,8 +46,22 @@ func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, resu ...@@ -46,8 +46,22 @@ func DeleteDUpdateTaskAndInsertDUpdateRecord(devID uint32, firmware string, resu
return false return false
} }
var beginAtP *string
if beginAt == "" {
if result == 2 {
result = 3
}
} else {
beginAtP = &beginAt
}
var respondAtP *string
if respondAt != "" {
respondAtP = &respondAt
}
_, err = tx.Exec("INSERT INTO d_update_record(device_id,dev_type,old_firmware,new_firmware,create_at,begin_at,creator_id,respond_at,begin_count,result)VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)", _, err = tx.Exec("INSERT INTO d_update_record(device_id,dev_type,old_firmware,new_firmware,create_at,begin_at,creator_id,respond_at,begin_count,result)VALUES($1,$2,$3,$4,$5,$6,$7,$8,$9,$10)",
devID, devType, oldFirmware, firmware, createAt, beginAt, creatorID, respondAt, beginCount,result) devID, devType, oldFirmware, firmware, createAt, beginAtP, creatorID, respondAtP, beginCount, result)
if err != nil { if err != nil {
logger.Log.Error("DeleteDUpdateTaskAndInsertDUpdateRecord INSERT:", logger.Log.Error("DeleteDUpdateTaskAndInsertDUpdateRecord INSERT:",
zap.Error(err)) zap.Error(err))
......
{"ts":"2022-02-14 16:50:31.712","msg":"","Status":500,"SpendMS":14156,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 16:50:31.781","msg":"","Status":500,"SpendMS":8,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 16:51:58.960","msg":"","Status":500,"SpendMS":26283,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
This source diff could not be displayed because it is too large. You can view the blob instead.
{"ts":"2022-02-14 16:59:54.767","msg":"","Status":404,"SpendMS":53114,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 17:10:26.197","msg":"","Status":404,"SpendMS":213,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 17:13:27.327","msg":"","Status":404,"SpendMS":211,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 17:33:11.626","msg":"","Status":404,"SpendMS":234,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 17:59:07.086","msg":"","Status":404,"SpendMS":207,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 18:01:41.275","msg":"","Status":404,"SpendMS":221,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 18:04:44.059","msg":"","Status":404,"SpendMS":199,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 18:10:28.158","msg":"","Status":404,"SpendMS":223,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 18:13:27.975","msg":"","Status":404,"SpendMS":227,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-15 19:21:11.481","msg":"","Status":404,"SpendMS":215,"Ip":"127.0.0.1","Method":"POST","Path":"/callback/allinpay/pay","DataSize":0,"Agent":"Java/1.8.0_172"}
{"ts":"2022-02-14 17:20:32.952","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:51337","error":"EOF"}
{"ts":"2022-02-14 17:20:35.929","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:51338","error":"EOF"}
{"ts":"2022-02-14 17:21:17.289","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:63338","error":"EOF"}
{"ts":"2022-02-14 17:22:17.498","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:51347","error":"read tcp4 127.0.0.1:8010->127.0.0.1:51347: i/o timeout"}
{"ts":"2022-02-14 17:22:33.625","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:56594","error":"EOF"}
{"ts":"2022-02-14 17:22:37.627","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:56595","error":"EOF"}
{"ts":"2022-02-14 17:23:17.813","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:56574","error":"read tcp4 127.0.0.1:8010->127.0.0.1:56574: i/o timeout"}
{"ts":"2022-02-14 18:09:01.550","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:63209","error":"read tcp4 127.0.0.1:8010->127.0.0.1:63209: i/o timeout"}
{"ts":"2022-02-15 11:46:51.848","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:60035","error":"EOF"}
{"ts":"2022-02-15 15:51:23.827","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:55905","error":"read tcp4 127.0.0.1:8010->127.0.0.1:55905: use of closed network connection"}
{"ts":"2022-02-15 15:51:54.798","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:60886","error":"read tcp4 127.0.0.1:8010->127.0.0.1:60886: use of closed network connection"}
{"ts":"2022-02-15 15:54:42.919","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:57059","error":"EOF"}
{"ts":"2022-02-15 15:55:26.110","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:63141","error":"read tcp4 127.0.0.1:8010->127.0.0.1:63141: use of closed network connection"}
{"ts":"2022-02-15 15:55:46.647","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:53704","error":"read tcp4 127.0.0.1:8010->127.0.0.1:53704: use of closed network connection"}
{"ts":"2022-02-15 15:56:09.821","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":1526726659,"Conn":"127.0.0.1:51803","error":"read tcp4 127.0.0.1:8010->127.0.0.1:51803: use of closed network connection"}
{"ts":"2022-02-15 16:00:59.018","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:57898","error":"read tcp4 127.0.0.1:8010->127.0.0.1:57898: i/o timeout"}
{"ts":"2022-02-15 16:02:16.426","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:54690","error":"read tcp4 127.0.0.1:8010->127.0.0.1:54690: i/o timeout"}
{"ts":"2022-02-15 16:03:16.937","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:63141","error":"read tcp4 127.0.0.1:8010->127.0.0.1:63141: i/o timeout"}
{"ts":"2022-02-15 16:05:35.078","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:65148","error":"read tcp4 127.0.0.1:8010->127.0.0.1:65148: i/o timeout"}
{"ts":"2022-02-15 16:06:52.006","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:50361","error":"read tcp4 127.0.0.1:8010->127.0.0.1:50361: i/o timeout"}
{"ts":"2022-02-15 16:08:09.042","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:54765","error":"read tcp4 127.0.0.1:8010->127.0.0.1:54765: i/o timeout"}
{"ts":"2022-02-15 21:38:03.756","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:51325","error":"EOF"}
{"ts":"2022-02-17 15:22:40.404","msg":"read error","Src":"TCP-SERVER-connectionHandle","DevID":0,"Conn":"127.0.0.1:63928","error":"EOF"}
package util
//import (
// "database/sql/driver"
// "errors"
// "fmt"
// "strings"
// "time"
//)
//
////Time 自定义时间
//type Time time.Time
//
//func (t *Time) UnmarshalJSON(data []byte) error {
// if string(data) == "null" {
// return nil
// }
// var err error
// //前端接收的时间字符串
// str := string(data)
// //去除接收的str收尾多余的"
// timeStr := strings.Trim(str, "\"")
// t1, err := time.Parse("2006-01-02 15:04:05", timeStr)
// *t = Time(t1)
// return err
//}
//
//func (t Time) MarshalJSON() ([]byte, error) {
// formatted := fmt.Sprintf("\"%v\"", time.Time(t).Format("2006-01-02 15:04:05"))
// return []byte(formatted), nil
//}
//
//func (t Time) Value() (driver.Value, error) {
// // Time 转换成 time.Time 类型
// tTime := time.Time(t)
// return tTime.Format("2006-01-02 15:04:05"), nil
//}
//
//func (t *Time) Scan(v interface{}) error {
// switch vt := v.(type) {
// case time.Time:
// // 字符串转成 time.Time 类型
// *t = Time(vt)
// default:
// return errors.New("类型处理错误")
// }
// return nil
//}
//
//func (t *Time) String() string {
// return fmt.Sprintf("hhh:%s", time.Time(*t).String())
//}
//
//func Now() Time {
// return Time(time.Now())
//}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment