feat: 添加版本号显示, 最低书价改为读取kfz_config表

This commit is contained in:
97694732@qq.com 2026-06-22 17:30:53 +08:00
parent e26d7a027e
commit 811c8ab457
4 changed files with 10 additions and 5 deletions

View File

@ -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)

View File

@ -17,6 +17,8 @@ func main() {
// 日志输出到GUI窗口
log.SetOutput(&guiLogWriter{})
log.Printf("孔网商品定价 %s 启动中...", version)
// 加载配置
cfg, err := config.Load("./config/config.yaml")
if err != nil {

Binary file not shown.

View File

@ -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 爬取孔网所有商品页面