-
Notifications
You must be signed in to change notification settings - Fork 0
/
get.go
32 lines (29 loc) · 1.2 KB
/
get.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package ServiceOrderWait
import (
"errors"
"fmt"
Router2SystemConfig "github.com/fotomxq/weeekj_core/v5/router2/system_config"
ServiceOrderWaitFields "github.com/fotomxq/weeekj_core/v5/service/order/wait_fields"
)
// 获取等待订单
func getCreateWait(id int64) (data ServiceOrderWaitFields.FieldsWait, err error) {
cacheMark := fmt.Sprint("service:order:wait:id:", id)
if err = Router2SystemConfig.MainCache.GetStruct(cacheMark, &data); err == nil && data.ID > 0 {
return
}
err = Router2SystemConfig.MainDB.Get(&data, "SELECT id, create_at, order_id, system_mark, org_id, user_id, create_from, hash, address_from, address_to, goods, exemptions, allow_auto_audit, transport_allow_auto, transport_task_at, transport_pay_after, price_list, price_pay, currency, price, price_total, des, logs, params, err_code, err_msg, transport_system FROM service_order_wait WHERE id = $1", id)
if err != nil {
return
}
if data.ID < 1 {
err = errors.New("no data")
return
}
Router2SystemConfig.MainCache.SetStruct(cacheMark, data, 3600)
return
}
// 删除等待订单ID
func deleteWaitCache(id int64) {
cacheMark := fmt.Sprint("service:order:wait:id:", id)
Router2SystemConfig.MainCache.DeleteMark(cacheMark)
}