示例#1
0
 public function run()
 {
     foreach ($this->data() as $data) {
         $db = new ModelAuth();
         foreach ($data as $key => $value) {
             $db->{$key} = $value;
         }
         $db->save();
     }
 }
示例#2
0
 public function bukaPintu()
 {
     try {
         $dbAuth = new ModelAuth();
         $id_auth = $dbAuth->getIdAuthByToken($this->app->request()->headers->get('API-Token'));
         $this->sendTrigger($id_auth, 1);
         sleep(5);
         $this->sendTrigger($id_auth, 0);
     } catch (\Exception $ex) {
         $this->writeToJSON(['errmsg' => 'service unavailable'], 503);
     }
 }