function delevent() { $id = (int) $this->Get['id']; if ($id < 1) { $this->Messager("请选择要删除的活动", -1); } load::logic('event'); $eventLogic = new EventLogic(); $return = $eventLogic->delEvent($id); if ($return == 1) { $this->Messager("该活动已有报名者,或者您不能删除该活动,如要删除,请联系管理员", -1); } elseif ($return == 2) { $this->Messager("活动不存在或已删除", -1); } else { $this->Messager("删除活动成功", "index.php?mod=event&code=myevent"); } }
function delete_qun($qid, $cat_id) { $where_sql = " qid='{$qid}' "; DB::query("DELETE FROM " . DB::table('qun') . " WHERE {$where_sql}"); DB::query("DELETE FROM " . DB::table('qun_user') . " WHERE {$where_sql}"); $this->delete_tag_relation($qid); $info = DB::fetch_first("SELECT icon FROM " . DB::table('qun') . " WHERE qid='{$qid}'"); if (!empty($info['icon'])) { unlink($this->qun_avatar($qid, 's')); unlink($this->qun_avatar($qid, 'b')); } DB::query("DELETE FROM " . DB::table('qun_announcement') . " WHERE qid='{$qid}'"); $cat_ary = $this->get_category(); $top_cat_id = $cat_ary['second'][$cat_id]['parent_id']; DB::query("UPDATE " . DB::table('qun_category') . "\r\n\t\t\t\t SET qun_num = if(qun_num>0,qun_num-1,0)\r\n\t\t\t\t WHERE cat_id IN('{$cat_id}','{$top_cat_id}') "); $this->update_category_cache(); load::logic('event'); $EventLogic = new EventLogic(); $eid_arr = array(); $query = DB::query("SELECT eid FROM " . DB::table('qun_event') . " WHERE qid='{$qid}'"); while ($val = DB::fetch($query)) { $eid_arr[$val['eid']] = $val['eid']; } foreach ($eid_arr as $key => $eid) { $EventLogic->delEvent($eid); } $tids = array(); $query = DB::query("SELECT tid FROM " . DB::table('topic_qun') . " WHERE item_id='{$qid}'"); while ($value = DB::fetch($query)) { $tids[] = $value['tid']; } if (!empty($tids)) { DB::query("DELETE FROM " . DB::table('topic_qun') . " WHERE item_id='{$qid}'"); $where_sql = " tid IN(" . jimplode($tids) . ") "; DB::query("DELETE FROM " . DB::table('topic') . " WHERE {$where_sql} "); } }
function delete() { $ids = array(); $up_ids = array(); $id = (int) $this->Get['id']; if ($id) { $ids[] = $id; } if ($this->Post['cronssubmit']) { $ids = $this->Post['ids']; $up_ids = $this->Post['up_id']; $vid = $this->Post['vid']; } if (!empty($vid)) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event set recd = 0 where id in ('" . implode("','", $vid) . "')"); foreach ($vid as $val) { if (!in_array($val, $ids) && in_array($val, $up_ids)) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event set recd = 1 where id = '{$val}' "); } } } load::logic('event'); $eventLogic = new EventLogic(); if ($ids) { foreach ($ids as $val) { $eventLogic->delEvent($val, 1); } } $this->Messager("操作成功"); }