Ejemplo n.º 1
0
 public function pilih_tugas($f3)
 {
     $post = $f3->get('POST');
     $data = $f3->scrub($post);
     $header = $f3->get("HEADERS");
     $dataHeader = $f3->scrub($header);
     $notes = "takenby:" . $dataHeader['Token'];
     $id_tugas = $data['id_tugas'];
     $tugas = new \models\OrdersM();
     $tugas->load(array('id=?', $id_tugas));
     $tugas->status++;
     $tugas->notes = $notes;
     $tugas->save();
     $notif = new Notifikasi();
     $beritahu = $notif->kirim_notif($f3, $tugas->id_user);
     $this->set_code("01");
     $this->set_msg("Tugas dipilih");
     $this->set_data("tugas", ["id_tugas" => $id_tugas, "status" => $tugas->status, "notif" => $beritahu]);
     $this->return_json();
 }
Ejemplo n.º 2
0
 public function insert($f3)
 {
     $post = $f3->get('POST');
     $data = $f3->scrub($post);
     $header = $f3->get("HEADERS");
     $dataHeader = $f3->scrub($header);
     $user_id = $this->didecode($dataHeader['Id']);
     //harus gede dapannya
     //        echo '<pre>';
     //        print_r($headers);
     //        print_r($post);
     $order = new \models\OrdersM();
     $order->id_user = $user_id;
     $order->id_laundry = $data['id_laundry'];
     $order->alamat = $data['alamat'];
     $order->latitude = $data['tkp']['latitude'];
     $order->longitude = $data['tkp']['longitude'];
     $order->no_tlp = $data['no_tlp'];
     $order->jenis_layanan = $data['jenis_layanan'];
     $order->grand_total = $data['grand_total'];
     $order->produk = $data['produk'];
     $order->catatan = $data['catatan'];
     $order->dibuat = $f3->get('sekarang');
     $order->status = 0;
     $simpan = $order->save();
     if ($order->get('_id') > 1) {
         $this->set_code("01");
         $this->set_msg($order->get('_id'));
         $this->set_data("permintaan", ['OK']);
         $this->return_json();
     } else {
         $this->set_code("00");
         $this->set_msg("Terdapat error pengiriman data ke server");
         $this->set_data("permintaan", ['ERROR']);
         $this->return_json();
     }
 }