Ejemplo n.º 1
0
 /**
  * 设置图集封面ID
  * @param int $g_id
  * @param int $p_id 为0时置空
  * @param int $u_id
  * @return array|null
  */
 public function set_front_cover($g_id, $p_id, $u_id)
 {
     $g_id = intval($g_id);
     $p_id = intval($p_id);
     $u_id = intval($u_id);
     $this->galleryOwnerCheck($g_id, $u_id);
     lib()->load('Picture');
     if ($p_id < 1) {
         $p_id = NULL;
         $this->db->update("gallery", ['gallery_front_cover' => $p_id], ['id' => $g_id]);
         return NULL;
     } else {
         $p = new Picture();
         $p->picOwnerCheck($p_id, $u_id);
         $this->db->update("gallery", ['gallery_front_cover' => $p_id], ['id' => $g_id]);
         return $p->get($p_id, $u_id);
     }
 }