已更新
This commit is contained in:
parent
3fa0238fbc
commit
ae2a1feccb
|
|
@ -873,6 +873,16 @@ export default class GameManager extends cc.Component {
|
||||||
})
|
})
|
||||||
}, 4000);
|
}, 4000);
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
|
wx.onAddToFavorites(() => {
|
||||||
|
console.log("收藏成功");
|
||||||
|
MiniGameSdk.API.tencent_ADD_TO_WISHLIST();
|
||||||
|
return {
|
||||||
|
title: '收藏标题',
|
||||||
|
imageUrl: '' // 图片 URL
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
// 设置分享到朋友圈
|
// 设置分享到朋友圈
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
// wx.updateShareMenu({
|
// wx.updateShareMenu({
|
||||||
|
|
|
||||||
|
|
@ -256,9 +256,7 @@ export default class Revive extends cc.Component {
|
||||||
console.log("错误原因:", res.errMsg);
|
console.log("错误原因:", res.errMsg);
|
||||||
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
||||||
console.log("走ios旧支付");
|
console.log("走ios旧支付");
|
||||||
setTimeout(() => {
|
|
||||||
this.iosOldPay(price, productId);
|
this.iosOldPay(price, productId);
|
||||||
}, 500);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
|
|
||||||
|
|
@ -1563,6 +1563,10 @@ export namespace MiniGameSdk {
|
||||||
if (API._tencent) API._tencent.onRegister();
|
if (API._tencent) API._tencent.onRegister();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static tencent_ADD_TO_WISHLIST() {
|
||||||
|
if (API._tencent) API._tencent.onAddToWishlist();
|
||||||
|
}
|
||||||
|
|
||||||
//#region 数数平台
|
//#region 数数平台
|
||||||
/*
|
/*
|
||||||
* 数数平台初始化以及登录
|
* 数数平台初始化以及登录
|
||||||
|
|
|
||||||
|
|
@ -305,7 +305,7 @@ export class GameConfig {
|
||||||
vibrateOpen: true, //震动
|
vibrateOpen: true, //震动
|
||||||
coinnum: 0, //每局的金币数
|
coinnum: 0, //每局的金币数
|
||||||
paid_user: false, //是否是付费用户
|
paid_user: false, //是否是付费用户
|
||||||
version: "1.0.04", //版本号
|
version: "1.0.15", //版本号
|
||||||
shushu_DistinctId: "", //数数访客ID
|
shushu_DistinctId: "", //数数访客ID
|
||||||
shushu_AccountId: "", //数数账号ID
|
shushu_AccountId: "", //数数账号ID
|
||||||
uid: "", //用户和后端唯一id
|
uid: "", //用户和后端唯一id
|
||||||
|
|
|
||||||
|
|
@ -394,9 +394,7 @@ export default class NewbieGift extends cc.Component {
|
||||||
console.log("错误原因:", res.errMsg);
|
console.log("错误原因:", res.errMsg);
|
||||||
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
||||||
console.log("走ios旧支付");
|
console.log("走ios旧支付");
|
||||||
setTimeout(() => {
|
|
||||||
this.iosOldPay(price, productId);
|
this.iosOldPay(price, productId);
|
||||||
}, 500);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
|
|
||||||
|
|
@ -600,9 +600,7 @@ export default class passCheck extends cc.Component {
|
||||||
console.log("错误原因:", res.errMsg);
|
console.log("错误原因:", res.errMsg);
|
||||||
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
||||||
console.log("走ios旧支付");
|
console.log("走ios旧支付");
|
||||||
setTimeout(() => {
|
|
||||||
this.iosOldPay(price, productId);
|
this.iosOldPay(price, productId);
|
||||||
}, 500);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
|
|
||||||
|
|
@ -629,9 +629,7 @@ export default class NewClass extends cc.Component {
|
||||||
console.log("错误原因:", res.errMsg);
|
console.log("错误原因:", res.errMsg);
|
||||||
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
if (res.errMsg && res.errMsg.indexOf("fail App Store") !== -1) {
|
||||||
console.log("走ios旧支付");
|
console.log("走ios旧支付");
|
||||||
setTimeout(() => {
|
|
||||||
this.iosOldPay(price, productId);
|
this.iosOldPay(price, productId);
|
||||||
}, 500);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MiniGameSdk.API.showToast("充值失败");
|
MiniGameSdk.API.showToast("充值失败");
|
||||||
|
|
|
||||||
|
|
@ -3,15 +3,18 @@ const token = "nika123";
|
||||||
const EncodingAESKey = "XcdOFaZOQjmyBqYHxWAITtrmq11YaZQ63DeEZAAgYJt";
|
const EncodingAESKey = "XcdOFaZOQjmyBqYHxWAITtrmq11YaZQ63DeEZAAgYJt";
|
||||||
const mchid = "1719895437";//商户id
|
const mchid = "1719895437";//商户id
|
||||||
const serialNo = "2A97ED6ED441E55600EBC8830B9EC889ED41496E";//证书序列号
|
const serialNo = "2A97ED6ED441E55600EBC8830B9EC889ED41496E";//证书序列号
|
||||||
const appid ="wxdd145ced49158a1e";
|
const appid = "wx30f74367b3d3e7a6";
|
||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
const db = cloud.database();
|
const db = cloud.database();
|
||||||
export default async function (ctx: FunctionContext) {
|
export default async function (ctx: FunctionContext) {
|
||||||
|
console.log(ctx.body);
|
||||||
|
//console.log(ctx.query);;
|
||||||
try {
|
try {
|
||||||
let openid = ctx.body.FromUserName;
|
let openid = ctx.body.FromUserName;
|
||||||
//console.log(openid);
|
//console.log(openid);
|
||||||
const data = JSON.parse(ctx.body.SessionFrom);
|
const data = JSON.parse(ctx.body.SessionFrom);
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
|
console.log(data);
|
||||||
if (data.tpye == "ios") {
|
if (data.tpye == "ios") {
|
||||||
await PostMsg(openid, "点击下方页面进行充值");
|
await PostMsg(openid, "点击下方页面进行充值");
|
||||||
await PostImg(openid, data.outTradeNo, data.propName, data.count, data.price);
|
await PostImg(openid, data.outTradeNo, data.propName, data.count, data.price);
|
||||||
|
|
@ -20,7 +23,7 @@ export default async function (ctx: FunctionContext) {
|
||||||
console.error("ios客服充值参数错误:" + ctx.body.SessionFrom);
|
console.error("ios客服充值参数错误:" + ctx.body.SessionFrom);
|
||||||
console.log(ctx.body);
|
console.log(ctx.body);
|
||||||
}
|
}
|
||||||
|
//return ctx.query.echostr;
|
||||||
return { data: "scuess" };
|
return { data: "scuess" };
|
||||||
}
|
}
|
||||||
/**获取订单*/
|
/**获取订单*/
|
||||||
|
|
@ -30,9 +33,9 @@ async function getOrder(openid, toatal, outTradeNo, timestamp, nonceStr){
|
||||||
const body = {
|
const body = {
|
||||||
"appid": appid,
|
"appid": appid,
|
||||||
"mchid": mchid,
|
"mchid": mchid,
|
||||||
"description": "五彩消消乐道具购买",
|
"description": "消消王者道具购买",
|
||||||
"out_trade_no": outTradeNo,
|
"out_trade_no": outTradeNo,
|
||||||
"notify_url": "http://laf.nika4games.com/wx/iosPayCall",
|
"notify_url": "https://q6rvwvtnga.sealoshzh.site/wx/iosPayCall",
|
||||||
"amount": { "total": Number(toatal), "currency": "CNY" },
|
"amount": { "total": Number(toatal), "currency": "CNY" },
|
||||||
"payer": { "openid": openid }
|
"payer": { "openid": openid }
|
||||||
}
|
}
|
||||||
|
|
@ -86,6 +89,7 @@ async function frontsign(data) {
|
||||||
// 获取文件列表
|
// 获取文件列表
|
||||||
const res = await bucket.readFile('apiclient_key.pem');
|
const res = await bucket.readFile('apiclient_key.pem');
|
||||||
const privateKeyPem = await res.Body.transformToString();
|
const privateKeyPem = await res.Body.transformToString();
|
||||||
|
//console.error(privateKeyPem);
|
||||||
// 使用私钥签名(PKCS1 填充)
|
// 使用私钥签名(PKCS1 填充)
|
||||||
const signature = sign.sign({
|
const signature = sign.sign({
|
||||||
key: privateKeyPem,
|
key: privateKeyPem,
|
||||||
|
|
@ -177,6 +181,9 @@ async function PostImg(OpenId, outTradeNo, name, count, price) {
|
||||||
itemCount: count,
|
itemCount: count,
|
||||||
goodsPrice: Number(price),
|
goodsPrice: Number(price),
|
||||||
time: Date.now(),
|
time: Date.now(),
|
||||||
|
orderTime: new Date(Date.now() + 8 * 3600000),
|
||||||
|
chargeTime: 0,
|
||||||
|
getTime: 0,
|
||||||
type: "ios",
|
type: "ios",
|
||||||
state: 0,
|
state: 0,
|
||||||
});
|
});
|
||||||
|
|
@ -186,7 +193,7 @@ async function PostImg(OpenId, outTradeNo, name, count, price) {
|
||||||
"link": {
|
"link": {
|
||||||
"title": "点我支付",
|
"title": "点我支付",
|
||||||
"description": "金额:" + (total / 100).toFixed(2) + "元",
|
"description": "金额:" + (total / 100).toFixed(2) + "元",
|
||||||
"url": `https://pay.nika4games.com/order2.html#data=${encodeURIComponent(JSON.stringify(param))}`,
|
"url": `https://pay.nika4games.com/order3.html#data=${encodeURIComponent(JSON.stringify(param))}`,
|
||||||
"thumb_url": "https://static-host-j3k323ol-colorblock-oss.sealoshzh.site/icon.jpg"
|
"thumb_url": "https://static-host-j3k323ol-colorblock-oss.sealoshzh.site/icon.jpg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -199,6 +206,7 @@ async function PostImg(OpenId, outTradeNo, name, count, price) {
|
||||||
body: JSON.stringify(data)
|
body: JSON.stringify(data)
|
||||||
})
|
})
|
||||||
const data11 = await res.json();
|
const data11 = await res.json();
|
||||||
|
console.log(data11);
|
||||||
if (data11.errcode == 40001) {
|
if (data11.errcode == 40001) {
|
||||||
console.error("未获取到正确token,重新发送请求");
|
console.error("未获取到正确token,重新发送请求");
|
||||||
let res = await getWxToken();
|
let res = await getWxToken();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user