Exemplo n.º 1
0
 /**
  * share内容记录
  * @param  [type] $db        [description]
  * @param  [type] $contentid [description]
  * @param  [type] $openid    [description]
  * @return [type]            [description]
  */
 public static function logShare($db, $contentid, $openid)
 {
     $result = $db->fetch_first("select * from shares where contentid=" . $contentid . " and shareOpenid='" . $openid . "'");
     $timenow = time();
     if (!empty($result['id'])) {
         $db->query("update shares set updatetime=" . $timenow . " where id=" . $result['id']);
     } else {
         $sql = "insert into shares(`contentid`,`shareOpenid`,`addtime`)\n\t\t\t\t\tvalues(\n\t\t\t\t\t\t'" . $contentid . "',\n\t\t\t\t\t\t'" . $openid . "',\n\t\t\t\t\t\t'" . $timenow . "'\n\t\t\t\t\t)";
         $db->query($sql);
     }
     $errormsg = $db->error();
     if (!empty($errormsg)) {
         return false;
     } else {
         return true;
     }
 }
Exemplo n.º 2
0
 /**
  * Perform action on error.
  *
  * @param ConnectionInterface $conn      [description]
  * @param Exception           $exception [description]
  *
  * @return [type] [description]
  */
 public function onError(ConnectionInterface $conn, \Exception $exception)
 {
     $message = $exception->getMessage();
     $conn->close();
     $this->console->error(sprintf('Error: %s', $message));
 }