Skip to content

Commit

Permalink
add support API: add new track
Browse files Browse the repository at this point in the history
  • Loading branch information
Anisan committed Nov 29, 2019
1 parent 4cad33a commit 3039ab2
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions modules/app_PostTracker/app_PostTracker.class.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -152,6 +152,41 @@ function admin(&$out) {


} }
} }

function api($params) {
if ($params['op']=='add') {
$rec=array();
$rec['NAME']=$params['name'];
$rec['TRACK']=$params['track'];
$rec['TRACK_URL']=$params['track_url'];
$rec['WAIT_DAY']= 50;
$rec['DESCRIPTION'] = '';
if (array_key_exists($params,'waitday'))
$rec['WAIT_DAY']=$params['waitday'];
if (array_key_exists($params,'description'))
$rec['DESCRIPTION']=$params['description'];

$rec['CREATED'] = date ("Y-m-d H:i:s");
$rec['LAST_DATE'] = date ("Y-m-d H:i:s");
$rec['LAST_STATUS'] = "Start monitoring";
$rec['ID']=SQLInsert("pt_track", $rec); // adding new record
$status = array();
$status['DATE_STATUS'] = date ("Y-m-d H:i:s");;
$status['STATUS_INFO'] = "Add track code to module";
$status['TRACK_ID'] = $rec['ID'];
$status['PROVIDER'] = -1;
$status['PROVIDER_ID'] = 0;
SQLInsert("pt_status", $status);
$this->addTrackToProvider($rec);
$this->exec_script_newstatus($rec,"");
$this->updateStatusInit($rec);

return "OK";
exit;
}
echo "Not support command";
}

/** /**
* FrontEnd * FrontEnd
* *
Expand Down

0 comments on commit 3039ab2

Please sign in to comment.