本文整理匯總了PHP中option::get_attention方法的典型用法代碼示例。如果您正苦於以下問題:PHP option::get_attention方法的具體用法?PHP option::get_attention怎麽用?PHP option::get_attention使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類option
的用法示例。
在下文中一共展示了option::get_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');
}