appointment_system/miniprogram/dist/build/h5/assets/AppServer.888fd24d.js
2025-12-19 00:37:31 +08:00

2 lines
8.0 KiB
JavaScript

import{C as t,z as a,v as e,r as n,D as o,a6 as i,k as r}from"./index-a09151d6.js";var p=function(){},s={},l=t.API_BASE_URL;s.apiUrl_Auth_WechatLogin=l+"/api/v1/auth/wechat-login",s.apiUrl_Auth_RefreshToken=l+"/api/v1/auth/refresh-token",s.apiUrl_Auth_Logout=l+"/api/v1/auth/logout",s.apiUrl_User_GetProfile=l+"/api/v1/users/profile",s.apiUrl_User_UpdateProfile=l+"/api/v1/users/profile",s.apiUrl_User_SetLanguage=l+"/api/v1/users/language",s.apiUrl_Service_GetCategories=l+"/api/v1/categories",s.apiUrl_Service_GetServices=l+"/api/v1/services",s.apiUrl_Service_GetServiceByKey=l+"/api/v1/services",s.apiUrl_Appointment_Create=l+"/api/v1/appointments",s.apiUrl_Appointment_GetList=l+"/api/v1/appointments",s.apiUrl_Appointment_Stats=l+"/api/v1/appointments/stats",s.apiUrl_Appointment_GetById=l+"/api/v1/appointments",s.apiUrl_Appointment_Update=l+"/api/v1/appointments",s.apiUrl_Appointment_Cancel=l+"/api/v1/appointments",s.apiUrl_Notification_GetList=l+"/api/v1/notifications",s.apiUrl_Notification_UnreadCount=l+"/api/v1/notifications/unread-count",s.apiUrl_Notification_MarkAsRead=l+"/api/v1/notifications",s.apiUrl_Notification_MarkAllAsRead=l+"/api/v1/notifications/read-all",s.apiUrl_Notification_Delete=l+"/api/v1/notifications",s.apiUrl_Invitation_Generate=l+"/api/v1/invitations/generate",s.apiUrl_Invitation_GetStats=l+"/api/v1/invitations/stats",s.apiUrl_Invitation_GetRecords=l+"/api/v1/invitations/records",s.apiUrl_Commission_GetList=l+"/api/v1/commissions",s.apiUrl_Commission_GetStats=l+"/api/v1/commissions/stats",s.apiUrl_Withdrawal_Create=l+"/api/v1/withdrawals",s.apiUrl_Withdrawal_GetList=l+"/api/v1/withdrawals",s.apiUrl_Withdrawal_GetById=l+"/api/v1/withdrawals",s.apiUrl_Upload_Image=l+"/api/v1/upload/image",s.apiUrl_QRCode_GetMiniProgram=l+"/api/v1/qrcode/miniprogram",p.prototype.getPostFormBody=function(t){Object.assign({},t)},p.prototype.getSign=function(t){let e=[];for(let a in t)"sign"!=a&&e.push(a);e.sort();let n="";for(let a in e){let o=t[e[a]];(o||0==o)&&(n+=o)}let o="";try{let t=a("token");t&&(o=t.split(".")[2])}catch(i){o=""}return n+=o,md5(n)},p.prototype.postData=async function(t,o){let i="";try{const t=e();i=t&&t.globalData&&t.globalData.token?t.globalData.token:a("token")||""}catch(r){i=a("token")||""}return n({url:t,method:"POST",header:{"Content-Type":"application/json",Authorization:i},data:JSON.stringify(o)}).then(a=>(console.log(`post,url=${t},form=${JSON.stringify(o)},response=${a.data}`),a.data)).catch(t=>(console.error(t),t))},p.prototype.getData=async function(t,o){let i="";try{const t=e();i=t&&t.globalData&&t.globalData.token?t.globalData.token:a("token")||""}catch(s){i=a("token")||""}if(null!=o){var r=(p=o,Object.keys(p).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(p[t])).join("&"));t.indexOf("?")>-1?t+="&"+r:t+="?"+r}var p;return n({url:t,method:"GET",header:{Authorization:i}}).then(a=>(console.log(`GET,url=${t},response=${JSON.stringify(a.data)}`),a.data)).catch(t=>(console.error(t),t))},p.prototype.putData=async function(t,o){let i="";try{const t=e();i=t&&t.globalData&&t.globalData.token?t.globalData.token:a("token")||""}catch(r){i=a("token")||""}return n({url:t,method:"PUT",header:{"Content-Type":"application/json",Authorization:i},data:JSON.stringify(o)}).then(a=>(console.log(`PUT,url=${t},form=${JSON.stringify(o)},response=${JSON.stringify(a.data)}`),a.data)).catch(t=>(console.error(t),t))},p.prototype.deleteData=async function(t){let o="";try{const t=e();o=t&&t.globalData&&t.globalData.token?t.globalData.token:a("token")||""}catch(i){o=a("token")||""}return n({url:t,method:"DELETE",header:{Authorization:o}}).then(a=>(console.log(`DELETE,url=${t},response=${JSON.stringify(a.data)}`),a.data)).catch(t=>(console.error(t),t))},p.prototype.WechatLogin=async function(t){var a=s.apiUrl_Auth_WechatLogin;return this.postData(a,{code:t}).then(t=>t)},p.prototype.RefreshToken=async function(t){var a=s.apiUrl_Auth_RefreshToken;return this.postData(a,{refreshToken:t}).then(t=>{if(t.success&&t.data&&t.data.token){const a="Bearer "+t.data.token;e().globalData.token=a,o("token",a)}return t})},p.prototype.Logout=async function(){var t=s.apiUrl_Auth_Logout;return this.postData(t,{}).then(t=>(e().globalData.token="",o("token",""),t))},p.prototype.GetUserProfile=async function(){var t=s.apiUrl_User_GetProfile;return this.getData(t).then(t=>t)},p.prototype.UpdateUserProfile=async function(t){var a=s.apiUrl_User_UpdateProfile;return this.putData(a,t).then(t=>t)},p.prototype.SetLanguage=async function(t){var a=s.apiUrl_User_SetLanguage;return this.putData(a,{language:t}).then(t=>t)},p.prototype.GetCategories=async function(t={}){var a=s.apiUrl_Service_GetCategories;return this.getData(a,t).then(t=>t)},p.prototype.GetServices=async function(t={}){var a=s.apiUrl_Service_GetServices;return this.getData(a,t).then(t=>t)},p.prototype.GetServiceByKey=async function(t,a){var e=s.apiUrl_Service_GetServiceByKey+"/"+t,n=a?{language:a}:null;return this.getData(e,n).then(t=>t)},p.prototype.CreateAppointment=async function(t){var a=s.apiUrl_Appointment_Create;return this.postData(a,t).then(t=>t)},p.prototype.GetAppointments=async function(t={}){var a=s.apiUrl_Appointment_GetList;return this.getData(a,t).then(t=>t)},p.prototype.GetAppointmentStats=async function(){var t=s.apiUrl_Appointment_Stats;return this.getData(t,{}).then(t=>t)},p.prototype.GetAppointmentById=async function(t){var a=s.apiUrl_Appointment_GetById+"/"+t;return this.getData(a).then(t=>t)},p.prototype.UpdateAppointment=async function(t,a){var e=s.apiUrl_Appointment_Update+"/"+t;return this.putData(e,a).then(t=>t)},p.prototype.CancelAppointment=async function(t){var a=s.apiUrl_Appointment_Cancel+"/"+t;return this.deleteData(a).then(t=>t)},p.prototype.GetNotifications=async function(t={}){var a=s.apiUrl_Notification_GetList;return this.getData(a,t).then(t=>t)},p.prototype.GetNotificationUnreadCount=async function(){var t=s.apiUrl_Notification_UnreadCount;return this.getData(t,{}).then(t=>t)},p.prototype.MarkNotificationAsRead=async function(t){var a=s.apiUrl_Notification_MarkAsRead+"/"+t+"/read";return this.putData(a,{}).then(t=>t)},p.prototype.MarkAllNotificationsAsRead=async function(){var t=s.apiUrl_Notification_MarkAllAsRead;return this.putData(t,{}).then(t=>t)},p.prototype.DeleteNotification=async function(t){var a=s.apiUrl_Notification_Delete+"/"+t;return this.deleteData(a).then(t=>t)},p.prototype.GenerateInvitationCode=async function(){var t=s.apiUrl_Invitation_Generate;return this.postData(t,{}).then(t=>t)},p.prototype.GetInvitationStats=async function(){var t=s.apiUrl_Invitation_GetStats;return this.getData(t).then(t=>t)},p.prototype.GetInvitationRecords=async function(){var t=s.apiUrl_Invitation_GetRecords;return this.getData(t).then(t=>t)},p.prototype.GetCommissions=async function(t={}){var a=s.apiUrl_Commission_GetList;return this.getData(a,t).then(t=>t)},p.prototype.GetCommissionStats=async function(){var t=s.apiUrl_Commission_GetStats;return this.getData(t).then(t=>t)},p.prototype.CreateWithdrawal=async function(t){var a=s.apiUrl_Withdrawal_Create;return this.postData(a,t).then(t=>t)},p.prototype.GetWithdrawals=async function(t={}){var a=s.apiUrl_Withdrawal_GetList;return this.getData(a,t).then(t=>t)},p.prototype.GetWithdrawalById=async function(t){var a=s.apiUrl_Withdrawal_GetById+"/"+t;return this.getData(a).then(t=>t)},p.prototype.GetMiniProgramQRCode=async function(t={}){var a=s.apiUrl_QRCode_GetMiniProgram;return this.postData(a,t).then(t=>t)},p.prototype.UploadImage=async function(t){var n=s.apiUrl_Upload_Image;let o="";try{const t=e();o=t&&t.globalData&&t.globalData.token?t.globalData.token:a("token")||""}catch(r){o=a("token")||""}return new Promise((a,e)=>{i({url:n,filePath:t,name:"image",header:{Authorization:o},success:t=>{try{const e=JSON.parse(t.data);console.log("Upload image success:",e),a(e)}catch(r){console.error("Parse upload response error:",r),e(r)}},fail:t=>{console.error("Upload image failed:",t),e(t)}})})},p.prototype.GetPlatformIsAndroid=function(){let t=r().platform;switch(t){case"android":return console.log("运行Android上",t),!0;case"ios":return console.log("运行iOS上",t),!1;default:return console.log("运行在开发者工具上"),!1}};export{p as A};