publishport-opencli 1.0.34 → 1.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli-manifest.json CHANGED
@@ -51077,7 +51077,14 @@
51077
51077
  "type": "str",
51078
51078
  "default": "ALL",
51079
51079
  "required": false,
51080
- "help": "订单状态筛选:ALL / WAITING_PAY / WAITING_SEND / WAITING_RECEIVE / WAITING_RATE / SUCCESS / REFUND"
51080
+ "help": "订单状态筛选:ALL / NOT_PAY / NOT_SHIP / SHIPPED / REFUND / TRADE_CLOSED / TRADE_SUCCESS"
51081
+ },
51082
+ {
51083
+ "name": "order_id",
51084
+ "type": "str",
51085
+ "default": "",
51086
+ "required": false,
51087
+ "help": "只查这一个订单号(order-get 的详情接口报「闲鱼太累了」时用它核实到账)"
51081
51088
  }
51082
51089
  ],
51083
51090
  "columns": [
@@ -51086,7 +51093,7 @@
51086
51093
  "buyer_nick",
51087
51094
  "status_str",
51088
51095
  "total_price",
51089
- "create_time"
51096
+ "pay_time"
51090
51097
  ],
51091
51098
  "type": "js",
51092
51099
  "modulePath": "xianyu/order.js",
@@ -1 +1 @@
1
- import{ArgumentError as w}from"@jackwener/opencli/errors";import{cli as l,Strategy as _}from"@jackwener/opencli/registry";import{HOME_URL as p,mtopRequest as g}from"./mtop.js";import{normalizeNumericId as c}from"./utils.js";const y=["ALL","WAITING_PAY","WAITING_SEND","WAITING_RECEIVE","WAITING_RATE","SUCCESS","REFUND"];function S(e){const r=String(e||"ALL").trim().toUpperCase();if(!y.includes(r))throw new w(`xianyu order --status must be one of: ${y.join(", ")}`);return r}function b(e,r){const t=String(e??"").trim();if(!t)return 1;if(!/^\d+$/.test(t)||Number(t)<1)throw new w(`xianyu order ${r} must be a positive integer`);return Number(t)}l({site:"xianyu",name:"order",access:"read",description:"列出卖家已售订单(可按状态筛选)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"page",type:"int",default:1,help:"页码,从 1 开始"},{name:"page_size",type:"int",default:20,help:"每页条数"},{name:"status",default:"ALL",help:`订单状态筛选:${y.join(" / ")}`}],columns:["order_id","item_id","buyer_nick","status_str","total_price","create_time"],func:async(e,r)=>{const t=b(r.page,"page"),s=b(r.page_size,"page_size"),o=S(r.status);await e.goto(p);await e.wait(1);const u=(await g(e,"order list",{api:"mtop.taobao.idle.trade.merchant.sold.get",data:{pageNumber:t,rowsPerPage:s,orderIds:"",queryCode:o,orderSearchParam:"{}"},version:"1.0"})).module||{},d=(Array.isArray(u.items)?u.items:[]).map((a)=>{const i=a.order||a.orderInfo||a,m=a.buyer||a.buyerInfo||{},I=a.item||a.itemInfo||{};return{order_id:String(i.orderId||i.bizOrderId||i.id||""),item_id:String(I.itemId||I.id||""),item_title:I.title||"",buyer_id:String(m.userId||m.buyerId||""),buyer_nick:m.nick||m.userNick||"",status:i.status??i.orderStatus??"",status_str:i.statusStr||i.orderStatusStr||"",total_price:String(i.totalPrice||i.actualPrice||""),create_time:String(i.createTime||i.gmtCreate||"")}});return d.length?d:[{order_id:"",status_str:"(无已售订单)",total_price:"",buyer_nick:"",item_id:"",create_time:""}]}});l({site:"xianyu",name:"order-get",access:"read",description:"查询单个闲鱼订单详情",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 orderId"},{name:"role",default:"seller",help:"视角:seller / buyer"}],columns:["order_id","item_id","status_str","total_price","buyer_nick"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000"),s=String(r.role||"seller").trim()==="buyer"?"buyer":"seller";await e.goto(p);await e.wait(1);const o=await g(e,"order get",{api:"mtop.idle.web.trade.order.detail",data:{orderId:t,role:s},version:"1.0"}),n=o.itemInfoDTO||{},u=o.buyerInfoDTO||{},f=o.sellerInfoDTO||{},d=o.priceInfoDTO||{},a=o.logisticsInfoDTO||{},i=o.statusInfoDTO||{};return[{order_id:t,role:s,item_id:String(n.itemId||""),title:n.title||"",main_pic:n.picUrl||"",quantity:Number(n.quantity||1),buyer_id:String(u.buyerId||""),buyer_nick:u.userNick||"",seller_id:String(f.sellerId||""),seller_nick:f.userNick||"",total_price:String(d.totalPrice||""),auction_price:String(d.auctionPrice||""),post_fee:String(d.postFee||""),status:i.orderStatus,status_str:i.orderStatusStr||"",logistic_no:a.logisticsNo||"",logistic_company:a.logisticsCompany||""}]}});l({site:"xianyu",name:"order-ship-dummy",access:"write",description:"虚拟发货(仅虚拟商品,无需物流单号)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 orderId"},{name:"text",fromFile:!0,default:"",help:"发货附言(可选)"}],columns:["order_id","ok"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000");await e.goto(p);await e.wait(1);const s=await g(e,"order ship-dummy",{api:"mtop.taobao.idle.logistic.consign.dummy",data:{orderId:t,tradeText:String(r.text||""),picList:[],newUnconsign:!0},version:"1.0"});return[{order_id:t,ok:!0,data:s}]}});l({site:"xianyu",name:"order-ship-freeshipping",access:"write",description:"包邮发货(拼团活动专用)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 bizOrderId"},{name:"item_id",required:!0,help:"商品 itemId"},{name:"buyer_id",required:!0,help:"买家 userId"}],columns:["order_id","ok"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000"),s=c(r.item_id,"item_id","1017530128619"),o=c(r.buyer_id,"buyer_id","2208502750464");await e.goto(p);await e.wait(1);const n=await g(e,"order ship-freeshipping",{api:"mtop.idle.groupon.activity.seller.freeshipping",data:{bizOrderId:t,itemId:Number(s),buyerId:Number(o)},version:"1.0"});return[{order_id:t,ok:!0,data:n}]}});export const __test__={normalizeStatus:S,normalizePage:b,ORDER_STATUS:y};
1
+ import{ArgumentError as b}from"@jackwener/opencli/errors";import{cli as l,Strategy as _}from"@jackwener/opencli/registry";import{HOME_URL as p,mtopRequest as g}from"./mtop.js";import{normalizeNumericId as c}from"./utils.js";const f=["ALL","NOT_PAY","NOT_SHIP","SHIPPED","REFUND","TRADE_CLOSED","TRADE_SUCCESS"];function h(e){const r=String(e||"ALL").trim().toUpperCase();if(!f.includes(r))throw new b(`xianyu order --status must be one of: ${f.join(", ")}`);return r}function w(e,r){const t=String(e??"").trim();if(!t)return 1;if(!/^\d+$/.test(t)||Number(t)<1)throw new b(`xianyu order ${r} must be a positive integer`);return Number(t)}function O(e){const r=JSON.stringify(e.rightVO||{}),t=r.match(/"orderId":"(\d{10,})"/)||r.match(/orderId=(\d{10,})/);if(t)return t[1];const i=(e.commonData||{}).orderId;return Number.isSafeInteger(i)?String(i):""}l({site:"xianyu",name:"order",access:"read",description:"列出卖家已售订单(可按状态筛选)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"page",type:"int",default:1,help:"页码,从 1 开始"},{name:"page_size",type:"int",default:20,help:"每页条数"},{name:"status",default:"ALL",help:`订单状态筛选:${f.join(" / ")}`},{name:"order_id",default:"",help:"只查这一个订单号(order-get 的详情接口报「闲鱼太累了」时用它核实到账)"}],columns:["order_id","item_id","buyer_nick","status_str","total_price","pay_time"],func:async(e,r)=>{const t=w(r.page,"page"),i=w(r.page_size,"page_size"),o=h(r.status),n=String(r.order_id||"").trim();if(n&&!/^\d+$/.test(n))throw new b("xianyu order --order_id must be digits");await e.goto(p);await e.wait(1);const d=(await g(e,"order list",{api:"mtop.taobao.idle.trade.merchant.sold.get",data:{pageNumber:t,rowsPerPage:i,orderIds:n,queryCode:o,orderSearchParam:"{}"},version:"1.0"})).module||{},u=(Array.isArray(d.items)?d.items:[]).map((a)=>{const s=a.commonData||{},I=a.buyerInfoVO||{},S=a.priceVO||{};return{order_id:O(a),item_id:String(s.itemId||""),item_title:(a.itemVO||{}).title||"",buyer_id:String(I.buyerId||""),buyer_nick:I.userNick||"",status:s.orderStatus||"",status_str:s.orderStatus||"",in_refund:Boolean(s.inRefund),total_price:String(S.totalPrice||""),refund_fee:String(S.refundFee||""),create_time:String(s.createTime||""),pay_time:String(s.paySuccessTime||""),consign_time:String(s.consignTime||"")}});return u.length?u:[{order_id:"",status_str:"(无已售订单)",total_price:"",buyer_nick:"",item_id:"",create_time:""}]}});l({site:"xianyu",name:"order-get",access:"read",description:"查询单个闲鱼订单详情",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 orderId"},{name:"role",default:"seller",help:"视角:seller / buyer"}],columns:["order_id","item_id","status_str","total_price","buyer_nick"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000"),i=String(r.role||"seller").trim()==="buyer"?"buyer":"seller";await e.goto(p);await e.wait(1);const o=await g(e,"order get",{api:"mtop.idle.web.trade.order.detail",data:{orderId:t,role:i},version:"1.0"}),n=o.itemInfoDTO||{},y=o.buyerInfoDTO||{},d=o.sellerInfoDTO||{},m=o.priceInfoDTO||{},u=o.logisticsInfoDTO||{},a=o.statusInfoDTO||{};return[{order_id:t,role:i,item_id:String(n.itemId||""),title:n.title||"",main_pic:n.picUrl||"",quantity:Number(n.quantity||1),buyer_id:String(y.buyerId||""),buyer_nick:y.userNick||"",seller_id:String(d.sellerId||""),seller_nick:d.userNick||"",total_price:String(m.totalPrice||""),auction_price:String(m.auctionPrice||""),post_fee:String(m.postFee||""),status:a.orderStatus,status_str:a.orderStatusStr||"",logistic_no:u.logisticsNo||"",logistic_company:u.logisticsCompany||""}]}});l({site:"xianyu",name:"order-ship-dummy",access:"write",description:"虚拟发货(仅虚拟商品,无需物流单号)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 orderId"},{name:"text",fromFile:!0,default:"",help:"发货附言(可选)"}],columns:["order_id","ok"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000");await e.goto(p);await e.wait(1);const i=await g(e,"order ship-dummy",{api:"mtop.taobao.idle.logistic.consign.dummy",data:{orderId:t,tradeText:String(r.text||""),picList:[],newUnconsign:!0},version:"1.0"});return[{order_id:t,ok:!0,data:i}]}});l({site:"xianyu",name:"order-ship-freeshipping",access:"write",description:"包邮发货(拼团活动专用)",domain:"www.goofish.com",strategy:_.COOKIE,navigateBefore:!1,browser:!0,args:[{name:"order_id",required:!0,positional:!0,help:"订单号 bizOrderId"},{name:"item_id",required:!0,help:"商品 itemId"},{name:"buyer_id",required:!0,help:"买家 userId"}],columns:["order_id","ok"],func:async(e,r)=>{const t=c(r.order_id,"order_id","2800000000000000000"),i=c(r.item_id,"item_id","1017530128619"),o=c(r.buyer_id,"buyer_id","2208502750464");await e.goto(p);await e.wait(1);const n=await g(e,"order ship-freeshipping",{api:"mtop.idle.groupon.activity.seller.freeshipping",data:{bizOrderId:t,itemId:Number(i),buyerId:Number(o)},version:"1.0"});return[{order_id:t,ok:!0,data:n}]}});export const __test__={normalizeStatus:h,normalizePage:w,ORDER_STATUS:f};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "publishport-opencli",
3
- "version": "1.0.34",
3
+ "version": "1.0.35",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": false