Ejemplo n.º 1
0
 public function picture_more_delete()
 {
     try {
         $this->throwMsgCheck('is_post', 'is_login', 'is_active');
         lib()->load('Picture');
         $pic = new Picture();
         $ids = array_flip(array_flip(array_map('intval', explode(",", req()->post('id')))));
         $errors = [];
         foreach ($ids as $id) {
             try {
                 $pic->delete($id, login_user()->getId());
             } catch (\Exception $ex) {
                 $errors[$id] = $ex->getMessage();
             }
         }
         if (count($errors) > 0) {
             $this->rt_msg['msg'] = implode("\n", $errors);
             $this->rt_msg['content'] = count($errors);
         } else {
             $this->rt_msg['status'] = true;
         }
     } catch (\Exception $ex) {
         $this->rt_msg['msg'] = $ex->getMessage();
         $this->rt_msg['code'] = $ex->getCode();
     }
 }