Exemplo n.º 1
0
 function addusertag($content)
 {
     $this->load->model('servicepublicclass/posttagpublic', 'posttagpublic');
     $posttag = new posttagpublic();
     $posttag->loadtag($content);
     $data = array('deviceid' => $posttag->deviceid, 'tags' => $posttag->tags, 'productkey' => $posttag->productkey);
     $this->db->insert('device_tag', $data);
 }
Exemplo n.º 2
0
 /** 
  * Add user tag 
  * AddUserTag function 
  * 
  * @param string $content content 
  * 
  * @return void 
  */
 function addUserTag($content)
 {
     $this->load->model('servicepublicclass/posttagpublic', 'posttagpublic');
     $posttag = new posttagpublic();
     $posttag->loadtag($content);
     $data = array('deviceid' => $posttag->deviceid, 'tags' => $posttag->tags, 'productkey' => $posttag->productkey);
     $this->redis->lpush('razor_usertag', serialize($data));
     $this->processor->process();
 }
Exemplo n.º 3
0
 function postTag()
 {
     $this->load->model('servicepublicclass/posttagpublic', 'posttagpublic');
     if (!isset($_POST["content"])) {
         $ret = array('flag' => -3, 'msg' => 'Invalid content.');
         echo json_encode($ret);
         return;
     }
     $encoded_content = $_POST['content'];
     log_message("debug", $encoded_content);
     $content = json_decode($encoded_content);
     $posttag = new posttagpublic();
     $posttag->loadtag($content);
     $retParamsCheck = $this->utility->isPraramerValue($content, $array = array("deviceid", "tags", "productkey"));
     if ($retParamsCheck["flag"] <= 0) {
         $ret = array('flag' => -2, 'msg' => $retParamsCheck['msg']);
         echo json_encode($ret);
         return;
     }
     $key = $posttag->productkey;
     $isKeyAvailable = $this->utility->isKeyAvailale($key);
     if (!$isKeyAvailable) {
         $ret = array('flag' => -1, 'msg' => 'NotAvailable appkey  ');
         echo json_encode($ret);
         return;
     } else {
         try {
             $this->usertag->addUserTag($content);
             $ret = array('flag' => 1, 'msg' => 'ok');
         } catch (Exception $ex) {
             $ret = array('flag' => -4, 'msg' => 'DB Error');
         }
     }
     echo json_encode($ret);
 }