@jayfong/x-server 2.1.6 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -189,6 +189,7 @@ _yargs.default.command('dev', '开始开发', _ => _.positional('index', {
189
189
  host: process.env.HOST,
190
190
  user: process.env.USER,
191
191
  key: process.env.KEY,
192
- dir: process.env.DIR
192
+ dir: process.env.DIR,
193
+ cmd: process.env.CMD
193
194
  });
194
195
  }).parse();
@@ -47,7 +47,8 @@ class DeployUtil {
47
47
  set -ex
48
48
  tar -zxvf ${remoteAppFile} -C ${appDir}
49
49
  cd ${appDir}/dist
50
- [ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
50
+ [ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
51
+ ${options.cmd || ''}
51
52
  pm2 startOrReload pm2.config.js
52
53
  `, {
53
54
  cwd: options.cwd,
@@ -56,8 +56,9 @@ class PayService {
56
56
  }
57
57
 
58
58
  async prepareWepay(options) {
59
+ const appId = options.appId || this.options.wepay.appId;
59
60
  const res = await this.wepayRequest('https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi', {
60
- appid: this.options.wepay.appId,
61
+ appid: appId,
61
62
  mchid: this.options.wepay.merchantId,
62
63
  description: options.goodsName,
63
64
  out_trade_no: options.tradeNumber,
@@ -78,7 +79,7 @@ class PayService {
78
79
  }
79
80
 
80
81
  const params = {
81
- appId: this.options.wepay.appId,
82
+ appId: appId,
82
83
  timestamp: String(Math.round(Date.now() / 1000)),
83
84
  nonceStr: Math.random().toString().substr(2, 12),
84
85
  package: `prepay_id=${res.prepay_id}`,
package/lib/cli/cli.js CHANGED
@@ -171,6 +171,7 @@ yargs.command('dev', '开始开发', _ => _.positional('index', {
171
171
  host: process.env.HOST,
172
172
  user: process.env.USER,
173
173
  key: process.env.KEY,
174
- dir: process.env.DIR
174
+ dir: process.env.DIR,
175
+ cmd: process.env.CMD
175
176
  });
176
177
  }).parse();
@@ -4,6 +4,7 @@ export interface DeployOptions {
4
4
  user: string;
5
5
  key: string;
6
6
  dir: string;
7
+ cmd?: string;
7
8
  }
8
9
  export declare class DeployUtil {
9
10
  static deploy(options: DeployOptions): Promise<void>;
@@ -35,7 +35,8 @@ export class DeployUtil {
35
35
  set -ex
36
36
  tar -zxvf ${remoteAppFile} -C ${appDir}
37
37
  cd ${appDir}/dist
38
- [ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
38
+ [ -f no_install.lock ] && yarn_disable_self_update_check=true tyn
39
+ ${options.cmd || ''}
39
40
  pm2 startOrReload pm2.config.js
40
41
  `, {
41
42
  cwd: options.cwd,
@@ -48,6 +48,8 @@ export interface PayServicePrepareWepayOptions {
48
48
  totalMoney: number;
49
49
  /** 通知地址(POST) */
50
50
  notifyUrl: string;
51
+ /** 对应公众号的 appId */
52
+ appId?: string;
51
53
  /** 对应公众号用户的 openid */
52
54
  openid: string;
53
55
  }
@@ -44,8 +44,9 @@ export class PayService {
44
44
  }
45
45
 
46
46
  async prepareWepay(options) {
47
+ const appId = options.appId || this.options.wepay.appId;
47
48
  const res = await this.wepayRequest('https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi', {
48
- appid: this.options.wepay.appId,
49
+ appid: appId,
49
50
  mchid: this.options.wepay.merchantId,
50
51
  description: options.goodsName,
51
52
  out_trade_no: options.tradeNumber,
@@ -66,7 +67,7 @@ export class PayService {
66
67
  }
67
68
 
68
69
  const params = {
69
- appId: this.options.wepay.appId,
70
+ appId: appId,
70
71
  timestamp: String(Math.round(Date.now() / 1000)),
71
72
  nonceStr: Math.random().toString().substr(2, 12),
72
73
  package: `prepay_id=${res.prepay_id}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jayfong/x-server",
3
- "version": "2.1.6",
3
+ "version": "2.2.0",
4
4
  "license": "ISC",
5
5
  "sideEffects": false,
6
6
  "main": "lib/_cjs/index.js",