本文整理汇总了PHP中option::del_attention方法的典型用法代码示例。如果您正苦于以下问题:PHP option::del_attention方法的具体用法?PHP option::del_attention怎么用?PHP option::del_attention使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类option
的用法示例。
在下文中一共展示了option::del_attention方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateTopicFavorNum
}
//更新话题下的赞的数目
private function updateTopicFavorNum()
{
//先查询赞信息
$option = new option();
$favor = $option->get_attention('topic', 'favor');
if ($favor) {
$topic_ids = array();
foreach ($favor as $k => $v) {
$topic_ids[] = $k;
//更新话题赞数据
$sql = 'UPDATE `liv_topic` SET `favor_num` = ' . count($v) . ' WHERE topic_id = ' . $k;
$result = $this->db->query($sql);
}
if ($topic_ids) {
$sql = 'SELECT topic_id, state, type_state FROM `liv_topic` WHERE topic_id in (' . implode(',', $topic_ids) . ')';
$query = $this->db->query($sql);
$info = array();
$type = $state = array();
while ($row = $this->db->fetch_array($query)) {
$info[] = $row['topic_id'];
$state[$row['topic_id']] = $row['state'];
$type[$row['topic_id']] = $row['type_state'];
}
$del_ids = '';
$set_true = '';
$set_false = '';
$update_ids = array();
if ($info && $state && $type) {
foreach ($topic_ids as $v) {
if (!in_array($k, $info)) {
$dp = $del_ids ? "," : "";
$del_ids .= $dp . $v;
} else {
if ($type[$k] == 'team') {
$tp = $set_true ? "," : "";
$set_true .= $tp . $v;
} else {
if ($type[$k] == '' && $state[$k] == 0) {
$fp = $set_false ? "," : "";
$set_false .= $fp . $v;
} else {
//UNTODO
}
}
}
}
}
$del_ids = trim($del_ids, ',');
$set_true = trim($set_true, ',');
$set_false = trim($set_false, ',');
}
$option->del_attention($del_ids, $set_true, $set_false, 'topic');
}