jhshTimeModify.js 861 B

1234567891011121314151617181920212223
  1. let time = '';
  2. let json = JSON.parse($response.body);
  3. if (json?.data?.SYSTEM_TIME) {
  4. if (json?.data?.MSPS_ENTITY?.EFFECT_PERIOD_START) {
  5. time = json.data.MSPS_ENTITY.EFFECT_PERIOD_START.replace(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/, '$1-$2-$3 $4:$5:$6');
  6. } else if (json?.data?.ACT_START_DTM) {
  7. time = json.data.ACT_START_DTM;
  8. } else if (json?.data?.KHHK_ENTITY?.DcCp_Avy_StTm) {
  9. time = json?.data?.SYSTEM_TIME.replace(/(\d{2}):(\d{2}):(\d{2})$/, json.data.KHHK_ENTITY.DcCp_Avy_StTm.replace(/^(\d{2})(\d{2})(\d{2})$/, '$1:$2:$3'));
  10. }
  11. if (time) {
  12. if (Date.now() < Date.parse(time)) {
  13. json['data']['SYSTEM_TIME'] = time;
  14. }
  15. console.log(`SYSTEM_TIME: ${json['data']['SYSTEM_TIME']}`);
  16. }
  17. } else {
  18. console.log($response.body);
  19. }
  20. $done({ body: JSON.stringify(json) });