warrior 1 month ago
parent
commit
4f28701c46

+ 10 - 10
android/app/build.gradle

@@ -17,17 +17,17 @@ android {
         }
     }
     signingConfigs {
-        //签名信息
-        release {
-            keyAlias System.getenv('KEY_ALIAS') ?: 'heychat'
-            keyPassword System.getenv('KEY_PASSWORD') ?: '12345678'
-            storeFile file(System.getenv('KEYSTORE_PATH') ?: '../heychat.keystore')
-            storePassword System.getenv('STORE_PASSWORD') ?: '12345678'
-        }
-    }
+          //签名信息
+          release {
+              keyAlias System.getenv('KEY_ALIAS') ?: 'heychat'
+              keyPassword System.getenv('KEY_PASSWORD') ?: '12345678'
+              storeFile file(System.getenv('KEYSTORE_PATH') ?: '../heychat.keystore')
+              storePassword System.getenv('STORE_PASSWORD') ?: '12345678'
+          }
+      }
     android.applicationVariants.all(variant ->{
         variant.outputs.all{
-        outputFileName = "heychat.apk"
+            outputFileName = "heychat.apk"
         }
     })
     buildTypes {
@@ -66,4 +66,4 @@ try {
     }
 } catch(Exception e) {
     logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
-}
+}

+ 2 - 1
android/app/src/main/AndroidManifest.xml

@@ -39,7 +39,8 @@
     <!-- Permissions -->
 
     <uses-permission android:name="android.permission.INTERNET" />
-        <!--可选权限-->
+    
+     <!--可选权限-->
     <uses-permission android:name="android.permission.CAMERA"/>
     <uses-permission android:name="android.permission.RECORD_AUDIO"/>
     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>

+ 54 - 44
projects/live-app/src/app/components/pay-comp/pay-comp.component.ts

@@ -212,23 +212,33 @@ export class PayCompComponent implements OnInit {
       });
   }
 
-
   /* 支付宝支付 */
-  async openAlipay(){
+  async openAlipay() {
     if (this.isDisabled) return;
     try {
       this.isDisabled = true;
       await this.getOrderId();
-      let data:any = await this.getAliPayUrl();
-      console.log(data.pay_url);
-      window.open(data.pay_url, "newW");
+      let data: any = await this.getAliPayUrl();
+      console.log(data);
+      // window.open(data.pay_url, "newW");
+      // 创建一个临时的div元素来解析HTML字符串
+      const tempDiv = document.createElement('div');
+      tempDiv.innerHTML = data.pay_url; // 假设data.pay_url是完整的HTML字符串
+      const formElement = tempDiv.querySelector('form');
+      if (formElement) {
+        document.body.appendChild(formElement);
+        formElement.submit();
+        document.body.removeChild(formElement); // 提交后移除表单元素
+      } else {
+        console.error('未找到表单元素');
+      }
       this.timer = setInterval(async () => {
-        console.log("支付结果轮询");
-        let AccountLog = new Parse.Query("AccountLog");
-        AccountLog.equalTo("company", this.accServ.company);
-        AccountLog.equalTo("orderNumber", this.tradeNo);
-        AccountLog.equalTo("payType", "aliPay");
-        AccountLog.equalTo("isVerified", true);
+        console.log('支付结果轮询');
+        let AccountLog = new Parse.Query('AccountLog');
+        AccountLog.equalTo('company', this.accServ.company);
+        AccountLog.equalTo('orderNumber', this.tradeNo);
+        AccountLog.equalTo('payType', 'aliPay');
+        AccountLog.equalTo('isVerified', true);
         let result = await AccountLog.first();
         if (result && result.id) {
           clearInterval(this.timer);
@@ -245,7 +255,7 @@ export class PayCompComponent implements OnInit {
           });
         }
       }, 1000);
-    }catch (err: any) {
+    } catch (err: any) {
       this.isDisabled = false;
       let alert = await this.alertCtrl.create({
         header: '异常错误',
@@ -262,39 +272,39 @@ export class PayCompComponent implements OnInit {
       alert.present();
     }
   }
-    // 获取支付宝支付
-    async getAliPayUrl() {
-      return new Promise((resolve, reject) => {
-        let beforURL = window.location.href;
-        let params = {
-          company: this.accServ.company,
-          tradeNo: this.tradeNo,
-          price: this.price,
-          tradetype:'wap',
-          // price: 0.01,
-          orderTitle: this.title,
-          returnUrl: beforURL,
-        };
-        try {
-          this.http
-            .post("https://server.fmode.cn/api/alipay/neworder", params)
-            .subscribe((res: any) => {
-              if (res.code !== 200) {
-                this.toast('网络错误,请稍后重试', 'warning');
-                return
-              }
-              if (res.data && res.data.pay_url) {
-                resolve(res.data);
-              }
-            });
-        } catch (err) {
-          if (err) {
-            this.toast('网络错误,请稍后重试', 'warning');
-            reject(err);
-          }
+  // 获取支付宝支付
+  async getAliPayUrl() {
+    return new Promise((resolve, reject) => {
+      let beforURL = window.location.href;
+      let params = {
+        company: this.accServ.company,
+        tradeNo: this.tradeNo,
+        price: this.price,
+        tradetype: 'wap',
+        // price: 0.01,
+        orderTitle: this.title,
+        returnUrl: beforURL,
+      };
+      try {
+        this.http
+          .post('https://server.fmode.cn/api/alipay/neworder', params)
+          .subscribe((res: any) => {
+            if (res.code !== 200) {
+              this.toast('网络错误,请稍后重试', 'warning');
+              return;
+            }
+            if (res.data && res.data.pay_url) {
+              resolve(res.data);
+            }
+          });
+      } catch (err) {
+        if (err) {
+          this.toast('网络错误,请稍后重试', 'warning');
+          reject(err);
         }
-      });
-    }
+      }
+    });
+  }
 
   /* 关闭支付弹窗 */
   onClose() {

+ 1 - 0
projects/live-app/src/modules/tabs/my/my.component.scss

@@ -92,6 +92,7 @@
   }
   .ad {
     display: flex;
+    justify-content: space-between;
     align-items: center;
     padding: 1.5385vw 2.5641vw;
     font-size: 3.0769vw;