Rev 14346 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?phpclass OrderpushShell extends AppShell {public $uses = array('PythonApi','Order');public function main() {Configure::load('live');$options = array('conditions'=>array('status'=>array('ORDER_NOT_CREATED', 'new')),'recursive'=>-1);$orders = $this->Order->find('all',$options);if(!empty($orders)) {foreach($orders AS $order) {$response = $this->PythonApi->postOrders($order);if(!empty($response) && $response['result']) {$sql = "UPDATE orders SET status = '". $response['result']."' WHERE id = ".$order['Order']['id'];$this->Order->query($sql);}}}}}