test 10 月之前
父節點
當前提交
1b19c8118a
共有 2 個文件被更改,包括 2 次插入4 次删除
  1. 1 1
      src/comm/utils.ts
  2. 1 3
      src/modules/dj/service/channels/sunpay.ts

+ 1 - 1
src/comm/utils.ts

@@ -235,6 +235,6 @@ export class Utils {
     // 更新hash对象与传入的数据
     // 更新hash对象与传入的数据
     hmac.update(data);
     hmac.update(data);
     // 生成哈希值
     // 生成哈希值
-    return hmac.digest().toString('base64');
+    return hmac.digest('base64');
   }
   }
 }
 }

+ 1 - 3
src/modules/dj/service/channels/sunpay.ts

@@ -242,8 +242,6 @@ export class SunPayService extends BaseService {
     const nonce = headers['sunpay-nonce'];
     const nonce = headers['sunpay-nonce'];
     const str = timestamp + nonce + JSON.stringify(payload);
     const str = timestamp + nonce + JSON.stringify(payload);
     const validSign = this.utils.signBySha256(str, API_SERECT).toUpperCase();
     const validSign = this.utils.signBySha256(str, API_SERECT).toUpperCase();
-    console.log(sign, str)
-    console.log(validSign)
     if (sign !== validSign) {
     if (sign !== validSign) {
       throw new Error('sign error');
       throw new Error('sign error');
     }
     }
@@ -251,7 +249,7 @@ export class SunPayService extends BaseService {
       throw new Error('order no success');
       throw new Error('order no success');
     }
     }
     return {
     return {
-      date: moment(),
+      date: new Date(),
       orderNo: data.out_order_no,
       orderNo: data.out_order_no,
       traceNo: data.order_no,
       traceNo: data.order_no,
     };
     };