aaden-cli 1.6.78 → 1.6.79

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.
@@ -0,0 +1,25 @@
1
+ #!/bin/bash
2
+
3
+ ServiceFileName=/etc/systemd/system/aaden-tee-maker.service
4
+
5
+ sudo touch $ServiceFileName
6
+ sudo chmod 777 $ServiceFileName
7
+ echo -e "
8
+ [Unit]
9
+ Description=Tee Maker Service For Aaden
10
+
11
+ [Service]
12
+ Type=simple
13
+ Restart=always
14
+ RestartSec=1
15
+ User=root
16
+ ExecStart=/usr/bin/php /var/www/html/PHP/autoSendTeaMakerTask.php
17
+
18
+ [Install]
19
+ WantedBy=multi-user.target
20
+ " > $ServiceFileName
21
+
22
+ sudo systemctl start aaden-tee-maker.service
23
+ sudo systemctl enable aaden-tee-maker.service
24
+ echo 'tee maker task auto send start'
25
+ sudo service aaden-tee-maker start
@@ -0,0 +1,130 @@
1
+ #!/bin/bash
2
+
3
+ deviceId=$1
4
+ targetVersion=$2
5
+ tseAdapterDownloadUrl=$3
6
+
7
+ function sendDeviceLog() {
8
+ _deviceId=$1
9
+ _content=$2
10
+ echo "<<< create log: $_content"
11
+ curl --location 'https://cloud-v2.aaden.io/deviceLog/createEvent' \
12
+ --header 'Content-Type: application/json' \
13
+ --data "{
14
+ \"deviceId\": \"$_deviceId\",
15
+ \"content\": \"$_content\",
16
+ \"type\": \"维护状态更新\",
17
+ \"appendUrl\": \"\",
18
+ \"operator\": \"updateAadenTse.sh\"
19
+ }"
20
+ return 0
21
+ }
22
+
23
+ # get tse version via php
24
+ tseVersionCommand=$(cat <<- 'PHP'
25
+ $ini = parse_ini_file('/var/www/html/Resource/config/config.ini', true);
26
+ $tseUrl = $ini['TSE']['TseHost'] ?? 'http://localhost:8014';
27
+ $versionResp = file_get_contents("$tseUrl/adapterVersion");
28
+ $version = json_decode($versionResp, true)['major'] ?? 'null';
29
+ echo $version;
30
+ PHP
31
+ )
32
+ tseVersion=`php -r "$tseVersionCommand"`
33
+
34
+ # exit if no need to update
35
+ if [ $tseVersion != 'null' ]; then
36
+ if [ $targetVersion -le $tseVersion ]; then
37
+ sendDeviceLog $deviceId "no need to update tse, current version is ($tseVersion)"
38
+ exit 1
39
+ fi
40
+ fi
41
+
42
+ # get os version via php
43
+ osCommand=$(cat <<- 'PHP'
44
+ $osVersion = shell_exec('cat /proc/version');
45
+ if (strpos($osVersion, 'microsoft') !== false || strpos($osVersion, 'WSL2') !== false) {
46
+ $os = 'windows';
47
+ } else {
48
+ $os = 'linux';
49
+ }
50
+ echo $os;
51
+ PHP
52
+ )
53
+ os=`php -r "$osCommand"`
54
+
55
+ sendDeviceLog $deviceId "user os is ($os)"
56
+
57
+ # download tse adapter
58
+ wget -O latest-tse-adapter.jar "$tseAdapterDownloadUrl"
59
+
60
+ if [ $os == 'windows' ]; then
61
+ # find tse dir
62
+ tseDirSearchCommand=$(cat <<- 'PHP'
63
+ $arr = scandir('/mnt/c/Users');
64
+ if (in_array('POS', $arr)) {
65
+ $userDir = 'POS';
66
+ } elseif (in_array('inner', $arr)) {
67
+ $userDir = 'inner';
68
+ } else {
69
+ $userDir = null;
70
+ }
71
+
72
+ if ($userDir) {
73
+ echo "/mnt/c/Users/$userDir/Desktop/AadenTseOnWindows";
74
+ } else {
75
+ echo 'null';
76
+ }
77
+ PHP
78
+ )
79
+ tseDir=`php -r "$tseDirSearchCommand"`
80
+
81
+ if [ tseDir == 'null' ]; then
82
+ sendDeviceLog $deviceId "cannot find 'POS' or 'inner' in User directory, abort"
83
+ exit 1
84
+ fi
85
+
86
+ #test tse dir
87
+ testTseDirCommand=$(cat <<- 'PHP'
88
+ $dir = fgets(STDIN);
89
+ $arr = scandir($dir);
90
+ echo $arr !== false ? 'true' : 'false';
91
+ PHP
92
+ )
93
+ testTseDirResult=`echo "$tseDir" | php -r "$testTseDirCommand"`
94
+
95
+ if [ testTseDirResult == 'false' ]; then
96
+ sendDeviceLog $deviceId "cannot find '$tseDir', abort"
97
+ fi
98
+
99
+ # copy and override
100
+ cp -f latest-tse-adapter.jar "$tseDir/tse-0.0.3.jar"
101
+
102
+ # restart service
103
+ $tseDir/AadenTseServiceRegister.exe restart
104
+
105
+ else
106
+ sudo cp -f latest-tse-adapter.jar /var/www/html/TseHost/tse-0.0.2.jar
107
+ sudo service aaden-tse restart
108
+ fi
109
+
110
+ echo "sleep 15s to wait service restart"
111
+ sleep 15s
112
+
113
+ tseVersionCommand2=$(cat <<- 'PHP'
114
+ $ini = parse_ini_file('/var/www/html/Resource/config/config.ini', true);
115
+ $tseUrl = $ini['TSE']['TseHost'] ?? 'http://localhost:8014';
116
+ $versionResp = file_get_contents("$tseUrl/adapterVersion");
117
+ $version = json_decode($versionResp, true)['major'] ?? 'null';
118
+ echo $version;
119
+ PHP
120
+ )
121
+ tseVersion2=`php -r "$tseVersionCommand2"`
122
+
123
+ if [ $tseVersion2 != 'null' ]; then
124
+ if [ $targetVersion -le $tseVersion2 ]; then
125
+ sendDeviceLog $deviceId "tse update done, current version is ($tseVersion2)"
126
+ exit 1
127
+ fi
128
+ fi
129
+
130
+ sendDeviceLog $deviceId "update failed, current version is ($tseVersion2)"
@@ -9,3 +9,5 @@ delete from PaymentLog where 1=1;
9
9
  delete from ZbonCombinedRecord where 1=1;
