Exemplo n.º 1
0
 public function update()
 {
     $count = $this->input['count'] ? intval($this->input['count']) : 10;
     include_once ROOT_PATH . 'lib/class/mark.class.php';
     $obj_mark = new mark();
     $ret = $obj_mark->get_hot_mark(array('source' => 'topic', 'count' => -1));
     $info = array();
     $i = array();
     foreach ($ret as $k => $v) {
         $i[$v['parent_id']]++;
         if ($i[$v['parent_id']] > $count) {
             continue;
         }
         $info[$v['parent_id']][] = $v['mark_name'];
     }
     $sql = "UPDATE " . DB_PREFIX . "team SET ";
     foreach ($info as $k => $v) {
         $extra = "hot_topic_tags='" . implode(',', $v) . "' WHERE team_id=" . $k;
         $this->db->query($sql . $extra);
     }
 }