@bty/customer-service-cli 0.4.1 → 0.4.2
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/dist/bin.js +33 -0
- package/package.json +1 -1
package/dist/bin.js
CHANGED
|
@@ -1677,6 +1677,9 @@ async function updateIssue(issueId, data) {
|
|
|
1677
1677
|
body: data
|
|
1678
1678
|
});
|
|
1679
1679
|
}
|
|
1680
|
+
async function updateIssueOwner(issueId, params) {
|
|
1681
|
+
return updateIssue(issueId, params);
|
|
1682
|
+
}
|
|
1680
1683
|
async function listIssueComments(issueId) {
|
|
1681
1684
|
const request = createRequest();
|
|
1682
1685
|
return request(getCustomerServiceUrl(), `/v1/issues/${issueId}/comments`, {
|
|
@@ -1779,6 +1782,36 @@ function registerIssueCommand(program2) {
|
|
|
1779
1782
|
process.exit(toExitCode(err));
|
|
1780
1783
|
}
|
|
1781
1784
|
});
|
|
1785
|
+
issue.command("update-owner").description(
|
|
1786
|
+
"\u66F4\u65B0\u5DE5\u5355\u8D1F\u8D23\u4EBA\uFF08owner\uFF09\u3002\u4EC5\u4E8C\u9009\u4E00\uFF1A--owner <user_id> \u6216 --owner-phone <\u624B\u673A\u53F7>\uFF0C\u540E\u8005\u7531\u670D\u52A1\u7AEF\u89E3\u6790\u4E3A user_id\u3002\u6CE8\u610F\uFF1A\u540E\u7AEF\u9700\u5F00\u542F\u5BF9 owner / owner_phone \u5B57\u6BB5\u7684\u652F\u6301\u540E\u8BE5\u547D\u4EE4\u624D\u80FD\u751F\u6548"
|
|
1787
|
+
).argument("<issue_id>", "\u5DE5\u5355 ID\uFF08\u4ECE issue list \u83B7\u53D6\uFF09").option("--owner <user_id>", "\u8D1F\u8D23\u4EBA user_id\uFF08\u6B63\u6574\u6570\uFF09").option("--owner-phone <phone>", "\u8D1F\u8D23\u4EBA\u624B\u673A\u53F7\uFF08\u7531\u670D\u52A1\u7AEF\u89E3\u6790\u4E3A user_id\uFF09").action(async (issueId, opts) => {
|
|
1788
|
+
try {
|
|
1789
|
+
const hasOwner = opts.owner !== void 0;
|
|
1790
|
+
const hasPhone = opts.ownerPhone !== void 0;
|
|
1791
|
+
if (hasOwner === hasPhone) {
|
|
1792
|
+
throw new Error("\u5FC5\u987B\u4E14\u4EC5\u80FD\u63D0\u4F9B --owner \u6216 --owner-phone \u5176\u4E2D\u4E00\u4E2A");
|
|
1793
|
+
}
|
|
1794
|
+
const body = {};
|
|
1795
|
+
if (hasOwner) {
|
|
1796
|
+
const ownerId = Number(opts.owner);
|
|
1797
|
+
if (!Number.isInteger(ownerId) || ownerId <= 0) {
|
|
1798
|
+
throw new Error(`--owner \u5FC5\u987B\u4E3A\u6B63\u6574\u6570\uFF0C\u6536\u5230: ${opts.owner}`);
|
|
1799
|
+
}
|
|
1800
|
+
body.owner = ownerId;
|
|
1801
|
+
} else {
|
|
1802
|
+
const phone = String(opts.ownerPhone).trim();
|
|
1803
|
+
if (!phone) {
|
|
1804
|
+
throw new Error("--owner-phone \u4E0D\u80FD\u4E3A\u7A7A");
|
|
1805
|
+
}
|
|
1806
|
+
body.owner_phone = phone;
|
|
1807
|
+
}
|
|
1808
|
+
const data = await updateIssueOwner(issueId, body);
|
|
1809
|
+
formatOutput({ success: true, data }, program2.opts().table);
|
|
1810
|
+
} catch (err) {
|
|
1811
|
+
reportCaughtError(err);
|
|
1812
|
+
process.exit(toExitCode(err));
|
|
1813
|
+
}
|
|
1814
|
+
});
|
|
1782
1815
|
issue.command("stats").description("\u8DE8\u5DE5\u4F5C\u7A7A\u95F4 Issue \u6570\u91CF\u7EDF\u8BA1\uFF0C\u8FD4\u56DE\u6BCF\u4E2A\u5DE5\u4F5C\u7A7A\u95F4\u7684 open/closed/total \u8BA1\u6570").option("--start <date>", "\u5F00\u59CB\u65E5\u671F\uFF08YYYY-MM-DD \u683C\u5F0F\uFF0C\u5982 2026-03-01\uFF09").option("--end <date>", "\u7ED3\u675F\u65E5\u671F\uFF08YYYY-MM-DD \u683C\u5F0F\uFF0C\u5982 2026-03-23\uFF09").action(async (opts) => {
|
|
1783
1816
|
try {
|
|
1784
1817
|
const data = await getIssueStats({
|