# kongfz.dll 使用教程 ## 1.创建DLL工具实例 ### 加载DLL文件 ```gotemplate // 加载DLL的函数 type kongfzDLL struct { dll *syscall.DLL outLogin *syscall.Proc // 孔网登录 outGetUserMsg *syscall.Proc // 获取孔网用户信息 outGetGoodsTplMsg *syscall.Proc // 获取商品模版-已登的店铺 outGetGoodsListMsgFromSelfShop *syscall.Proc // 获取商品列表-已登的店铺 outAddGoods *syscall.Proc // 新增商品-已登的店铺 outDelGoodsFromSelfShop *syscall.Proc // 删除商品-已登的店铺 outGetImageFilterShopId *syscall.Proc // 获取孔网商品图片(官图和拍图)-带有店铺过滤 outGetImageByIsbn *syscall.Proc // 获取孔网商品图片和信息(官图和拍图) outGetGoodsListMsgByShopId *syscall.Proc // 获取商品列表通过店铺ID outGetGoodsMsgByDetailUrl *syscall.Proc // 获取商品信息通过商品详情链接 outGetTopGoodsListMsg *syscall.Proc // 获取销量榜商品列表 freeCString *syscall.Proc // 释放C字符串内存 } // 初始化kongfzDLL func InitKongfzDLL() (*kongfzDLL, error) { dllPath := filepath.Join("dll", "kongfz.dll") if _, err := os.Stat(dllPath); os.IsNotExist(err) { return nil, fmt.Errorf("kongfz DLL 不存在: %s", dllPath) } if dll, err := syscall.LoadDLL(dllPath); err != nil { return nil, fmt.Errorf("加载 kongfz DLL 失败: %v", err) } else { return &kongfzDLL{ dll: dll, outLogin: dll.MustFindProc("OutLogin"), outGetUserMsg: dll.MustFindProc("OutGetUserMsg"), outGetGoodsTplMsg: dll.MustFindProc("OutGetGoodsTplMsg"), outGetGoodsListMsgFromSelfShop: dll.MustFindProc("OutGetGoodsListMsgFromSelfShop"), outAddGoods: dll.MustFindProc("OutAddGoods"), outDelGoodsFromSelfShop: dll.MustFindProc("OutDelGoodsFromSelfShop"), outGetImageFilterShopId: dll.MustFindProc("OutGetImageFilterShopId"), outGetImageByIsbn: dll.MustFindProc("OutGetImageByIsbn"), outGetGoodsListMsgByShopId: dll.MustFindProc("OutGetGoodsListMsgByShopId"), outGetGoodsMsgByDetailUrl: dll.MustFindProc("OutGetGoodsMsgByDetailUrl"), outGetTopGoodsListMsg: dll.MustFindProc("OutGetTopGoodsListMsg"), freeCString: dll.MustFindProc("FreeCString"), }, nil } } // main函数调用 dll, err := InitKongfzDLL() if err != nil { fmt.Println(err) } ``` ### 获取C字符串 ```gotemplate // cStr 获取C字符串 func (m *kongfzDLL) cStr(p uintptr) string { if p == 0 { return "" } b := []byte{} for i := uintptr(0); ; i++ { c := *(*byte)(unsafe.Pointer(p + i)) if c == 0 { break } b = append(b, c) } s := string(b) if m.freeCString != nil { m.freeCString.Call(p) } return s } ``` ### 2.使用dll函数示例 ```gotemplate // 获取商品模版 func (m *kongfzDLL) OutGetGoodsTplMsg(token, itemId, proxy string) (string, error) { proc, err := m.dll.FindProc("OutGetGoodsTplMsg") if err != nil { return "", fmt.Errorf("找不到函数 OutGetGoodsTplMsg 函数: %v", err) } tokenPtr, _ := syscall.BytePtrFromString(token) itemIdPtr, _ := syscall.BytePtrFromString(itemId) proxyPtr, _ := syscall.BytePtrFromString(proxy) info, _, err := proc.Call( uintptr(unsafe.Pointer(tokenPtr)), uintptr(unsafe.Pointer(itemIdPtr)), uintptr(unsafe.Pointer(proxyPtr))) if err != nil && err.Error() != "The operation completed successfully." { return "", fmt.Errorf("调用函数 OutGetGoodsTplMsg 失败: %v", err) } return m.cStr(info), nil } ``` ### 初始化配置信息(可以不调用) ```gotemplate func main() { // 使用默认配置初始化 config := createDefaultConfig() configJSON, err := json.Marshal(config) if err != nil { log.Fatalf("序列化配置失败: %v", err) } result, err := manager.Initialize(string(configJSON)) if err != nil { log.Fatalf("初始化失败: %v", err) } var initResp APIResponse if err := json.Unmarshal([]byte(result), &initResp); err != nil { log.Fatalf("解析初始化响应失败: %v", err) } if !initResp.Success { log.Fatalf("初始化失败: %s", initResp.Message) } } // 创建默认配置 func createDefaultConfig() Config { var config Config // App配置 config.App.MaxRetryTimes = 3 config.App.RateLimitDelay = 1000 config.App.Size = 10 config.App.DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" // API配置 config.API.LoginURL = "https://login.kongfz.com/Pc/Login/account" config.API.BookSearchURL = "https://search.kongfz.com/pc-gw/search-web/client/pc/bookLib/keyword/list" config.API.ProductSearchURL = "https://search.kongfz.com/pc-gw/search-web/client/pc/product/keyword/list" // 代理配置(需要根据实际情况修改) config.Proxy.Servers = "http-dynamic.xiaoxiangdaili.com,http-dynamic-S02.xiaoxiangdaili.com,http-dynamic-S03.xiaoxiangdaili.com,http-dynamic-S04.xiaoxiangdaili.com" config.Proxy.Username = "1297757178467602432" config.Proxy.Password = "QgQBvP7f" config.Proxy.TailMachineCode = "b7bf22a237ec692f13fcc2c43ee63252" config.Proxy.TailCardKey = "DL_20_YK_1920acb2129844c2aabade3896560a9b" config.Proxy.ProxyFilePath = "dll/proxyConfig.dll" config.Database.Username = "newAdmin" config.Database.Password = "bYPp8SbBe5F7nz2i" config.Database.Host = "146.56.227.42:3306" config.Database.Name = "newadmin" return config } ``` ## 2.配置结构体(可以不调用) ```gotemplate type Config struct { App struct { MaxRetryTimes int `json:"max_retry_times"` RateLimitDelay int `json:"rate_limit_delay"` Size int `json:"size"` DefaultUserAgent string `json:"default_user_agent"` } `json:"app"` API struct { LoginURL string `json:"login_url"` BookSearchURL string `json:"book_search_url"` ProductSearchURL string `json:"product_search_url"` } `json:"api"` Proxy struct { Servers string `json:"servers"` Username string `json:"username"` Password string `json:"password"` TailMachineCode string `json:"tail_machine_code"` TailCardKey string `json:"tail_card_key"` ProxyFilePath string `json:"proxy_file_path"` } `json:"proxy"` } ``` # 接口详情 ## 1.孔网登录--OutLogin ### 请求信息 ```gotemplate dll.OutLogin(username, password) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|--|--| | username | string | 是 | 登录用户名 | | password | string | 是 | 登录密码 | ### 响应示例 ```json { "success": true, "message": "", "data": { "token": "abc123def456" } } ``` ## 2.获取孔网用户信息--OutGetUserMsg ### 请求信息 ```gotemplate dll.OutGetUserMsg(token) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|--|--| | token | string | 是 | 登录凭证 | ### 响应示例 ```json { "success": true, "message": "", "data": { "userId": 123456, "nickname": "用户昵称", "mobile": "13800138000" } } ``` ## 3.获取商品模版-已登的店铺--OutGetGoodsTplMsg ### 请求信息 ```gotemplate dll.OutGetGoodsTplMsg(token, proxy, itemId) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|--| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | itemId | string | 是 | 商品ID | ### 响应示例 ```json { "success": true, "message": "", "data": { "status": 1, "data": { "categorySection": { "key": "catId", "name": "分类", "value": "58012000000000000", "catName": "收藏杂项 > 其他杂项", "inputType": "other", "title": "", "tips": "", "unit": "", "check": { "type": "categorySelect", "status": 0, "isRequired": 1 }, "isValid": true }, "goodsSection": [ { "key": "itemName", "name": "商品名称", "value": "鎏金降魔杵 全品", "inputType": "textarea", "title": "请填写商品名称", "tips": "请填写商品名称", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 1, "maxLen": 200 } }, { "key": "author", "name": "制作者", "value": "未知", "inputType": "text", "title": "请填写制作者", "tips": "请填写制作者", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 0, "maxLen": 120 } }, { "key": "yearsGroup", "name": "年代", "value": "2", "inputType": "yearsGroup", "title": "请填写时间或选择年代", "tips": "", "unit": "", "check": { "type": "radio", "status": 0, "isRequired": 0 }, "options": [ { "name": "填写时间", "value": "1", "group": [ { "key": "pubDate", "name": "年代", "value": "", "inputType": "dateGroup", "title": "请填写年代", "tips": "请填写年代", "unit": "", "check": { "type": "date", "status": 0, "isRequired": 0, "enableUnknow": false, "maxDate": "2026-12" }, "group": [ { "key": "pubDateYear", "name": "年份", "value": "", "leftWords": "hidden", "inputType": "int", "title": "请填写年份", "tips": "请填写年份", "unit": "年", "explain": "", "check": { "type": "int", "status": 0, "isRequired": 0, "min": 0, "max": 2026 } }, { "key": "pubDateMonth", "name": "月份", "value": "", "leftWords": "hidden", "inputType": "int", "title": "请填写月份", "tips": "请填写月份", "unit": "月", "explain": "", "check": { "type": "int", "status": 0, "isRequired": 0, "min": 1, "max": 12 } } ] } ] }, { "name": "选择年代", "value": "2", "group": [ { "key": "years", "name": "年代", "value": 0, "inputType": "yearsSelect", "title": "请选择年代", "tips": "", "unit": "", "check": { "type": "yearsSelect", "status": 0, "isRequired": 0 } } ] } ] }, { "key": "material", "name": "材质", "value": "金属", "inputType": "text", "title": "请填写材质", "tips": "请填写材质", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 0, "maxLen": 10 } }, { "key": "size", "name": "尺寸", "value": "", "inputType": "row", "isRequired": 0, "title": "请填写尺寸", "tips": "请填写尺寸", "group": [ { "key": "sizeLength", "name": "长度", "value": "6", "leftWords": "长", "inputType": "float", "title": "请填写长度", "tips": "请填写长度", "unit": "cm", "check": { "type": "float", "status": 0, "isRequired": 1, "min": 0.01, "max": 99999.99, "decimals": 2 } }, { "key": "sizeWidth", "name": "宽度", "value": "2", "leftWords": "宽", "inputType": "float", "title": "请填写宽度", "tips": "请填写宽度", "unit": "cm", "check": { "type": "float", "status": 0, "isRequired": 1, "min": 0.01, "max": 99999.99, "decimals": 2 } }, { "key": "sizeHeight", "name": "高度", "value": "3", "leftWords": "高", "inputType": "float", "title": "请填写高度", "tips": "请填写高度", "unit": "cm", "check": { "type": "float", "status": 0, "isRequired": 0, "min": 0.01, "max": 99999.99, "decimals": 2 } } ] }, { "key": "quality", "name": "品相", "value": "95", "inputType": "select", "options": [ { "name": "全新", "value": 100 }, { "name": "九五品", "value": 95 }, { "name": "九品", "value": 90 }, { "name": "八五品", "value": 85 }, { "name": "八品", "value": 80 }, { "name": "七五品", "value": 75 }, { "name": "七品", "value": 70 }, { "name": "六五品", "value": 65 }, { "name": "六品", "value": 60 }, { "name": "五品", "value": 50 }, { "name": "四品", "value": 40 }, { "name": "三品", "value": 30 }, { "name": "二品", "value": 20 }, { "name": "一品", "value": 10 } ], "title": "请选择品相", "tips": "", "unit": "", "check": { "type": "select", "status": 0, "isRequired": 1 } }, { "key": "qualityDesc", "name": "品相描述", "value": "老好了", "inputType": "textarea", "title": "请填写品相描述", "tips": "请填写品相描述", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 0, "maxLen": 400 } }, { "key": "price", "name": "售价", "value": "1467.00", "leftWords": "", "inputType": "float", "title": "请填写售价", "tips": "请填写售价", "unit": "元", "check": { "type": "float", "status": 0, "isRequired": 1, "min": 0.01, "max": 99999999.99, "decimals": 2 } }, { "key": "number", "name": "库存数量", "value": "1", "leftWords": "", "inputType": "int", "title": "请填写库存数量", "tips": "请填写库存数量", "unit": "件", "explain": "", "check": { "type": "int", "status": 0, "isRequired": 0, "min": 0, "max": 9999 } }, { "key": "itemSn", "name": "货号", "value": "", "inputType": "text", "title": "请填写货号", "tips": "请填写货号", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 0, "maxLen": 20 } }, { "key": "myCatId", "name": "本店分类", "value": "", "inputType": "select", "options": [], "title": "请选择本店分类", "tips": "", "unit": "", "check": { "type": "select", "status": 0, "isRequired": 0 } }, { "key": "itemDesc", "name": "详细描述", "value": "", "inputType": "textarea", "title": "请填写详细描述", "tips": "请填写详细描述", "unit": "", "explain": "", "check": { "type": "string", "status": 0, "isRequired": 0, "maxLen": 10000 } }, { "key": "images", "name": "图片", "inputType": "images", "title": "请填写图片", "tips": "图片格式为jpg、png、gif、jpeg,图片大小不能超过10M,一次可以选择多张上传,最多上传30张,拖拽调整顺序。", "unit": "", "value": "", "images": [ { "imgId": 239722, "imgType": 0, "isMain": 1, "imgUrl": "sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_s.jpg", "imgSrc": "https://www0.kfzimg.com/sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_s.jpg", "imgSrcMiddle": "https://www0.kfzimg.com/sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_n.jpg", "imgSrcBig": "https://www0.kfzimg.com/sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_b.jpg", "imgDesc": "", "imgTag": [] } ], "batchKey": "img", "check": { "type": "images", "status": 0, "isRequired": 1, "descMaxLen": 300, "minNum": 1, "maxNum": 30, "appMaxSize": "2MB", "appMaxWidth": "1200", "pcMaxSize": "10MB" } }, { "key": "isOnSale", "name": "货架状态", "value": "1", "inputType": "radio", "title": "", "tips": "", "unit": "", "check": { "type": "radio", "status": -1, "isRequired": 1 }, "options": [ { "name": "直接上架", "value": "1" }, { "name": "暂时下架", "value": "0" } ] }, { "key": "itemId", "name": "商品编号", "value": 9250897118, "inputType": "hidden", "title": "", "tips": "", "unit": "" }, { "key": "oldCatId", "name": "原商品分类", "value": "58012000000000000", "inputType": "hidden", "title": "", "tips": "", "unit": "" }, { "key": "oldPrice", "name": "原商品价格", "value": "1467.00", "inputType": "hidden", "title": "", "tips": "", "unit": "" }, { "key": "tpl", "name": "模板编号", "value": 12, "inputType": "hidden", "title": "", "tips": "", "unit": "" } ], "deliverSection": [ { "key": "deliverTimeGroup", "name": "发货模式", "value": "1", "inputType": "ridio", "title": "发货模式", "tips": "", "unit": "", "check": { "type": "radio", "status": 0, "isRequired": 1 }, "options": [ { "name": "现货模式", "value": "1", "key": "deliverTypeInStock", "group": [ { "key": "deliverTime", "name": "发货时间", "value": "48h", "inputType": "radio", "title": "发货时间", "tips": "", "unit": "", "check": { "type": "radio", "status": 0, "isRequired": 1 }, "options": [ { "name": "当日发", "value": "today", "tips": "买家在16点前付款当日24点前发货;16点后付款次日24点前发货;且在发货24小时内返回物流轨迹。" }, { "name": "24小时", "value": "24h", "tips": "买家付款后24小时内发货,且在发货24小时内返回物流轨迹。" }, { "name": "48小时", "value": "48h" } ] } ] } ] }, { "key": "isDeliverTimeDefault", "name": "设为默认发货时间", "value": "48h", "inputType": "hidden" } ], "shippingSection": [ { "key": "bearShipping", "name": "", "value": "buyer", "inputType": "radio", "options": [ { "name": "卖家承担运费", "tips": "(必须支持快递)", "value": "seller" }, { "name": "运费模板", "value": "buyer" } ], "title": "请选择", "tips": "", "unit": "", "check": { "type": "radio", "status": 0, "isRequired": 1 } }, { "key": "isUseMould", "name": "是否使用运费模板", "value": "1", "inputType": "hidden", "title": "", "tips": "", "unit": "" }, { "key": "mouldId", "name": "运费模板", "value": 975623, "inputType": "select", "title": "请选择运费模板", "tips": "为了提升消费者购物体验,方便您计算运费,买家承担运费的商品均需使用运费模板,如何使用模板,[url=]查看视频教程[/url]", "unit": "", "check": { "type": "shippingMouldSelect", "status": 0, "isRequired": 1 }, "shipping": [], "shopProductArea": 1001000000, "mouldList": [ { "mouldId": "975623", "mouldName": "模板1", "isTransfer": "0", "isDefault": "0", "isAppMould": "0", "feeManner": "weight", "productArea": "1001000000", "mouldInfo": { "mouldId": "975623", "userId": "24175337", "mouldName": "模板1", "productArea": "1001000000", "feeManner": "weight", "sortOrder": [ "express" ], "enableShipping": "express", "dataMd5": "", "isDefault": "0", "isAppMould": "0", "description": "", "smartMouldId": "0", "shipmentType": "0", "provId": "1000000000", "provName": "北京", "cityId": "1001000000", "cityName": "东城", "feeList": { "express": { "enabled": true, "name": "快递", "special": [ { "feeId": 8587228, "area": [ { "provId": "1000000000", "provName": "北京", "cities": [] } ], "areaDivide": "china", "initialNum": 1, "addNum": 1, "addFee": "5.00", "initialFee": "5.00", "registerFee": "0.00" }, { "feeId": 8587229, "area": [ { "provId": "3000000000", "provName": "天津", "cities": [] }, { "provId": "12000000000", "provName": "河北", "cities": [] } ], "areaDivide": "china", "initialNum": 1, "addNum": 1, "addFee": "5.00", "initialFee": "5.00", "registerFee": "0.00" }, { "feeId": 8587230, "area": [ { "provId": "2000000000", "provName": "上海", "cities": [] }, { "provId": "18000000000", "provName": "江苏", "cities": [] }, { "provId": "31000000000", "provName": "浙江", "cities": [] }, { "provId": "5000000000", "provName": "安徽", "cities": [] }, { "provId": "19000000000", "provName": "江西", "cities": [] }, { "provId": "25000000000", "provName": "山西", "cities": [] }, { "provId": "24000000000", "provName": "山东", "cities": [] }, { "provId": "21000000000", "provName": "内蒙古", "cities": [] }, { "provId": "16000000000", "provName": "湖南", "cities": [] }, { "provId": "15000000000", "provName": "湖北", "cities": [] }, { "provId": "13000000000", "provName": "河南", "cities": [] }, { "provId": "8000000000", "provName": "广东", "cities": [] }, { "provId": "9000000000", "provName": "广西", "cities": [] }, { "provId": "6000000000", "provName": "福建", "cities": [] }, { "provId": "11000000000", "provName": "海南", "cities": [] }, { "provId": "20000000000", "provName": "辽宁", "cities": [] }, { "provId": "17000000000", "provName": "吉林", "cities": [] }, { "provId": "14000000000", "provName": "黑龙江", "cities": [] }, { "provId": "26000000000", "provName": "陕西", "cities": [] }, { "provId": "7000000000", "provName": "甘肃", "cities": [] }, { "provId": "22000000000", "provName": "宁夏", "cities": [] }, { "provId": "23000000000", "provName": "青海", "cities": [] }, { "provId": "4000000000", "provName": "重庆", "cities": [] }, { "provId": "30000000000", "provName": "云南", "cities": [] }, { "provId": "10000000000", "provName": "贵州", "cities": [] }, { "provId": "27000000000", "provName": "四川", "cities": [] } ], "areaDivide": "china", "initialNum": 1, "addNum": 1, "addFee": "5.00", "initialFee": "5.00", "registerFee": "0.00" }, { "feeId": 8587231, "area": [ { "provId": "29000000000", "provName": "新疆", "cities": [] }, { "provId": "28000000000", "provName": "西藏", "cities": [] } ], "areaDivide": "china", "initialNum": 1, "addNum": 1, "addFee": "30.00", "initialFee": "30.00", "registerFee": "0.00" }, { "feeId": 8587232, "area": [ { "provId": "34000000000", "provName": "香港", "cities": [] }, { "provId": "32000000000", "provName": "澳门", "cities": [] }, { "provId": "33000000000", "provName": "台湾", "cities": [] }, { "provId": "40000000000", "provName": "海外", "cities": [] } ], "areaDivide": "outChinaDefault", "initialNum": 0, "addNum": 0, "addFee": "0.00", "initialFee": "0.00", "registerFee": 0 } ] } } }, "shipmentType": "0" } ] }, { "key": "weight", "name": "物流重量", "value": "0.5", "leftWords": "", "inputType": "float", "title": "请填写物流重量", "tips": "请填写物流重量", "unit": "千克", "check": { "type": "float", "status": 0, "isRequired": 1, "min": 0.01, "max": 9999.99, "decimals": 2 } }, { "key": "weightPiece", "name": "物流标准本数", "value": "1", "leftWords": "", "inputType": "float", "title": "请填写物流标准本数", "tips": "请填写物流标准本数", "unit": "本", "check": { "type": "float", "status": 0, "isRequired": 1, "min": 0.01, "max": 9999.99, "decimals": 2 } } ], "isDraft": 0 }, "message": "", "errType": "" } } ``` ## 4.获取商品列表-已登的店铺--OutGetGoodsListMsgFromSelfShop ### 请求信息 ```gotemplate dll.OutGetGoodsListMsgFromSelfShop(token, proxy, itemSn, priceMin, priceMax, startCreateTime, endCreateTime, requestType, isItemSnEqual, page, size) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|-----------------| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | itemSn | string | 是 | 店铺货号 | | priceMin | string | 否 | 最低价格 | | priceMax | string | 否 | 最高价格 | | startCreateTime | string | 否 | 上书开始时间 | | endCreateTime | string | 否 | 上书结束时间 | | requestType | string | 是 | 请求类型 onSale:出售中 | | isItemSnEqual | int | 是 | 验证货号 填 0 就行 | | page | int | 是 | 页码 | | size | int | 是 | 每页数量 | ### 响应示例 ```json { "success": true, "message": "", "data": { "status": true, "errCode": 0, "errMessage": "", "result": { "productInfoPageResult": { "list": [ { "name": "鎏金降魔杵 全品", "qualityName": "九五品", "quality": 95, "price": 1467.00, "realPrice": 1467.00, "number": 1, "mouldName": "模板1", "feeManner": "0.5千克", "weight": 0.5, "weightPiece": 0.0, "mouldId": 975623, "imageUrl": "https://www0.kfzimg.com/sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_s.jpg", "imageSrc": "https://www0.kfzimg.com/sw/kfz-cos/kfzimg/24175337/00fff0d9a9dbb89c_s.jpg", "createTime": "2025-12-11 11:42", "updateTime": "2025-12-11 11:43", "itemId": 9250897118, "catId": 58012000000000000, "catName": "收藏杂项 > 其他杂项", "tpl": 12, "itemSn": "", "discount": 100, "certifyStatus": "certified", "isOnSale": 1, "certifyStatusName": "出售中", "soldNumber": null, "soldAmount": null, "soldTime": null, "operateList": null, "shareInfo": null, "isSyncISBN": 0, "deliverType": 1, "deliverTime": "48h", "isDraft": 0 } ], "pager": { "page": 1, "size": 100, "total": 1, "pages": 1 } }, "productStatCount": { "allUnSold": 3, "onSale": 1, "zeroStock": 0, "offSale": 2, "needApproved": 0, "soldCount": null }, "productListStat": { "count": 1, "itemNum": 1, "amount": "1467.00" } } } } ``` ## 5.新增商品-已登的店铺--OutAddGoods ### 请求信息 ```gotemplate dll.OutAddGoods(token, proxy, formData) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|----------------| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | formData | string | 是 | 新增商品信息的json字符串 | ### 响应示例 ```json { "success": true, "message": "", "data": { "status":1, "data":9279010923, "message":"", "errType":"" } } ``` ## 6.删除商品-已登的店铺--OutDelGoodsFromSelfShop ### 请求信息 ```gotemplate dll.OutDelGoodsFromSelfShop(token, proxy, itemId) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|------| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | itemId | string | 是 | 店铺ID | ### 响应示例 ```json { "success": true, "message": "", "data": { "status":true, "errCode":0, "errMessage":"", "result":true } } ``` ## 7.获取孔网商品图片(官图和拍图)-带有店铺过滤--OutGetImageFilterShopId ### 请求信息 ```gotemplate dll.OutGetImageFilterShopId(token, proxy, isbn, shopId, isLiveImage, isReturnMsg) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|----------------------| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | isbn | string | 是 | ISBN | | shopId | int | 是 | 店铺ID | | isLiveImage | int | 是 | 需要官图还是实拍图 0:官图 1:实拍图 | | isReturnMsg | int | 否 | 是否需要详细信息 0:是 1:否 | ### 响应示例 ```json { "success": true, "message": "", "data": { "book_name": "", "book_pic": "", "book_pic_s": "", "isbn": "" } } ``` ## 8.获取孔网商品图片和信息(官图和拍图)--OutGetImageByIsbn ### 请求信息 ```gotemplate dll.OutGetImageByIsbn(token, proxy,isbn, isLiveImage, isReturnMsg) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|----------------------| | token | string | 是 | 登录凭证 | | proxy | string | 否 | 代理地址 | | isbn | string | 是 | ISBN | | isLiveImage | int | 是 | 需要官图还是实拍图 0:官图 1:实拍图 | | isReturnMsg | int | 是 | 是否需要详细信息 0:是 1:否 | ### 响应示例 ```json { "success": true, "message": "", "data": { "author": "", "publisher": "", "isbn": "", "publication_time": 0, "edition": "", "print_time": "", "fix_price": "", "binding_layout": "", "format": "", "paper": "", "pages": "", "wordage": "", "languages": "", "era": "", "engraving_method": "", "dimensions": "", "volume_number": "", "book_pic": "", "book_pic_s": "", "selling_price": "", "condition": "", "express_delivery_fee": "", "editor": "", "category": "", "buy_count": "", "sell_count": "", "content": "", "mid": 0, "item_id": 0, "shop_id": 0, "detail_url": "" } } ``` ## 9.获取商品列表通过店铺ID--OutGetGoodsListMsgByShopId ### 请求信息 ```gotemplate dll.OutGetGoodsListMsgByShopId( shopId, proxy, retPrice, isImage, sortType, sort, priceMin, priceMax, pageNum, returnNum) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|---|--| | shopId | int | 是 | 店铺ID | | proxy | string | 否 | 代理地址 | | retPrice | int | 否 | 是否返回价格 | | isImage | int | 否 | 是否有图片 | | sortType | string | 否 | 排序类型 | | sort | string | 否 | 排序方式 | | priceMin | float | 否 | 最低价格 | | priceMax | float | 否 | 最高价格 | | pageNum | int | 否 | 页码 | | returnNum | int | 否 | 每页数量 | ### 响应示例 ```json { "success": true, "message": "", "data": { "goods_num": "", "pnum": "", "book_info": [{ "author": "", "publisher": "", "isbn": "", "publication_time": 0, "edition": "", "print_time": "", "fix_price": "", "binding_layout": "", "format": "", "paper": "", "pages": "", "wordage": "", "languages": "", "era": "", "engraving_method": "", "dimensions": "", "volume_number": "", "book_pic": "", "book_pic_s": "", "selling_price": "", "condition": "", "express_delivery_fee": "", "editor": "", "category": "", "buy_count": "", "sell_count": "", "content": "", "mid": 0, "item_id": 0, "shop_id": 0, "detail_url": "" }] } } ``` ## 10.获取商品信息通过商品详情链接--OutGetGoodsMsgByDetailUrl ### 请求信息 ```gotemplate dll.OutGetGoodsMsgByDetailUrl(detailUrl,proxy) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|---|-----------| | detailUrl | string | 是 | 请求详情页的url | | proxy | string | 否 | 代理地址 | ### 响应示例 ```json { "success": true, "message": "", "data": { "author": "", "publisher": "", "isbn": "", "publication_time": 0, "edition": "", "print_time": "", "fix_price": "", "binding_layout": "", "format": "", "paper": "", "pages": "", "wordage": "", "languages": "", "era": "", "engraving_method": "", "dimensions": "", "volume_number": "", "book_pic": "", "book_pic_s": "", "selling_price": "", "condition": "", "express_delivery_fee": "", "editor": "", "category": "", "buy_count": "", "sell_count": "", "content": "", "mid": 0, "item_id": 0, "shop_id": 0, "detail_url": "" } } ``` ## 11.获取销量榜商品列表--OutGetTopGoodsListMsg ### 请求信息 ```gotemplate dll.OutGetTopGoodsListMsg(catId,proxy) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|---|---------| | catId | int | 是 | 销量榜类型ID | | proxy | string | 否 | 代理地址 | ### 响应示例 ```json { "success": true, "message": "", "data": { "status": true, "result": { "current": 1, "data": [ { "author": "吴承恩 著", "bookName": "西游记", "contentIntroduction": "在中国古代小说中,《西游记(评注本)》是一部思想性和艺术性都臻于第一流的伟大作品。它也是明代长篇小说的重要流派之一神魔小说的代表作,是中国古代神魔小说的翘楚、浪漫文学的代表,作者以其丰富的艺术想象力建构了一个光怪陆离的神话世界,并塑造出以孙悟空、猪八戒为代表的一批性格鲜明、影响深远的文学形象,数百年来一直为人们所喜闻乐见。《西游记(评注本)》主要描写的是孙悟空保唐僧西天取经,历经九九八十一难的故事", "imgUrl": "https://booklibimg.kfzimg.com/data/book_lib_img_v2/isbn/1/536c/536c60e36e75bf67f43d790901fc0fe2_0_1_300_300.jpg", "isbn": "9787540310097", "itemUrls": { "appUrl": "kongfz://app.kongfz.com?page=isbnDetail&mid=52528207", "mUrl": "https://m.kongfz.com/item/52528207/", "miniUrl": "/pages/bookdetail/bookdetail?mid=52528207", "pcUrl": "https://item.kongfz.com/book/52528207.html" }, "mid": 52528207, "newMinPrice": "3.45", "oldMinPrice": "0.20", "press": "崇文书局", "price": "15.00", "pubDate": "2006-05", "riseTag": "", "authorArr": [ { "name": "吴承恩", "oriName": "", "nationality": "", "role": "著", "url": "https://search.kongfz.com/item_result/?status=0&select=2&author=hk5434k627fk6069" } ], "pressUrl": "https://search.kongfz.com/item_result/?status=0&press=hk5d07k6587k4e66k5c40" } ], "total": 100 }, "errMessage": "", "errCode": 0 } } ``` ## 12.获取配送方式列表--KongfzDeliveryMethodList ### 请求信息 ```gotemplate dll.KongfzDeliveryMethodList(appId C.int, appSecret, accessToken *C.char) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|----------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息。 | ### 响应示例 ```json { "requestId": "EGLJzOwutBCR9RDE", "requestMethod": "kongfz.delivery.method.list", "successResponse": [ { "shippingId": "registerPost", "shippingName": "挂号印刷品", "isDefault": false, "companies": [ { "shippingCom": "registeredPrint", "shippingComName": "邮局", "isDefault": false } ] }, { "shippingId": "express", "shippingName": "快递", "isDefault": false, "companies": [ { "shippingCom": "huitongkuaidi", "shippingComName": "百世快递", "isDefault": true }, { "shippingCom": "yunda", "shippingComName": "韵达快递", "isDefault": false, }, ] }, { "shippingId": "generalParcel", "shippingName": "普通包裹", "isDefault": false, "companies": [ { "shippingCom": "generalParcel", "shippingComName": "邮局", "isDefault": false } ] }, { "shippingId": "ems", "shippingName": "EMS", "isDefault": false, "companies": [ { "shippingCom": "ems", "shippingComName": "邮局", "isDefault": false } ] }, { "shippingId": "noLogistics", "shippingName": "无需物流", "isDefault": false, "companies": [] } ], "errorResponse": null } ``` ## 13.订单发货--KongfzOrderDeliver ### 请求信息 ```gotemplate dll.KongfzOrderDeliver(appId, appSecret, accessToken , orderId , shippingId, shippingCom, shipmentNum, userDefined, moreShipmentNum ) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--------|----|-------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | orderId | int | 是 | 订单编号 | | shippingId | string | 是 | 配送方式 | | shippingCom | string | 否 | 快递公司。当shippingId!=noLogistics时,此参数为必填。取值参考kongfz.delivery.method.list接口的返回值 | | shipmentNum | string | 否 | 快递单号。当shippingId!=noLogistics时,此参数为必填。 | | userDefined | string | 否 | 用户自定义物流公司。当shippingCom=other时,此参数为必填。 | | moreShipmentNum | string | 否 | 填写更多的快递单号,以逗号分隔。 | ### 响应示例 ```json { "requestId": "bbXrGb2dOBRRDRBL", "requestMethod": "kongfz.order.deliver", "successResponse": { "order": { "orderId": 73609014, "remark": "订单发货成功", "updateTime": "2019-05-22 16:32:08" } }, "errorResponse": null } ``` ## 14.孔网订单同步--KongfzOrderSynchronization ### 请求信息 ```gotemplate result, err := dll.KongfzOrderSynchronization(appId, appSecret, accessToken, shippingComName, orderId, shippingId, shippingCom, shipmentNum, userDefined, moreShipmentNum) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|-----------------------------------------------------------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | shippingComName | string | 是 | 快递名称 | | orderId | int | 是 | 订单编号 | | shippingId | string | 否 | 配送方式 | | shippingCom | string | 否 | 快递公司。当shippingId!=noLogistics时,此参数为必填。取值参考kongfz.delivery.method.list接口的返回值 | | shipmentNum | string | 否 | 快递单号。当shippingId!=noLogistics时,此参数为必填。 | | userDefined | string | 否 | 用户自定义物流公司。当shippingCom=other时,此参数为必填。 | | moreShipmentNum | string | 否 | 填写更多的快递单号,以逗号分隔。 | ### 响应示例 ```json { "requestId": "bbXrGb2dOBRRDRBL", "requestMethod": "kongfz.order.deliver", "successResponse": { "order": { "orderId": 73609014, "remark": "订单发货成功", "updateTime": "2019-05-22 16:32:08" } }, "errorResponse": null } ``` ## 15.上传图片接口--KongfzImageUpload ### 请求信息 ```gotemplate dll.KongfzImageUpload(appId, appSecret, accessToken, filePath, savePath) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|-------------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | filePath | string | 是 | 图片url/本地图片路径 | | savePath | string | 是 | 图片下载路径,如果是图片url需要下载到本地 | ### 响应示例 ```json { "requestId": "bAo3ZN679gaPgR9Y", "requestMethod": "kongfz.image.upload", "successResponse": { "image": { "url": "https://www.kfzimg.com/sw/kfzimg/2868/02698c12fec32cc69c_s.jpg" //图片地址 } }, "errorResponse": null } ``` ## 16.添加店铺商品--KongfzShopItemAdd ### 请求信息 ```gotemplate dll.KongfzShopItemAdd(appId, appSecret, accessToken, shopItemAddJson) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|-------------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | shopItemAddJson | string | 是 | 店铺商品请求结构体字符串 | #### shopItemAddJson 请求结构体 添加商品的业务参数比较复杂,根据商品分类的不同,适配不同的模板。以下参数将分别列出模板公共参数和模板特有参数。 可以查看:https://open.kongfz.com/doc/api/shop/kongfz-shop-item-add ### 成功响应示例 ```json { "kongfzShopItemAddResponse": { "requestId": "mKPxiCD0dgaPSRib", "requestMethod": "kongfz.shop.item.add", "successResponse": { "item": { "itemId": 1343492600, //商品编号 "addTime": "2019-06-22 16:12:17" //添加时间 } }, "errorResponse": null } } ``` ### 失败响应示例 ```json { "requestId": "8lDbCNSxzH4UHRx8", "requestMethod": "kongfz.shop.item.add", "successResponse": null, "errorResponse": { "code": 3003, "msg": "Service error", "subCode": "Failed To Add Item", "subMsg": "添加商品失败", "data": { //字段错误的具体信息会在data中给出,key是出错的字段名,value是错误的原因 "mouldId": "请先添加运费模板" } } } ``` ## 17.查询订单列表--KongfzOrderList ### 请求信息 ```gotemplate dll.KongfzOrderList(appId, appSecret, accessToken, orderListJson) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|-------------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | orderListJson | string | 是 | 查询订单请求结构体字符串 | #### orderListJson 请求结构体 ```json { "userType": "String", "orderStatus": "String", "pageNum": "Integer", "pageSize": "Integer", "isDelete": "Integer", "startDate": "String", "endDate": "String", "startTime": "String", "endTime": "String", "startUpdateTime": "String", "endUpdateTime": "String" } ``` ### 响应示例 ```json { "requestId": "VNI5AWvIW5cRLR9l", "requestMethod": "kongfz.order.list", "successResponse": { "total": 5, //总条数 "pages": 1, //总页数 "size": 5, //当前页条数 "pageSize": 20, //每页最大条数 "pageNum": 1, //当前页码 "list": [ //订单列表 { "orderId": 25259131, //订单编号 "createdTime": "2014/06/25 14:36:59", //订单生成时间 "shopId": 22281, //店铺编号 "shopName": "俞含的书摊", //店铺名称 "shopkeeperId": 2522488, //卖家用户编号 "shipmentNum": "", //快递单号 "shippingCom": "", //快递公司编码 "shippingComName": "", //快递公司名称 "shippingId": "express", //配送方式 "shippingName": "快递", //配送方式名称 "shippingFee": "8.00", //快递费 "goodsAmount": "15.00", //订单商品金额 "favorableMoney": "0.00", //商品优惠金额 "orderAmount": "23.00", //订单金额 "userId": 3723679, //买家用户编号 "nickname": "买家昵称", //买家昵称 "receiver": "姓名, 18812345678, 山东省青岛市市北区顺兴路152号404户, 266021", //收件人信息 "receiverInfo": { "area": "24006002000", "zipCode": "266021", "provName": "山东省", "address": "顺兴路152号404户", "cityName": "青岛市", "areaName": "市北区", "receiverName": "姓名", "mobile": "18812345678", "phoneNum": "" }, "sellerFlagType": 1, //备注类型,孔网是按颜色区分,0是未打标记,1:红,2:黄,3:绿,4:蓝,5:紫 "sellerRemarkText": "测试备注信息", "orderStatus": "SellerCancelledBeforeConfirm", //订单状态 "orderStatusName": "卖家已取消", //订单状态名称 "promotionId": 0, //活动编号 "itemsCount": 1, //订单商品数 "items": [ //订单商品 { "itemId": 250140272, //商品编号 "itemSn": "740", //商品货号 "number": 1, //购买商品数 "itemName": "玉娇龙 下", //商品名称 "img": "", //商品图片 "isCancel": false, //商品是否被取消 "orderId": 25259131, //订单编号 "price": "15.00", //商品价格 "favorableAmount": "0.00", //商品总优惠金额,即:setFavAmount+couponFavAmount,如果购买了多件,为多件商品的总优惠 "setFavAmount": "0.00", //卖家设置优惠金额,卖家设置的订单优惠均摊到商品上的优惠,如果购买了多件,为多件商品的总优惠 "couponFavAmount": "0.00", //优惠券优惠金额,订单使用了优惠券时,均摊到商品上的优惠金额,如果购买了多件,为多件商品的总优惠 "realAmount": "15.00", //商品实付金额, 如果购买了多件,为多件商品的实付总金额 "cancelMan": "unkown", //取消商品者,unkown:未知,seller:卖家,buyer:买家 "quality": "", //商品品相 "isbn": "" //图书ISBN } ] }, ] }, "errorResponse": null } ``` ## 18.整合添加商品和获取孔网图片--OutAddGoodsAndFile ### 请求信息 ```gotemplate dll.OutAddGoodsAndFile(token, proxy, filePath, formData) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|---------------------------| | token | string | 是 | 孔网token | | proxy | string | 是 | 代理服务器IP | | filePath | string | 否 | 图片路径 | | formData | string | 是 | 商品JSON字符串 | ### 成功响应示例 ```json { "data":9395776720, "errType":"", "message":"", "status":1 } ``` ## 查询单个订单--KongfzOrderGet ### 请求信息 ```gotemplate dll.KongfzOrderGet(appId, appSecret, accessToken, userType,orderId) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|----|---------------------------| | appId | int | 是 | 开放平台分配给应用的AppId | | appSecret | string | 是 | App密钥 | | accessToken | string | 否 | 用户登录授权成功后,开放平台颁发给应用的授权信息 | | userType | string | 是 | 用户类型。取值 seller: 卖家;buyer: 买家 | | orderId | string | 是 | 订单编号 | ### 成功响应示例 ```json { "requestId": "GH13BxApG5mRPRl0", "requestMethod": "kongfz.order.get", "successResponse": { "orderId": 73412393, //订单编号 "createdTime": "2019-05-13 09:31:26", //订单生成时间 "shopId": 24671, //店铺编号 "shopName": "网上测试书店(不售书)", //店铺名称 "shopkeeperId": 3361935, //卖家用户编号 "shipmentNum": "sa04465846222", //快递单号 "shippingCom": "registeredPrint", //快递公司编码 "shippingComName": "挂号印刷品", //快递公司名称 "shippingId": "registerPost", //配送方式 "shippingName": "挂号印刷品", //配送方式名称 "shippingFee": "10.00", //运费 "goodsAmount": "1.00", //商品金额 "favorableMoney": "0.00", //订单商品优惠金额 "orderAmount": "11.00", //订单金额 "userId": 3361935, //用户编号 "nickname": "网络测试书店", //用户昵称 "receiver": "姓名, 18812345678, 山东省青岛市市北区顺兴路152号404户, 266021", //收件人信息 "receiverInfo": { "area": "24006002000", "zipCode": "266021", "provName": "山东省", "address": "顺兴路152号404户", "cityName": "青岛市", "areaName": "市北区", "receiverName": "姓名", "mobile": "18812345678", "phoneNum": "" }, "sellerFlagType": 1, //备注类型,孔网是按颜色区分,0是未打标记,1:红,2:黄,3:绿,4:蓝,5:紫 "sellerRemarkText": "测试备注信息", "orderStatus": "Shipped-Returning", //订单状态 "orderStatusName": "申请退货中", //订单状态名称 "promotionId": 0, //活动编号 "itemsCount": 1, //订单商品数 "items": [ //订单商品 { "itemId": 1265078240, //商品编号 "itemSn": "", //商品货号 "number": 1, //购买商品数 "itemName": "测试勿拍19051003", //商品名称 "img": "//www.kfzimg.com/G07/M00/10/0E/q4YBAFzVOgGAUQvkAAFgEf3-3BU117_s.jpg",//商品图片 "isCancel": false, //商品是否被取消 "orderId": 73412393, //订单编号 "price": "1.00", //商品价格 "favorableAmount": "0.00", //商品总优惠金额,即:setFavAmount+couponFavAmount,如果购买了多件,为多件商品的总优惠 "setFavAmount": "0.00", //卖家设置优惠金额,卖家设置的订单优惠均摊到商品上的优惠,如果购买了多件,为多件商品的总优惠 "couponFavAmount": "0.00", //优惠券优惠金额,订单使用了优惠券时,均摊到商品上的优惠金额,如果购买了多件,为多件商品的总优惠 "realAmount": "1.00", //商品实付金额, 如果购买了多件,为多件商品的实付总金额 "cancelMan": "unkown", //取消商品者,unkown:未知,seller:卖家,buyer:买家 "quality": "六五品", //商品品相 "isbn": "" //图书ISBN }, ], "express": [ //物流信息 { "context": "已签收,他人代收:中通快递收,投递员:齐东事:18226889971," "time": "2019-05-20 11:47:38", "status": "签收" //状态字段不是都存在,一般只存在于最新的一条记录中 }, ... ], "records": [ //订单操作记录 { "nickname": "网络测试书店", "remark": "买家创建退货协议", "time": "2019-05-19 16:38:59", "userType": "buyer" }, ... ] }, "errorResponse": null } ``` ## 12.初始化--Initialize(可以不调用) ### 请求信息 ```gotemplate result, err := dll.Initialize(configJSON) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|--|----------------| | configJSON | string | 是 | 配置信息的 JSON 字符串 | ### 响应示例 ```json { "success": true, "message": "初始化成功" } ``` ## 12.释放C字符串内存--FreeCString ### 请求信息 ```gotemplate dll.FreeCString(str) ``` ### 请求参数 | 参数名 | 类型 | 必填 | 说明 | |--|--|--|----------| | str | string | 是 | 需要释放的字符串 |