/** * Deleta os registros de musicas de uma banda pelo Id * @param string $bandId */ public static function delMusics($bandId) { self::prepare('musics'); return self::$psy->delete(function ($data) use($bandId) { if ($data['band'] == $bandId) { return true; } }); }
/** * 删除分类 * * @param integer $cateId 分类ID */ public function delCate($cateId) { // 先检查该分类是否有子分类 $select = $this->db->select()->from('category', 'cate_id')->where('parent_id = ?', $cateId)->limit(1); $child = $this->db->fetchOne($select); if (!empty($child)) { throw new Regulus_Exception('该分类下有子分类,必须先删除或者转移所有子分类才能删除父分类'); } $where = $this->db->quoteInto('cate_id = ?', $cateId); $this->db->delete('category', $where); $this->_allCates = null; }
/** * 批量删除文件 * * @return void * @author weizhifeng **/ protected function act_rm_cbd() { if (!$this->check_time_out()) { $this->time_error_msg(Kohana::lang('o_kc.time_out')); } $file_count = count($this->post['file_ids']); if ($this->config['readonly'] || !isset($this->post['file_ids']) || !is_array($this->post['file_ids']) || !$file_count) { $this->errorMsg(Kohana::lang('o_kc.file_not_exist')); } // 批量删除文件 for ($i = 0; $i < $file_count; $i++) { $this->kc_image->delete($this->post['file_ids'][$i]); } // 容量计算 $size_info = $this->get_size_by_site_id(); $now_size = $size_info['now_size']; $max_size = $size_info['max_size']; echo '<root><size now="' . $now_size . '" max="' . $max_size . '"/></root>'; die; }
function changeThumbnail() { $obj = new obj(); $array = $_POST['thumbnail_data']; $cid = $_POST['cid']; $lno = $_POST['lno']; $data = $obj->delete('tbl_mu_thubnail', 'WHERE cid = ' . $cid . ' AND lno = ' . $lno); for ($i = 0; $i < count($array); $i++) { $split = explode("-", $array[$i]); $new_array[$i]['lno'] = $lno; $new_array[$i]['cid'] = $cid; $new_array[$i]['pid'] = $split[0]; $new_array[$i]['ptime'] = $split[1]; $new_array[$i]['ppage'] = $split[2]; } print_r($new_array); $count = count($new_array) - 1; for ($x = 0; $x <= $count; $x++) { $obj->insert("tbl_mu_thubnail", $new_array[$x]); } echo "Success"; }