Exemplo n.º 1
0
 public function insert_tag_link_pic($tag_name, $pic_id)
 {
     $tag = $this->insert_tag($tag_name);
     $conditions = " tag_name = :tag_name: and pic_id =:pic_id:";
     $parameters = array("tag_name" => $tag->tag_name, "pic_id" => $pic_id);
     $db_tag_link_pic = MeiuiPicLinkTag::findFirst(array($conditions, "bind" => $parameters));
     if (!$db_tag_link_pic) {
         $db_tag_link_pic = new MeiuiPicLinkTag();
         $db_tag_link_pic->pic_id = $pic_id;
         $db_tag_link_pic->user_id = $_SESSION['auth']['id'];
         $db_tag_link_pic->tag_id = $tag->id;
         $db_tag_link_pic->tag_name = $tag->tag_name;
         $db_tag_link_pic->save();
     }
     return $db_tag_link_pic;
 }
Exemplo n.º 2
0
 private function del_tag_link_pic($pic_id, $tag_id)
 {
     $conditions = " tag_id = :tag_id: and  pic_id = :pic_id: and del_flag = 1 ";
     $parameters = array("tag_id" => $tag_id, "pic_id" => $pic_id);
     $user_tag = MeiuiUserTag::find(array($conditions, "bind" => $parameters));
     if ($user_tag) {
         $conditions = " tag_id = :tag_id: and pic_id =:pic_id:";
         $parameters = array("tag_id" => $tag_id, "pic_id" => $pic_id);
         $db_tag_link_pic = MeiuiPicLinkTag::findFirst(array($conditions, "bind" => $parameters));
         if ($db_tag_link_pic) {
             $db_tag_link_pic->delete();
         }
     }
 }