diff --git a/cmd/server/gui_windows.go b/cmd/server/gui_windows.go index 276250f..4660fdc 100644 --- a/cmd/server/gui_windows.go +++ b/cmd/server/gui_windows.go @@ -12,6 +12,8 @@ import ( "unsafe" ) +const version = "v1.0.0" + // Win32 常量 const ( WS_OVERLAPPEDWINDOW = 0x00CF0000 @@ -198,7 +200,7 @@ func runGUI() { hInstance, _, _ := pGetModuleHandleW.Call(0) className, _ := syscall.UTF16PtrFromString("KfzLogWnd") - windowTitle, _ := syscall.UTF16PtrFromString("孔网商品定价 - 日志") + windowTitle, _ := syscall.UTF16PtrFromString("孔网商品定价 " + version + " - 日志") editClass, _ := syscall.UTF16PtrFromString("EDIT") hCursor, _, _ := pLoadCursorW.Call(0, IDC_ARROW) diff --git a/cmd/server/main.go b/cmd/server/main.go index 8d48a13..bf488ee 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -17,6 +17,8 @@ func main() { // 日志输出到GUI窗口 log.SetOutput(&guiLogWriter{}) + log.Printf("孔网商品定价 %s 启动中...", version) + // 加载配置 cfg, err := config.Load("./config/config.yaml") if err != nil { diff --git a/data/goods_pricing.db b/data/goods_pricing.db index 25574f5..2e6e078 100644 Binary files a/data/goods_pricing.db and b/data/goods_pricing.db differ diff --git a/internal/service/goods_service.go b/internal/service/goods_service.go index 6ab801a..d9df0d4 100644 --- a/internal/service/goods_service.go +++ b/internal/service/goods_service.go @@ -106,7 +106,7 @@ func (s *GoodsService) rateLimitWait() { } // sendCallback 发送回调请求 -func (s *GoodsService) sendCallback(outID, userID string, price, shippingFee float64) { +func (s *GoodsService) sendCallback(outID, userID string, price, shippingFee float64, minPrice float64) { if s.callbackURL == "" { return } @@ -128,6 +128,7 @@ func (s *GoodsService) sendCallback(outID, userID string, price, shippingFee flo if len(errs) > 0 { log.Printf("回调失败: %v", errs) } else { + log.Printf("最低书价:%v", minPrice) log.Printf("回调成功: product_id=%s, user_id=%s, sale_price=%d, cost=%d", outID, userID, salePrice, cost) } } @@ -185,8 +186,8 @@ func (s *GoodsService) syncGoodsPricing() { shippingFee, _ = strconv.ParseFloat(bookInfo.ShippingFee, 64) totalPrice := price + shippingFee finalPrice = totalPrice - record.PlaceholderDownPrice - record.MinShippingFee - if finalPrice < record.MinPrice { - finalPrice = record.MinPrice + if finalPrice < kfzConfig.MinPrice { + finalPrice = kfzConfig.MinPrice } // 保留两位小数 finalPrice, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", finalPrice), 64) @@ -200,7 +201,7 @@ func (s *GoodsService) syncGoodsPricing() { log.Printf("定时任务[%d]更新成功: price=%.2f, shipping_fee=%.2f", record.ID, price, shippingFee) // 调用回调 - s.sendCallback(record.OutID, record.UserID, finalPrice, record.MinShippingFee) + s.sendCallback(record.OutID, record.UserID, finalPrice, record.MinShippingFee, kfzConfig.MinPrice) } // outGetAllGoods 爬取孔网所有商品页面