@taole/newgiftbar 0.0.6 → 0.0.8
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/README.md +3 -0
- package/npm/newgiftbar.es.js +64 -11
- package/package.json +1 -1
package/README.md
CHANGED
package/npm/newgiftbar.es.js
CHANGED
|
@@ -628,8 +628,8 @@ const options = {
|
|
|
628
628
|
*/
|
|
629
629
|
clickGiftItem: null,
|
|
630
630
|
/**
|
|
631
|
-
*
|
|
632
|
-
*
|
|
631
|
+
* 底部确认后的厅内独占执行。type 30/37 已在栏内 giveGift,不再走这里。
|
|
632
|
+
* 特赦卡 type=29 也在栏内。目前新栏底部不再调用。
|
|
633
633
|
* @type {(payload: { gift: object, tabId: number|string, count?: number, selectUser?: object }) => void|Promise<void>}
|
|
634
634
|
*/
|
|
635
635
|
useGiftAsync: null,
|
|
@@ -888,6 +888,13 @@ const IM_DEFAULT_MAGIC_TIP_LINK = "https://y.tuwan.com/activity/36C33a2de?v=1656
|
|
|
888
888
|
function isPackageTab(tabId) {
|
|
889
889
|
return PACKAGE_TAB_IDS.indexOf(Number(tabId)) > -1;
|
|
890
890
|
}
|
|
891
|
+
function isHallGiveGift(gift) {
|
|
892
|
+
const type = Number(gift && gift.type);
|
|
893
|
+
return type === 30 || type === 37;
|
|
894
|
+
}
|
|
895
|
+
function isRoomHallGiveGift(gift) {
|
|
896
|
+
return !isImSource() && isHallGiveGift(gift);
|
|
897
|
+
}
|
|
891
898
|
function getVipLevelUrl() {
|
|
892
899
|
return "https://y" + (options.isChatTest ? "-test" : "") + ".tuwan.com/vip_level";
|
|
893
900
|
}
|
|
@@ -1246,9 +1253,6 @@ function resolveFooterAction(action, gift, tabId, selectedUser) {
|
|
|
1246
1253
|
if (Number(gift.question_gift) === 1) {
|
|
1247
1254
|
return { kind: "question" };
|
|
1248
1255
|
}
|
|
1249
|
-
if (type === 30 || type === 37) {
|
|
1250
|
-
return { kind: "hostUse" };
|
|
1251
|
-
}
|
|
1252
1256
|
if (id === 1293 && uid === 0) {
|
|
1253
1257
|
return { kind: "alert", message: "该礼物不能赠送全麦" };
|
|
1254
1258
|
}
|
|
@@ -4581,6 +4585,22 @@ function buildPayUrl({ gift, tabId, count, action, ctx, extra }) {
|
|
|
4581
4585
|
const paySure = extra && extra.pay_sure !== void 0 ? extra.pay_sure : 0;
|
|
4582
4586
|
const question = extra && extra.question || "";
|
|
4583
4587
|
const open = extra && extra.open || 0;
|
|
4588
|
+
if (isRoomHallGiveGift(gift)) {
|
|
4589
|
+
return giveGiftUrl(
|
|
4590
|
+
platformPrefixQuery([
|
|
4591
|
+
["giftid", giftId],
|
|
4592
|
+
["teacherid", 0],
|
|
4593
|
+
["is_whole_wheat", 0],
|
|
4594
|
+
["num", count],
|
|
4595
|
+
["cid", ctx.cid],
|
|
4596
|
+
["worth", worth],
|
|
4597
|
+
["question_gift", 0],
|
|
4598
|
+
["question", ""],
|
|
4599
|
+
["open", 0],
|
|
4600
|
+
...extraParts(ctx, extra)
|
|
4601
|
+
])
|
|
4602
|
+
);
|
|
4603
|
+
}
|
|
4584
4604
|
if (isPackageTab(navid)) {
|
|
4585
4605
|
if (type === 7) {
|
|
4586
4606
|
if (isImSource()) {
|
|
@@ -5861,6 +5881,15 @@ function pickError(response, meta) {
|
|
|
5861
5881
|
if (!response) {
|
|
5862
5882
|
return -99;
|
|
5863
5883
|
}
|
|
5884
|
+
if (isRoomHallGiveGift(meta && meta.gift)) {
|
|
5885
|
+
if (Object.prototype.hasOwnProperty.call(response, "error")) {
|
|
5886
|
+
return response.error;
|
|
5887
|
+
}
|
|
5888
|
+
if (Object.prototype.hasOwnProperty.call(response, "code")) {
|
|
5889
|
+
return response.code;
|
|
5890
|
+
}
|
|
5891
|
+
return -99;
|
|
5892
|
+
}
|
|
5864
5893
|
if (isPackageOrdinaryGift(meta) && Object.prototype.hasOwnProperty.call(response, "code")) {
|
|
5865
5894
|
return response.code;
|
|
5866
5895
|
}
|
|
@@ -5897,9 +5926,18 @@ async function requestPay(url, meta) {
|
|
|
5897
5926
|
const response = await options.request(url);
|
|
5898
5927
|
const error = pickError(response, meta);
|
|
5899
5928
|
if (error === 0) {
|
|
5929
|
+
if (isRoomHallGiveGift(meta && meta.gift) && String(response.code) === "9" && response.error_msg) {
|
|
5930
|
+
alertMsg(response.error_msg);
|
|
5931
|
+
}
|
|
5900
5932
|
notifyPaySuccess(meta, response, url);
|
|
5901
5933
|
return response;
|
|
5902
5934
|
}
|
|
5935
|
+
if (error === 9 && isRoomHallGiveGift(meta && meta.gift)) {
|
|
5936
|
+
if (response.error_msg) {
|
|
5937
|
+
alertMsg(response.error_msg);
|
|
5938
|
+
}
|
|
5939
|
+
return response;
|
|
5940
|
+
}
|
|
5903
5941
|
if (error === 199) {
|
|
5904
5942
|
return response;
|
|
5905
5943
|
}
|
|
@@ -5932,6 +5970,13 @@ async function requestPay(url, meta) {
|
|
|
5932
5970
|
checkboxText: row && row.remark || "今日不再提示"
|
|
5933
5971
|
});
|
|
5934
5972
|
if (choice.ok) {
|
|
5973
|
+
if (isRoomHallGiveGift(meta && meta.gift)) {
|
|
5974
|
+
const remind = choice.checked ? 2 : 1;
|
|
5975
|
+
return requestPay(appendQuery(url, { remind }), {
|
|
5976
|
+
...meta,
|
|
5977
|
+
extra: { ...meta.extra || {}, remind }
|
|
5978
|
+
});
|
|
5979
|
+
}
|
|
5935
5980
|
return requestPay(appendQuery(url, { pay_sure: choice.checked ? 2 : 1 }), {
|
|
5936
5981
|
...meta,
|
|
5937
5982
|
extra: { ...meta.extra || {}, pay_sure: choice.checked ? 2 : 1 }
|
|
@@ -5954,7 +5999,7 @@ async function requestPay(url, meta) {
|
|
|
5954
5999
|
return response;
|
|
5955
6000
|
}
|
|
5956
6001
|
if (error === -2) {
|
|
5957
|
-
if (isPackageOrdinaryGift(meta)) {
|
|
6002
|
+
if (isPackageOrdinaryGift(meta) || isRoomHallGiveGift(meta && meta.gift)) {
|
|
5958
6003
|
alertMsg(response.error_msg || "赠送失败");
|
|
5959
6004
|
return response;
|
|
5960
6005
|
}
|
|
@@ -6005,7 +6050,7 @@ async function payGiftAction({ gift, tabId, count, selectedUser, action, extra }
|
|
|
6005
6050
|
options.onQuestionGift({ gift, tabId, count, selectedUser, ctx });
|
|
6006
6051
|
return null;
|
|
6007
6052
|
}
|
|
6008
|
-
if (source !== "im" && action === "send" && selectedUser) {
|
|
6053
|
+
if (source !== "im" && action === "send" && selectedUser && !isRoomHallGiveGift(gift)) {
|
|
6009
6054
|
if (Number(selectedUser.uid) === Number(ctx.selfUid) && !canSendToSelf(gift, tabId)) {
|
|
6010
6055
|
alertMsg("自己不能送给自己礼物");
|
|
6011
6056
|
return null;
|
|
@@ -6040,15 +6085,20 @@ async function payGiftAction({ gift, tabId, count, selectedUser, action, extra }
|
|
|
6040
6085
|
}
|
|
6041
6086
|
}
|
|
6042
6087
|
}
|
|
6088
|
+
const payExtra = {
|
|
6089
|
+
...extra || {},
|
|
6090
|
+
// 对标 onlySendGift:成功不发 giftall,公屏靠服务端
|
|
6091
|
+
...isRoomHallGiveGift(gift) ? { skipPaySuccess: true } : {}
|
|
6092
|
+
};
|
|
6043
6093
|
const url = buildPayUrl({
|
|
6044
6094
|
gift,
|
|
6045
6095
|
tabId,
|
|
6046
6096
|
count,
|
|
6047
6097
|
action,
|
|
6048
6098
|
ctx,
|
|
6049
|
-
extra:
|
|
6099
|
+
extra: payExtra
|
|
6050
6100
|
});
|
|
6051
|
-
return requestPay(url, { gift, tabId, count, selectedUser, action, ctx, extra:
|
|
6101
|
+
return requestPay(url, { gift, tabId, count, selectedUser, action, ctx, extra: payExtra });
|
|
6052
6102
|
}
|
|
6053
6103
|
class SvgaPlayer {
|
|
6054
6104
|
constructor() {
|
|
@@ -19832,8 +19882,11 @@ function instance($$self, $$props, $$invalidate) {
|
|
|
19832
19882
|
selectedUser: currentUser,
|
|
19833
19883
|
action: cmd.payAction || "send"
|
|
19834
19884
|
});
|
|
19835
|
-
const
|
|
19836
|
-
|
|
19885
|
+
const hallGive = isRoomHallGiveGift(selectGiftItem);
|
|
19886
|
+
const ok = response && (response.error === 0 || response.code === 0 || hallGive && (response.error === 9 || String(response.code) === "9"));
|
|
19887
|
+
if (ok && hallGive) {
|
|
19888
|
+
await updateView();
|
|
19889
|
+
} else if (ok && Number(selectGiftItem.type) === 24 && isPackageTab(activeTabId)) {
|
|
19837
19890
|
setTimeout(() => getBaoguo(true), 1500);
|
|
19838
19891
|
} else if (isPackageTab(activeTabId)) {
|
|
19839
19892
|
getBaoguo(true);
|