예제 #1
0
 /**
  * 是否已经点击过了
  * @param  [type] $db          [description]
  * @param  [type] $contentid   [description]
  * @param  [type] $openid      [description]
  * @param  [type] $shareopenid [description]
  * @return [type]              [description]
  */
 public static function checkisClicked($db, $contentid, $openid, $shareopenid)
 {
     $result = $db->fetch_first("select * from clickcount where contentid=" . $contentid . " and clickOpenid='" . $openid . "' and shareOpenid='" . $shareopenid . "'");
     if (empty($result['id']) || $result['isvalid'] == 0) {
         return false;
     } else {
         return true;
     }
 }
예제 #2
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;
     }
 }