This commit is contained in:
hackrobot
2024-10-04 18:59:37 +08:00
parent 255b722242
commit af1a72d359
11 changed files with 34 additions and 30 deletions

View File

@@ -106,8 +106,8 @@ const Index = () => {
// 查询数据库是否存在openid
Taro.request({
method: "GET",
url: `/api/user/${hashopenid}`, //仅为示例,并非真实的接口地址
// url: `/api/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${hashopenid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
success: function (res) {
if (res?.data?.userInfo) {
// 有完整的用户信息userInfo
@@ -123,7 +123,7 @@ const Index = () => {
} else {
let nowUrl = window.location.href;
window.localStorage.removeItem("openid");
let payUrl = `https://payjs.cn/api/openid?mchid=1561724891&callback_url=${nowUrl}`;
let payUrl = `https://payjs.cn${TARO_APP_API}/openid?mchid=1561724891&callback_url=${nowUrl}`;
window.location.href = payUrl;
}
};
@@ -132,8 +132,8 @@ const Index = () => {
const getUserinfo = (wxid) => {
Taro.request({
method: "GET",
url: `/api/user/${wxid}`, //仅为示例,并非真实的接口地址
// url: `/api/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${wxid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
success: function (res) {
if (res?.data?.userInfo) {
//判断wxid是否存在
@@ -158,8 +158,8 @@ const Index = () => {
// 优先查询openid是否存在数据库
Taro.request({
method: "GET",
url: `/api/user/${urlwxid}`, //仅为示例,并非真实的接口地址
// url: `/api/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${urlwxid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
success: function (res) {
if (res?.data?.userInfo) {
//判断wxid是否存在
@@ -208,8 +208,8 @@ const Index = () => {
};
Taro.request({
method: "PUT",
// url: `/api/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `/api/user/${newWxid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${newWxid}`, //仅为示例,并非真实的接口地址
data: userUpdateData,
header: {
"Content-Type": "application/json",
@@ -227,8 +227,8 @@ const Index = () => {
};
Taro.request({
method: "GET",
// url: `/api/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `/api/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
data: userUpdateData,
header: {
"Content-Type": "application/json",
@@ -243,8 +243,8 @@ const Index = () => {
const tgMessage = () => {
Taro.request({
method: "GET",
url: `/api/tgMessage?openid=${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/tgMessage?openid=${window.localStorage.getItem("openid")}`, //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
success: function (res) {
console.log("访问提醒发送成功");
},
@@ -281,8 +281,10 @@ const Index = () => {
// console.log("111");
Taro.request({
method: "POST",
url: "/api/payh5", //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}//payh5`,
// url: "${TARO_APP_API}/payh5",
// url: "https://pay.hackrobot.cn${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
data: {
callback_url: window.location.href,
@@ -477,8 +479,8 @@ const Index = () => {
};
Taro.request({
method: "PUT",
// url: `/api/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `/api/user/${wxid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${wxid}`, //仅为示例,并非真实的接口地址
data: userUpdateData,
header: {
"Content-Type": "application/json",
@@ -600,8 +602,8 @@ const Index = () => {
};
Taro.request({
method: "PUT",
// url: `/api/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `/api/user/${wxid}`, //仅为示例,并非真实的接口地址
// url: `${TARO_APP_API}/user/${urlwxid}`, //仅为示例,并非真实的接口地址
url: `${TARO_APP_API}/user/${wxid}`, //仅为示例,并非真实的接口地址
data: userUpdateData,
header: {
"Content-Type": "application/json",

View File

@@ -72,8 +72,8 @@ const Detail = () => {
// console.log("111");
Taro.request({
method:'POST',
url: "/api/payh5", //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
url: "${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
data: {
callback_url:window.location.href,

View File

@@ -60,8 +60,8 @@ const Salon = () => {
// console.log("111");
Taro.request({
method: "POST",
url: "/api/payh5", //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn/api/payh5", //仅为示例,并非真实的接口地址
url: "${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
// url: "https://pay.hackrobot.cn${TARO_APP_API}/payh5", //仅为示例,并非真实的接口地址
data: {
callback_url: window.location.href,