biz9-logic 4.8.299 → 4.8.302

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.
Files changed (3) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +126 -253
  3. package/package.json +1 -1
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='7.7.9'
1
+ VERSION='7.8.2'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -5,8 +5,6 @@ License GNU General Public License v3.0
5
5
  Description: BiZ9 Framework: Logic-JS
6
6
  */
7
7
  const moment = require('moment');
8
- const { exec } = require('child_process');
9
- const sharp = require('sharp');
10
8
  const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_new_full_item_main } = require('./main');
11
9
  const { Log,Str,DateTime,Num,Obj } = require('/home/think2/www/doqbox/biz9-framework/biz9-utility/code');
12
10
  class Message {
@@ -1149,266 +1147,266 @@ class DataItem {
1149
1147
  };
1150
1148
  }
1151
1149
  class Dashboard_Url {
1152
- static user_home = (app_id,url,params) => {
1150
+ static user_home = (app_id,url,param) => {
1153
1151
  let action_url="dashboard/user_home";
1154
- return get_cloud_url_main(app_id,url,action_url,params);
1152
+ return get_cloud_url_main(app_id,url,action_url,param);
1155
1153
  };
1156
- static app_home = (app_id,url,params) => {
1154
+ static app_home = (app_id,url,param) => {
1157
1155
  let action_url="dashboard/app_home";
1158
- return get_cloud_url_main(app_id,url,action_url,params);
1156
+ return get_cloud_url_main(app_id,url,action_url,param);
1159
1157
  };
1160
1158
  }
1161
1159
  class Blog_Post_Url {
1162
- static detail = (app_id,url,key,params) => {
1160
+ static detail = (app_id,url,key,param) => {
1163
1161
  let action_url="blog_post/detail/"+key;
1164
- return get_cloud_url_main(app_id,url,action_url,params);
1162
+ return get_cloud_url_main(app_id,url,action_url,param);
1165
1163
  };
1166
- static home = (app_id,url,params) => {
1164
+ static home = (app_id,url,param) => {
1167
1165
  let action_url="blog_post";
1168
- return get_cloud_url_main(app_id,url,action_url,params);
1166
+ return get_cloud_url_main(app_id,url,action_url,param);
1169
1167
  };
1170
- static search = (app_id,url,params) => {
1168
+ static search = (app_id,url,param) => {
1171
1169
  let action_url="blog_post/search";
1172
- return get_cloud_url_main(app_id,url,action_url,params);
1170
+ return get_cloud_url_main(app_id,url,action_url,param);
1173
1171
  };
1174
1172
  }
1175
1173
  class Product_Url {
1176
- static detail = (app_id,url,key,params) => {
1174
+ static detail = (app_id,url,key,param) => {
1177
1175
  let action_url="product/detail/"+key;
1178
- return get_cloud_url_main(app_id,url,action_url,params);
1176
+ return get_cloud_url_main(app_id,url,action_url,param);
1179
1177
  };
1180
- static home = (app_id,url,params) => {
1178
+ static home = (app_id,url,param) => {
1181
1179
  let action_url="product";
1182
- return get_cloud_url_main(app_id,url,action_url,params);
1180
+ return get_cloud_url_main(app_id,url,action_url,param);
1183
1181
  };
1184
- static search = (app_id,url,params) => {
1182
+ static search = (app_id,url,param) => {
1185
1183
  let action_url="product/search";
1186
- return get_cloud_url_main(app_id,url,action_url,params);
1184
+ return get_cloud_url_main(app_id,url,action_url,param);
1187
1185
  };
1188
1186
  }
1189
1187
  class Event_Url {
1190
- static detail = (app_id,url,key,params) => {
1188
+ static detail = (app_id,url,key,param) => {
1191
1189
  let action_url="event/detail/"+key;
1192
- return get_cloud_url_main(app_id,url,action_url,params);
1190
+ return get_cloud_url_main(app_id,url,action_url,param);
1193
1191
  };
1194
- static home = (app_id,url,params) => {
1192
+ static home = (app_id,url,param) => {
1195
1193
  let action_url="event";
1196
- return get_cloud_url_main(app_id,url,action_url,params);
1194
+ return get_cloud_url_main(app_id,url,action_url,param);
1197
1195
  };
1198
- static search = (app_id,url,params) => {
1196
+ static search = (app_id,url,param) => {
1199
1197
  let action_url="event/search";
1200
- return get_cloud_url_main(app_id,url,action_url,params);
1198
+ return get_cloud_url_main(app_id,url,action_url,param);
1201
1199
  };
1202
1200
  }
1203
1201
  class Service_Url {
1204
- static detail = (app_id,url,key,params) => {
1202
+ static detail = (app_id,url,key,param) => {
1205
1203
  let action_url="service/detail/"+key;
1206
- return get_cloud_url_main(app_id,url,action_url,params);
1204
+ return get_cloud_url_main(app_id,url,action_url,param);
1207
1205
  };
1208
- static home = (app_id,url,params) => {
1206
+ static home = (app_id,url,param) => {
1209
1207
  let action_url="service/search";
1210
- return get_cloud_url_main(app_id,url,action_url,params);
1208
+ return get_cloud_url_main(app_id,url,action_url,param);
1211
1209
  };
1212
- static search = (app_id,url,params) => {
1210
+ static search = (app_id,url,param) => {
1213
1211
  let action_url="service/search";
1214
- return get_cloud_url_main(app_id,url,action_url,params);
1212
+ return get_cloud_url_main(app_id,url,action_url,param);
1215
1213
  };
1216
1214
  }
1217
1215
  class Gallery_Url {
1218
- static detail = (app_id,url,key,params) => {
1216
+ static detail = (app_id,url,key,param) => {
1219
1217
  let action_url="gallery/detail/"+key;
1220
- return get_cloud_url_main(app_id,url,action_url,params);
1218
+ return get_cloud_url_main(app_id,url,action_url,param);
1221
1219
  };
1222
- static home = (app_id,url,params) => {
1220
+ static home = (app_id,url,param) => {
1223
1221
  let action_url="gallery";
1224
- return get_cloud_url_main(app_id,url,action_url,params);
1222
+ return get_cloud_url_main(app_id,url,action_url,param);
1225
1223
  };
1226
- static search = (app_id,url,params) => {
1224
+ static search = (app_id,url,param) => {
1227
1225
  let action_url="gallery/search";
1228
- return get_cloud_url_main(app_id,url,action_url,params);
1226
+ return get_cloud_url_main(app_id,url,action_url,param);
1229
1227
  };
1230
1228
  }
1231
1229
  class User_Url {
1232
- static info = (app_id,url,params) => {
1230
+ static info = (app_id,url,param) => {
1233
1231
  let action_url="user/info/";
1234
- return get_cloud_url_main(app_id,url,action_url,params);
1232
+ return get_cloud_url_main(app_id,url,action_url,param);
1235
1233
  };
1236
- static register = (app_id,url,params) => {
1234
+ static register = (app_id,url,param) => {
1237
1235
  let action_url="user/register";
1238
- return get_cloud_url_main(app_id,url,action_url,params);
1236
+ return get_cloud_url_main(app_id,url,action_url,param);
1239
1237
  };
1240
- static login = (app_id,url,params) => {
1238
+ static login = (app_id,url,param) => {
1241
1239
  let action_url="user/login";
1242
- return get_cloud_url_main(app_id,url,action_url,params);
1240
+ return get_cloud_url_main(app_id,url,action_url,param);
1243
1241
  };
1244
- static logout = (app_id,url,params) => {
1242
+ static logout = (app_id,url,param) => {
1245
1243
  let action_url="user/logout";
1246
- return get_cloud_url_main(app_id,url,action_url,params);
1244
+ return get_cloud_url_main(app_id,url,action_url,param);
1247
1245
  };
1248
1246
  }
1249
1247
  class Image_Url {
1250
- static post = (app_id,url,params) => {
1248
+ static post = (app_id,url,param) => {
1251
1249
  let action_url="main/image/post";
1252
- return get_cloud_url_main(app_id,url,action_url,params);
1250
+ return get_cloud_url_main(app_id,url,action_url,param);
1253
1251
  };
1254
- static post_cdn = (app_id,url,params) => {
1252
+ static post_cdn = (app_id,url,param) => {
1255
1253
  let action_url="main/image/post_cdn";
1256
- return get_cloud_url_main(app_id,url,action_url,params);
1254
+ return get_cloud_url_main(app_id,url,action_url,param);
1257
1255
  };
1258
1256
  }
1259
1257
  class Item_Url {
1260
- static activity = (app_id,url,params) => {
1258
+ static activity = (app_id,url,param) => {
1261
1259
  let action_url="item/activity";
1262
- return get_cloud_url_main(app_id,url,action_url,params);
1260
+ return get_cloud_url_main(app_id,url,action_url,param);
1263
1261
  };
1264
- static cart = (app_id,url,cart_number,params) => {
1262
+ static cart = (app_id,url,cart_number,param) => {
1265
1263
  let action_url="item/cart/"+cart_number;
1266
- return get_cloud_url_main(app_id,url,action_url,params);
1264
+ return get_cloud_url_main(app_id,url,action_url,param);
1267
1265
  };
1268
- static content = (app_id,url,key,params) => {
1266
+ static content = (app_id,url,key,param) => {
1269
1267
  let action_url="item/content/"+key;
1270
- return get_cloud_url_main(app_id,url,action_url,params);
1268
+ return get_cloud_url_main(app_id,url,action_url,param);
1271
1269
  };
1272
- static custom_field = (app_id,url,data_type,key,params) => {
1270
+ static custom_field = (app_id,url,data_type,key,param) => {
1273
1271
  let action_url="item/custom_field/"+data_type+"/"+key;
1274
- return get_cloud_url_main(app_id,url,action_url,params);
1272
+ return get_cloud_url_main(app_id,url,action_url,param);
1275
1273
  };
1276
- static delete_order = (app_id,url,id,params) => {
1274
+ static delete_order = (app_id,url,id,param) => {
1277
1275
  let action_url="item/delete_order/"+id;
1278
- return get_cloud_url_main(app_id,url,action_url,params);
1276
+ return get_cloud_url_main(app_id,url,action_url,param);
1279
1277
  };
1280
- static delete_cart = (app_id,url,id,params) => {
1278
+ static delete_cart = (app_id,url,id,param) => {
1281
1279
  let action_url="item/delete_cart/"+id;
1282
- return get_cloud_url_main(app_id,url,action_url,params);
1280
+ return get_cloud_url_main(app_id,url,action_url,param);
1283
1281
  };
1284
- static favorite = (app_id,url,parent_data_type,page_current,page_size,params) => {
1282
+ static favorite = (app_id,url,parent_data_type,page_current,page_size,param) => {
1285
1283
  let action_url="item/favorite/"+parent_data_type+"/"+page_current+"/"+page_size;
1286
- return get_cloud_url_main(app_id,url,action_url,params);
1284
+ return get_cloud_url_main(app_id,url,action_url,param);
1287
1285
  };
1288
- static order = (app_id,url,order_number,params) => {
1286
+ static order = (app_id,url,order_number,param) => {
1289
1287
  let action_url="item/order/"+order_number;
1290
- return get_cloud_url_main(app_id,url,action_url,params);
1288
+ return get_cloud_url_main(app_id,url,action_url,param);
1291
1289
  };
1292
- static post_cart = (app_id,url,parent_data_type,params) => {
1290
+ static post_cart = (app_id,url,parent_data_type,param) => {
1293
1291
  let action_url="item/post_cart/"+parent_data_type;
1294
- return get_cloud_url_main(app_id,url,action_url,params);
1292
+ return get_cloud_url_main(app_id,url,action_url,param);
1295
1293
  };
1296
- static post_cms = (app_id,url,data_type,id,params) => {
1294
+ static post_cms = (app_id,url,data_type,id,param) => {
1297
1295
  let action_url = "item/post_cms/"+data_type+"/"+id;
1298
- return get_cloud_url_main(app_id,url,action_url,params);
1296
+ return get_cloud_url_main(app_id,url,action_url,param);
1299
1297
  };
1300
- static post_favorite = (app_id,url,parent_data_type,parent_item_id,params) => {
1298
+ static post_favorite = (app_id,url,parent_data_type,parent_item_id,param) => {
1301
1299
  let action_url="item/post_favorite"+parent_data_type+"/"+parent_item_id;
1302
- return get_cloud_url_main(app_id,url,action_url,params);
1300
+ return get_cloud_url_main(app_id,url,action_url,param);
1303
1301
  };
1304
- static post_field_value = (app_id,url,item_data_type,parent_item_id,value_id,params) => {
1302
+ static post_field_value = (app_id,url,item_data_type,parent_item_id,value_id,param) => {
1305
1303
  let action_url="item/post_field_value/"+item_data_type+"/"+parent_item_id;
1306
- return get_cloud_url_main(app_id,url,action_url,params);
1304
+ return get_cloud_url_main(app_id,url,action_url,param);
1307
1305
  };
1308
- static post_review = (app_id,url,parent_data_type,item_id,params) => {
1306
+ static post_review = (app_id,url,parent_data_type,item_id,param) => {
1309
1307
  let action_url="item/post_review/"+parent_data_type+"/"+item_id;
1310
- return get_cloud_url_main(app_id,url,action_url,params);
1308
+ return get_cloud_url_main(app_id,url,action_url,param);
1311
1309
  };
1312
- static post_order = (app_id,url,params) => {
1310
+ static post_order = (app_id,url,param) => {
1313
1311
  let action_url="item/post_order";
1314
- return get_cloud_url_main(app_id,url,action_url,params);
1312
+ return get_cloud_url_main(app_id,url,action_url,param);
1315
1313
  };
1316
- static review = (app_id,url,parent_data_type,page_current,page_size,params) => {
1314
+ static review = (app_id,url,parent_data_type,page_current,page_size,param) => {
1317
1315
  let action_url="item/review/"+parent_data_type+"/"+page_current+"/"+page_size;
1318
- return get_cloud_url_main(app_id,url,action_url,params);
1316
+ return get_cloud_url_main(app_id,url,action_url,param);
1319
1317
  };
1320
- static search_cart = (app_id,url,parent_data_type,params) => {
1318
+ static search_cart = (app_id,url,parent_data_type,param) => {
1321
1319
  let action_url="item/search_cart/"+parent_data_type;
1322
- return get_cloud_url_main(app_id,url,action_url,params);
1320
+ return get_cloud_url_main(app_id,url,action_url,param);
1323
1321
  };
1324
- static search_order = (app_id,url,parent_data_type,params) => {
1322
+ static search_order = (app_id,url,parent_data_type,param) => {
1325
1323
  let action_url="item/search_order/"+parent_data_type;
1326
- return get_cloud_url_main(app_id,url,action_url,params);
1324
+ return get_cloud_url_main(app_id,url,action_url,param);
1327
1325
  };
1328
- static template = (app_id,url,key,params) => {
1326
+ static template = (app_id,url,key,param) => {
1329
1327
  let action_url="item/template/"+key;
1330
- return get_cloud_url_main(app_id,url,action_url,params);
1328
+ return get_cloud_url_main(app_id,url,action_url,param);
1331
1329
  };
1332
1330
  }
1333
1331
  class Category_Url {
1334
- static detail = (app_id,url,key,params) => {
1332
+ static detail = (app_id,url,key,param) => {
1335
1333
  let action_url="category/detail/"+key;
1336
- return get_cloud_url_main(app_id,url,action_url,params);
1334
+ return get_cloud_url_main(app_id,url,action_url,param);
1337
1335
  };
1338
- static home = (app_id,url,params) => {
1336
+ static home = (app_id,url,param) => {
1339
1337
  let action_url="category";
1340
- return get_cloud_url_main(app_id,url,action_url,params);
1338
+ return get_cloud_url_main(app_id,url,action_url,param);
1341
1339
  };
1342
- static search = (app_id,url,params) => {
1340
+ static search = (app_id,url,param) => {
1343
1341
  let action_url="category/search";
1344
- return get_cloud_url_main(app_id,url,action_url,params);
1342
+ return get_cloud_url_main(app_id,url,action_url,param);
1345
1343
  };
1346
1344
  }
1347
1345
  class Page_Url {
1348
- static get = (app_id,url,title_url,params) => {
1346
+ static get = (app_id,url,title_url,param) => {
1349
1347
  let action_url="page/get/"+title_url;
1350
- return get_cloud_url_main(app_id,url,action_url,params);
1348
+ return get_cloud_url_main(app_id,url,action_url,param);
1351
1349
  };
1352
- static home = (app_id,url,params) => {
1350
+ static home = (app_id,url,param) => {
1353
1351
  let action_url="page/home";
1354
- return get_cloud_url_main(app_id,url,action_url,params);
1352
+ return get_cloud_url_main(app_id,url,action_url,param);
1355
1353
  };
1356
- static about = (app_id,url,params) => {
1354
+ static about = (app_id,url,param) => {
1357
1355
  let action_url="page/about";
1358
- return get_cloud_url_main(app_id,url,action_url,params);
1356
+ return get_cloud_url_main(app_id,url,action_url,param);
1359
1357
  };
1360
- static contact = (app_id,url,params) => {
1358
+ static contact = (app_id,url,param) => {
1361
1359
  let action_url="page/contact";
1362
- return get_cloud_url_main(app_id,url,action_url,params);
1360
+ return get_cloud_url_main(app_id,url,action_url,param);
1363
1361
  };
1364
- static faq = (app_id,url,key,params) => {
1362
+ static faq = (app_id,url,key,param) => {
1365
1363
  let action_url="page/faq/"+key;
1366
- return get_cloud_url_main(app_id,url,action_url,params);
1364
+ return get_cloud_url_main(app_id,url,action_url,param);
1367
1365
  };
1368
1366
  }
1369
1367
  class Url{
1370
- static copy = (app_id,url,data_type,id,params) => {
1368
+ static copy = (app_id,url,data_type,id,param) => {
1371
1369
  let action_url = "main/crud/copy/"+data_type + "/" + id;
1372
- return get_cloud_url_main(app_id,url,action_url,params);
1370
+ return get_cloud_url_main(app_id,url,action_url,param);
1373
1371
  };
1374
- static delete = (app_id,url,data_type,id,params) => {
1372
+ static delete = (app_id,url,data_type,id,param) => {
1375
1373
  let action_url = "main/crud/delete/"+data_type + "/" + id;
1376
- return get_cloud_url_main(app_id,url,action_url,params);
1374
+ return get_cloud_url_main(app_id,url,action_url,param);
1377
1375
  };
1378
- static delete_check_protection = (app_id,url,data_type,id,params) => {
1376
+ static delete_check_protection = (app_id,url,data_type,id,param) => {
1379
1377
  let action_url = "main/crud/delete_item_check_protection/"+data_type + "/" + id;
1380
- return get_cloud_url_main(app_id,url,action_url,params);
1378
+ return get_cloud_url_main(app_id,url,action_url,param);
1381
1379
  };
1382
- static delete_search = (app_id,url,data_type,params) => {
1380
+ static delete_search = (app_id,url,data_type,param) => {
1383
1381
  let action_url = "main/crud/delete_list/"+data_type;
1384
- return get_cloud_url_main(app_id,url,action_url,params);
1382
+ return get_cloud_url_main(app_id,url,action_url,param);
1385
1383
  };
1386
- static url = (app_id,url,action_url,params) => {
1387
- return get_cloud_url_main(app_id,url,action_url,params);
1384
+ static url = (app_id,url,action_url,param) => {
1385
+ return get_cloud_url_main(app_id,url,action_url,param);
1388
1386
  }
1389
- static get = (app_id,url,data_type,key,params) => {
1387
+ static get = (app_id,url,data_type,key,param) => {
1390
1388
  let action_url= "main/crud/get/"+data_type + "/" + key;
1391
- return get_cloud_url_main(app_id,url,action_url,params);
1389
+ return get_cloud_url_main(app_id,url,action_url,param);
1392
1390
  };
1393
- static get_parent_top = (app_id,url,data_type,id,params) => {
1391
+ static get_parent_top = (app_id,url,data_type,id,param) => {
1394
1392
  let action_url = "main/crud/get_parent_top/"+data_type+"/"+id;
1395
- return get_cloud_url_main(app_id,url,action_url,params);
1393
+ return get_cloud_url_main(app_id,url,action_url,param);
1396
1394
  };
1397
- static search = (app_id,url,data_type,params) => {
1395
+ static search = (app_id,url,data_type,param) => {
1398
1396
  let action_url = "main/crud/search/"+data_type;
1399
- return get_cloud_url_main(app_id,url,action_url,params);
1397
+ return get_cloud_url_main(app_id,url,action_url,param);
1400
1398
  };
1401
- static upload_file = (app_id,url,data_type,id,params) => {
1399
+ static upload_file = (app_id,url,data_type,id,param) => {
1402
1400
  let action_url = "main/crud/post/"+data_type + "/" + id;
1403
- return get_cloud_url_main(app_id,url,action_url,params);
1401
+ return get_cloud_url_main(app_id,url,action_url,param);
1404
1402
  };
1405
- static post = (app_id,url,data_type,id,params) => {
1403
+ static post = (app_id,url,data_type,id,param) => {
1406
1404
  let action_url = "main/crud/post/"+data_type + "/" + id;
1407
- return get_cloud_url_main(app_id,url,action_url,params);
1405
+ return get_cloud_url_main(app_id,url,action_url,param);
1408
1406
  };
1409
- static post_list = (app_id,url,params) => {
1407
+ static post_list = (app_id,url,param) => {
1410
1408
  let action_url = "main/crud/post_list";
1411
- return get_cloud_url_main(app_id,url,action_url,params);
1409
+ return get_cloud_url_main(app_id,url,action_url,param);
1412
1410
  };
1413
1411
  }
1414
1412
  class Category_Logic {
@@ -1898,139 +1896,14 @@ class App_Logic {
1898
1896
  return app;
1899
1897
  }
1900
1898
  }
1901
-
1902
1899
  class Image_Logic {
1903
- static get_url = (host,image_filename,size) =>{
1904
- return host+"/"+size + "_"+image_filename;
1905
- }
1906
- static get_new_by_base64 = (base64) =>{
1907
- return DataItem.get_new(DataType.IMAGE,0,
1908
- {
1909
- mime_type:!Str.check_is_null(Str.get_file_type_from_base64(base64)) ? Str.get_file_type_from_base64(base64).mimeType : 'image/jpeg',
1910
- extension:!Str.check_is_null(Str.get_file_type_from_base64(base64)) ? Str.get_file_type_from_base64(base64).extension : 'jpeg',
1911
- image_filename:!Str.check_is_null(Str.get_file_type_from_base64(base64)) ? Str.get_guid()+"."+Str.get_file_type_from_base64(base64).extension : 'not_found.jpeg',
1912
- buffer:!Str.check_is_null(Str.get_file_type_from_base64(base64)) ? Buffer.from(base64.split(';base64,').pop(), 'base64') : null,
1913
- });
1914
- }
1915
- static get_cloud_flare_batch_token = (cloud_flare_account_id,cloud_flare_api_token) => {
1916
- return new Promise((callback) => {
1917
- let data_batch,error=null;
1918
- const url = "https://api.cloudflare.com/client/v4/accounts/"+cloud_flare_account_id+"/images/v1/batch_token";
1919
- const headers = {
1920
- "Accept": "application/json",
1921
- "Authorization": "Bearer " +cloud_flare_api_token
1922
- };
1923
- let curlCommand = `curl -s -H "Accept: ${headers.Accept}"`;
1924
- if (headers.Authorization) {
1925
- curlCommand += ` -H "Authorization: ${headers.Authorization}"`;
1926
- }
1927
- curlCommand += ` "${url}"`;
1928
- exec(curlCommand,async(err,stdout,stderr) => {
1929
- if (err) {
1930
- err = `1 Error executing curl command: ${error.message}`;
1931
- console.error(err);
1932
- error=Log.append(error,err);
1933
- return;
1934
- }
1935
- if (stderr) {
1936
- err = `2 Curl stderr: ${stderr}`;
1937
- console.error(err);
1938
- error=Log.append(error,err);
1939
- return;
1940
- }
1941
- try {
1942
- const jsonData =await JSON.parse(stdout);
1943
- data_batch = jsonData.result.token;
1944
- if(data_batch!== null){
1945
- callback([error,data_batch]);
1946
- }
1947
- } catch (parseError) {
1948
- console.error(`Error parsing JSON response: ${parseError.message}`);
1949
- console.log('Raw Response:', stdout);
1950
- callback([parseError,null]);
1951
- }
1952
- });
1953
- });
1954
- };
1955
- static post_cloud_flare_batch_image = (cloud_flare_api_token,batch_token,image_filename,item_file_path) => {
1956
- let error = null;
1957
- return new Promise((callback) => {
1958
- async.series([
1959
- async function(call){
1960
- const post_url = "https://batch.imagedelivery.net/images/v1";
1961
- const headers = {
1962
- "Accept": "application/json",
1963
- "Authorization": "Bearer " +batch_token
1964
- };
1965
- let curlCommand = `curl -s -H "Accept: ${headers.Accept}"`;
1966
- curlCommand += ` -H "Authorization: ${headers.Authorization}"`;
1967
- curlCommand += " -H X-Auth-Key: "+ cloud_flare_api_token;
1968
- curlCommand += " -F requireSignedURLs=false";
1969
- curlCommand += " -F id="+image_filename;
1970
- curlCommand += " -F file=@"+item_file_path;
1971
- curlCommand += ` "${post_url}"`;
1972
- exec(curlCommand, (err, stdout, stderr) => {
1973
- if (err) {
1974
- err = `Error executing curl command: ${err.message}`;
1975
- console.error(err);
1976
- error=Log.append(error,err);
1977
- }
1978
- if (stderr) {
1979
- err = `Curl stderr: ${stderr}`;
1980
- console.error(err);
1981
- error=Log.append(error,err);
1982
- }
1983
- try {
1984
- const jsonData = JSON.parse(stdout);
1985
- console.log('cool');
1986
- console.log(jsonData);
1987
- console.log('bean');
1988
- if(jsonData!== null){
1989
- callback([error,jsonData]);
1990
- }
1991
- } catch (parseError) {
1992
- console.error(`Error parsing JSON response: ${parseError.message}`);
1993
- console.log('Raw Response:', stdout);
1994
- error=Log.append(error,parseError);
1995
- callback([error,null]);
1996
- }
1997
- });
1998
- },
1999
- ])
2000
- });
2001
- };
2002
-
2003
- static post_write = (buffer,size,path_filename,is_square) => {
2004
- return new Promise((callback) => {
2005
- let data,error=null;
2006
- if(is_square){
2007
- sharp(buffer)
2008
- .resize(size)
2009
- .toFile(path_filename,(err, info) => {
2010
- if(err){
2011
- error=Log.append(error,'Error thumb saving file:');
2012
- console.error('Error thumb saving file:', err);
2013
- }
2014
- if(info!==null){
2015
- callback([error,true]);
2016
- }
2017
- });
2018
- }else{
2019
- sharp(buffer)
2020
- .resize(size,size,{fit:sharp.fit.fill,quality:100})
2021
- .toFile(path_filename,(err, info) => {
2022
- if(err){
2023
- error=Log.append(error,'Error thumb saving file:');
2024
- console.error('Error thumb saving file:', err);
2025
- }
2026
- if(info!==null){
2027
- callback([error,true]);
2028
- }
2029
- });
2030
- }
2031
- });
1900
+ static get_url = (host,image_filename,size,param) =>{
1901
+ if(!param){
1902
+ param="";
1903
+ }
1904
+ return host+"/"+size + "_"+image_filename+param;
2032
1905
  }
2033
- static get_process_list = (upload_dir,image_filename) =>{
1906
+ static get_process_list = (upload_dir,image_filename) =>{
2034
1907
  return [
2035
1908
  {
2036
1909
  image_filename:FieldType.IMAGE_SIZE_THUMB+"_"+image_filename,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.299",
3
+ "version": "4.8.302",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"