10
10
  insert into ZbonCombinedRecord (zbonNumber, toTimestamp)
11
11
  values (0, current_timestamp);
12
+ delete from MemberCardRecord where true;
13
+ delete from CashAmountLiteral where true;
package/dist/index.js CHANGED
@@ -18507,7 +18507,7 @@ module.exports = JSON.parse('{"name":"axios","version":"0.19.2","description":"P
18507
18507
  /***/ ((module) => {
18508
18508
 
18509
18509
  "use strict";
18510
- module.exports = {"i8":"1.6.78"};
18510
+ module.exports = {"i8":"1.6.79"};
18511
18511
 
18512
18512
  /***/ })
18513
18513
 
@@ -18636,6 +18636,7 @@ program.command('convert-database').action(convertDataBaseCharset)
18636
18636
  program.command('migrate').action(migrate)
18637
18637
 
18638
18638
  program.command('auto-write-gdpdu').action(autoWriteGdpdu)
18639
+ program.command('auto-send-tea-maker-task').action(autoSendTeaMakerTask)
18639
18640
  program.command('export-tse').action(exportTse)
18640
18641
  program.command('fix-ngrok').action(fixNgrok)
18641
18642
  program.command('do-log').action(doLog)
@@ -19226,6 +19227,11 @@ function autoWriteGdpdu() {
19226
19227
  runMultiple(files)
19227
19228
  }
19228
19229
 
19230
+ function autoSendTeaMakerTask() {
19231
+ const files = ['AadenDeploy/Utils/sendTeaMakerTaskService.sh']
19232
+ runMultiple(files)
19233
+ }
19234
+
19229
19235
  })();
19230
19236
 
19231
19237
  module.exports = __webpack_exports__;
package/index.js CHANGED
@@ -55,6 +55,7 @@ program.command('convert-database').action(convertDataBaseCharset)
55
55
  program.command('migrate').action(migrate)
56
56
 
57
57
  program.command('auto-write-gdpdu').action(autoWriteGdpdu)
58
+ program.command('auto-send-tea-maker-task').action(autoSendTeaMakerTask)
58
59
  program.command('export-tse').action(exportTse)
59
60
  program.command('fix-ngrok').action(fixNgrok)
60
61
  program.command('do-log').action(doLog)
@@ -644,3 +645,8 @@ function autoWriteGdpdu() {
644
645
  const files = ['AadenDeploy/Utils/writeGdpduService.sh']
645
646
  runMultiple(files)
646
647
  }
648
+
649
+ function autoSendTeaMakerTask() {
650
+ const files = ['AadenDeploy/Utils/sendTeaMakerTaskService.sh']
651
+ runMultiple(files)
652
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aaden-cli",
3
- "version": "1.6.78",
3
+ "version": "1.6.79",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {