更新 新商城支付

This commit is contained in:
COMPUTER\EDY 2026-09-29 18:10:15 +08:00
parent a372023b85
commit 50656a9b78
3 changed files with 46 additions and 17 deletions

View File

@ -1,7 +1,5 @@
import * as StarterPackModule from "@/limitedTimeEvent";
const StarterPack: any = StarterPackModule as any;
import { sendCustomerPayment } from "@/goldMiner/legacyPayment";
import { failure } from "@/goldMiner/config";
import cloud from '@lafjs/cloud'
import { passOrderFields, PASS_PRICES } from '@/passCheckUpgrade';
// const token = "nika123";
@ -12,18 +10,21 @@ const appid = process.env.WX_MINIGAME_APP_ID;
import crypto from 'crypto';
const db = cloud.database();
export default async function (ctx: FunctionContext) {
console.log(ctx.body);
//console.log(ctx.query);;
try {
const openid = ctx.body.FromUserName;
let openid = ctx.body.FromUserName;
//console.log(openid);
const data = JSON.parse(ctx.body.SessionFrom);
if (String(data.propName || "").startsWith("gold_miner") || data.goldMinerTicket) {
try { return await sendCustomerPayment(ctx.body, data); } catch (error) { return failure(error); }
}
//console.log(data);
console.log(data);
if (data.tpye == "ios") {
await PostMsg(openid, "点击下方页面进行充值");
await PostImg(openid, data.outTradeNo, data.propName, data.count, data.price, data);
}
} catch (e) {
console.error("ios客服充值参数错误");
console.error("ios客服充值参数错误:" + ctx.body.SessionFrom);
console.log(ctx.body);
}
//return ctx.query.echostr;
return { data: "scuess" };
@ -101,6 +102,11 @@ async function frontsign(data) {
return signature
}
const propName = {
new_gold_1: "新版金币包1", new_gold_2: "新版金币包2", new_gold_3: "新版金币包3",
new_gold_4: "新版金币包4", new_gold_5: "新版金币包5", new_gold_6: "新版金币包6",
new_unlimited_health_bundle_8: "新版组合礼包8元", new_unlimited_health_bundle_18: "新版组合礼包18元",
new_unlimited_health_bundle_36: "新版组合礼包36元", new_unlimited_health_bundle_68: "新版组合礼包68元",
new_unlimited_health_bundle_98: "新版组合礼包98元",
reborn_Gift: "复活礼包6元", reborn_Gift_2: "复活礼包8元", reborn_Gift_3: "复活礼包10元",
reborn_Gift_4: "复活礼包12元", reborn_Gift_5: "复活礼包15元",
battlepass: '基础战令', battlepass_30: '高级战令', battlepass_12: '战令升级',
@ -152,6 +158,17 @@ async function PostMsg(OpenId, msg) {
return "ok"
}
async function PostImg(OpenId, outTradeNo, name, count, price, passInput: any = {}) {
// B 商城商品价格(分);旧商品继续沿用原流程。
const shopPrices = {
new_gold_1: 600, new_gold_2: 3000, new_gold_3: 6800,
new_gold_4: 12800, new_gold_5: 32800, new_gold_6: 64800,
new_unlimited_health_bundle_8: 800, new_unlimited_health_bundle_18: 1800,
new_unlimited_health_bundle_36: 3600, new_unlimited_health_bundle_68: 6800,
new_unlimited_health_bundle_98: 9800,
};
if (Object.prototype.hasOwnProperty.call(shopPrices, name)) {
count = 1; price = shopPrices[name];
}
const rebornPrice = { reborn_Gift: 600, reborn_Gift_2: 800, reborn_Gift_3: 1000, reborn_Gift_4: 1200, reborn_Gift_5: 1500 };
if (/^reborn_Gift(?:_[2-5])?$/.test(name)) {
count = 1;

View File

@ -1,7 +1,5 @@
import * as StarterPackModule from "@/limitedTimeEvent";
const StarterPack: any = StarterPackModule as any;
import * as GoldMinerPaymentModule from "@/goldMiner/payment";
const GoldMinerPayment: any = GoldMinerPaymentModule;
import cloud from '@lafjs/cloud'
import { passOrderFields, PASS_PRICES } from '@/passCheckUpgrade';
import * as crypto from 'crypto';
@ -15,13 +13,21 @@ export default async function (ctx: FunctionContext) {
|| (paymentAppEnv === "test" && !process.env.WX_MIDAS_PAY_SIGN_KEY)) {
return { code: 0, data: null, msg: "支付环境配置不完整" };
}
if (String(ctx.body.itemid || "").startsWith("gold_miner")) {
return GoldMinerPayment.createNativeOrder(ctx.body, "ios");
}
let uid = ctx.body.uid;
let itemid = ctx.body.itemid;
let itemCount = ctx.body.itemCount;
let itemPrice = ctx.body.itemPrice;
// B 商城商品价格(分);旧商品继续沿用原流程。
const shopPrices = {
new_gold_1: 600, new_gold_2: 3000, new_gold_3: 6800,
new_gold_4: 12800, new_gold_5: 32800, new_gold_6: 64800,
new_unlimited_health_bundle_8: 800, new_unlimited_health_bundle_18: 1800,
new_unlimited_health_bundle_36: 3600, new_unlimited_health_bundle_68: 6800,
new_unlimited_health_bundle_98: 9800,
};
if (Object.prototype.hasOwnProperty.call(shopPrices, itemid)) {
itemCount = 1; itemPrice = shopPrices[itemid];
}
const rebornPrice = { reborn_Gift: 600, reborn_Gift_2: 800, reborn_Gift_3: 1000, reborn_Gift_4: 1200, reborn_Gift_5: 1500 };
if (/^reborn_Gift(?:_[2-5])?$/.test(itemid)) {
itemCount = 1;

View File

@ -1,7 +1,5 @@
import * as StarterPackModule from "@/limitedTimeEvent";
const StarterPack: any = StarterPackModule as any;
import * as GoldMinerPaymentModule from "@/goldMiner/payment";
const GoldMinerPayment: any = GoldMinerPaymentModule;
import cloud from '@lafjs/cloud'
import { passOrderFields, PASS_PRICES } from '@/passCheckUpgrade';
import * as crypto from 'crypto';
@ -15,13 +13,21 @@ export default async function (ctx: FunctionContext) {
|| (paymentAppEnv === "test" && !process.env.WX_MIDAS_PAY_SIGN_KEY)) {
return { code: 0, data: null, msg: "支付环境配置不完整" };
}
if (String(ctx.body.itemid || "").startsWith("gold_miner")) {
return GoldMinerPayment.createNativeOrder(ctx.body, "and");
}
let uid = ctx.body.uid;
let itemid = ctx.body.itemid;
let itemCount = ctx.body.itemCount;
let itemPrice = ctx.body.itemPrice;
// B 商城商品价格(分);旧商品继续沿用原流程。
const shopPrices = {
new_gold_1: 600, new_gold_2: 3000, new_gold_3: 6800,
new_gold_4: 12800, new_gold_5: 32800, new_gold_6: 64800,
new_unlimited_health_bundle_8: 800, new_unlimited_health_bundle_18: 1800,
new_unlimited_health_bundle_36: 3600, new_unlimited_health_bundle_68: 6800,
new_unlimited_health_bundle_98: 9800,
};
if (Object.prototype.hasOwnProperty.call(shopPrices, itemid)) {
itemCount = 1; itemPrice = shopPrices[itemid];
}
const rebornPrice = { reborn_Gift: 600, reborn_Gift_2: 800, reborn_Gift_3: 1000, reborn_Gift_4: 1200, reborn_Gift_5: 1500 };
if (/^reborn_Gift(?:_[2-5])?$/.test(itemid)) {
itemCount = 1;