Esempio n. 1
0
 function up_position_home()
 {
     $max = new article();
     $max->select_max('home_hot_position');
     $max->where('home_hot_position <', $this->home_hot_position);
     $max->where('home_hot', 1);
     $max->get();
     $o = new article();
     $o->where('home_hot_position', $max->home_hot_position);
     $o->where('home_hot', 1);
     $o->get();
     if ($o->result_count() > 0) {
         $tg = $this->home_hot_position;
         $this->home_hot_position = $o->home_hot_position;
         $o->home_hot_position = $tg;
         $o->save();
         $this->save();
         $this->arrange_position_home();
         return true;
     } else {
         return false;
     }
 }