⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clubtopicmanage.java

📁 特色: 1.今晚在线社区独有的双风格分桢形式 2.社区最多可进行3级分类
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * Created on 2005年1月5日, 下午3:49
 * Last modified on 2006-1-24
 * Powered by GamVan.com
 */
package com.gamvan.club.topic;

import java.util.List;

import com.gamvan.club.classed.ClubClassInfo;
import com.gamvan.club.dao.impl.ClubTopicImpl;
import com.gamvan.club.dao.impl.ClubTopicListImpl;
import com.gamvan.club.item.ClubClassItem;
import com.gamvan.club.item.ClubTopicItem;
import com.gamvan.club.item.ClubTopicReItem;
import com.gamvan.club.message.ClubMessageSend;
import com.gamvan.club.user.ClubUsers;
import com.gamvan.tools.FormatDateTime;

/**
 * @author GamVan by 我容易么我
 * Powered by GamVan.com
 */
public class ClubTopicManage extends ClubTopicItem{
    private static final long serialVersionUID = 1L;
    private String act = new String();
    private double userMark=0, userMoney=0, userCredit=0;
    private String ccName="";
    private String message = new String();
    private String message2 = new String();
    private String userName, byUser, saveLink;
    private String postMsg = "0";
    private String userMessage = "";
    
    /* 日至相关变量声明 */
    private int byUserID=0;
    private String byUserIP="";
	private String topicLogTxt = ""; //日志备注
	private String topic="";
	private String topicLogSo="";
	private boolean topicLogList = false;
    private short topicLogByUserList=0; //日志信息是否显示在网页底部
    
    /* 判断是对主题操作还是对回复操作,以确定是更新哪张数据表的内容 */
    private boolean isRe = false; 

    /* 格式化当前时间 */
    private static final String now = FormatDateTime.formatDateTime("yyyy-MM-dd HH:mm:ss");
    private static final ClubUsers cu = new ClubUsers();
    private static final ClubTopicDel ctd = new ClubTopicDel();
    private static final ClubTopicImpl ctim = new ClubTopicImpl();
    private static final ClubTopicListImpl ctlim = new ClubTopicListImpl();
    private String moveTxt = "";
    
    
    public void topicDos(String[] ids){
        int id = 0;
        for(int i=0; i<ids.length; i++){
            id = Integer.parseInt(ids[i]);
            topicID = id;
            topicDo(id);
        }
    }
    
    public void topicDo(int id){
    	if(isRe){
    		topicReID = id;
    	}else{
    		topicID = id;
    	}
    	getTopicInfo();
        if(act.equals("1")){
            topicIsPass(id, true);
        }
        else if(act.equals("2")){
            topicIsPass(id, false);
        }
        else if(act.equals("3")){ //标记删除
        	topicLogSo = "删除主题";    
        	if(isRe){
        		topicLog(0, id);    //写入日志
        	}else{
        		topicLog(id, 0);    //写入日志
        	}
        	ctd.topicGarbage(id, isRe, (byte)1);
        	//message = ctd.getMessage();
        }
        else if(act.equals("4")){//还原标记删除
        	topicLogSo = "还原主题";                    
        	if(isRe){
        		topicLog(0, id);    //写入日志
        	}else{
        		topicLog(id, 0);    //写入日志
        	}
        	ctd.topicGarbage(id, isRe, (byte)0);
        	//message = ctd.getMessage();
        }
        else if(act.equals("5")){
            ctd.setIsRe(this.isRe);
            ctd.topicDel(id);
            message = ctd.getMessage();
        }
        else{
            message = "请选择您要操作的内容";
        }
    }
    
    /**
     * 认证主题
     * @param id
     * @param ispass
     * 2005-12-27 10:37:49 Made In GamVan
     * com.gamvan.club.topic
     */
    public void topicIsPass(int id, boolean ispass){
        int i = 0;
        try{
            if(id==-1){
                i = ctim.topicUpdateIsPass(-1, -1, ispass);
            }else{
                if(isRe){
                    i = ctim.topicUpdateIsPass(0, id, ispass);
                }else{
                    i = ctim.topicUpdateIsPass(id, 0, ispass);
                }  
            }
            message = i + " 条主题被更新!";
        }catch(Exception e){
            message = e.toString();
            e.printStackTrace();
        }
    }
    
    
    /**
     * 
     * @param page
     * @param pageNum
     * @param isPass 0所有未认证主题  1所有已认证主题 -1全部主题
     * @return
     * 2005-11-5 20:38:14 Made In GamVan
     * com.gamvan.club.topic
     */
    public List topicList(int page, int pageNum, int isPass){
        List list = null;
        try{
        	Boolean topicpass;
            if(isPass==1){
                topicpass = new Boolean(true);
            }
            else if(isPass==0){
            	topicpass = new Boolean(false);
            }else{
            	topicpass = null;
            }
            ctlim.setTopicIsDel(topicIsDel);
            ctlim.setCcID(ccID);
        	if(isRe){
        		list = ctlim.topicReAllList(page, pageNum, topicpass, " order by topicReID desc");
        	}else{
        		list = ctlim.topicAllList(page, pageNum, topicpass, " order by topicID desc");
        	}        
        }catch(Exception e){
            message = e.toString();
        }
        return list;
    }
    
    public int topicCount(int isPass){
        int i = 0;
        try{
        	Boolean topicpass;
            if(isPass==1){
                topicpass = new Boolean(true);
            }
            else if(isPass==0){
            	topicpass = new Boolean(false);
            }else{
            	topicpass = null;
            }
            ctlim.setCcID(ccID);
            ctlim.setTopicIsDel(topicIsDel);
        	if(isRe){
        		i = ctlim.topicReAllCount(topicpass,"");
        	}else{
        		i = ctlim.topicAllCount(topicpass,"");
        	}
        }catch(Exception e){
            message = e.toString();
        }
        return i;
    }
    
    
    public boolean topicLog(int tid, int reid){
    	boolean bea = false;
    	try{
    		//日至对象
	        ClubTopicLog ctl = new ClubTopicLog();
	        ctl.setTopicID(tid);
            ctl.setTopicReID(reid);
	        ctl.setTopic(topic);
	        ctl.setUserName(userName);
	        ctl.setUserID(userID);
	        ctl.setTopicLogByUserName(byUser);
	        ctl.setTopicLogByUserID(byUserID);
	        ctl.setTopicLogByUserIP(byUserIP);
	        if(!topicLogTxt.equals("")&&!moveTxt.equals("")){
	        	topicLogTxt += "<br/>";
	        }
	        ctl.setTopicLogTxt(topicLogTxt+moveTxt);
	        ctl.setUserCredit(userCredit);
	        ctl.setUserMark(userMark);
	        ctl.setUserMoney(userMoney);
	        ctl.setTopicLogSo(topicLogSo);
	        ctl.setTopicLogList(topicLogList);
	        ctl.setTopicLogByUserList(topicLogByUserList);
	        ctl.setCcID(ccID);
	        bea = ctl.executeLog();
	        message2 = ctl.getMessage();
            bea = true;
    	}catch(Exception e){
    		message2 = e.toString();
    	}
    	message += message2;
    	return bea;
    }
    
    
    public void getTopicInfo(){
        if(topicReID>0){
            ClubTopicReItem ctit = null;
            ctit = ctim.topicReInfo(topicReID);
            this.topicPro = ctit.getTopicPro(); //获取主题属性
            this.userName = ctit.getUserName();
            this.userID = ctit.getUserID();
            this.topic = ctit.getTopic();
            this.topicLayer = ctit.getTopicLayer();
            this.topicIsDel = ctit.getTopicIsDel();
            this.ccID = ctit.getCcID();
        }else{
            ClubTopicItem ctit = null;
            ctit = ctim.topicInfo(topicID);
            this.topicPro = ctit.getTopicPro(); //获取主题属性
            this.userName = ctit.getUserName();
            this.userID = ctit.getUserID();
            this.topic = ctit.getTopic();
            this.topicLayer = ctit.getTopicLayer();
            this.topicIsDel = ctit.getTopicIsDel();
            this.ccID = ctit.getCcID();
        }
    }

	/**
	 * 
	 * @param act
	 * @return
	 * com.gamvan.club.topic
	 */
    public boolean topicManage(String act){
        boolean bea = false;
        getTopicInfo();
        if(topicIsDel==0){
            if(act.equals("manage")){ // log
                topicLogSo = "奖/惩";
                bea = topicLog(topicID, topicReID); 
                if(bea){
                    bea = cu.userUpdate(userID, userMark, userMoney, userCredit, 0, 0);
                    if(!bea){
                        this.message = cu.getMessage();
                    }
                }
                this.message = message2;    
            }
            
            else if(act.equals("del")){
            	if(topicReID>0){
            		ctd.topicGarbage(topicReID, true, (byte)1, userMark, userMoney, userCredit);
            	}else{
            		ctd.topicGarbage(topicID, false, (byte)1, userMark, userMoney, userCredit);
            	}
				topicLogSo = "删除主题";                    
				bea = topicLog(topicID, topicReID);    //写入日志  
				if(bea){
					message2 = this.topic + "<br /><br />主题删除操作成功!<br /><br />";
				}else{
					message2 = this.topic + "<br /><br />主题删除操作失败!<br /><br />";
				}
				this.message += this.message2;
            }
            
            else if(act.equals("best")){
                if(this.topicPro!=1){
                    bea = topicFieldUpdate(topicID, "topicPro", 1);
                    if(bea){
                        topicLogSo = "精品归档";                    
                        bea = topicLog(topicID, topicReID); //写入日志   
                        if(bea){ //判断日志是否正确写入
                            bea = cu.userUpdate(userID, userMark, userMoney, userCredit, 3, 0);
                            if(bea){ //判断用户参数是否正确更新
                                this.message = this.topic + "<br /><br />主题已被加为精品!<br /><br />";
                            }
                        }
                        this.message += this.message2;
                        
                    }else{
                        this.message= "您的操作触发一个美丽的意外,指令将不被执行,请重新尝试!";
                    }
                }else{
                    message = this.topic + "<br /><br />主题已经是精品文章,请不要重复操作!<br /><br />";
                }
            }
            
            else if(act.equals("nobest")){
                if(topicPro==1){
                    bea = topicFieldUpdate(topicID, "topicPro", 0);
                    if(bea){
                        topicLogSo = "解除精品";                  
                        bea = topicLog(topicID, topicReID); //写入日志
                        if(bea){  //判断日志是否正确写入
                            bea = cu.userUpdate(userID, userMark, userMoney, userCredit, 3, 0);
                            if(bea){  //判断用户参数是否正确更新
                                this.message = this.topic + "<br /><br />文章精品属性已被取消!<br /><br />";
                            }
                        }
                        this.message += message2;
                    }else{
                        message= "您的操作触发一个美丽的意外,指令将不被执行,请重新尝试!";
                    }
                }else{
                    message = this.topic + "<br /><br />该主题属性已经不是精品,请不要重复操作!<br /><br />";
                }
            }else if(act.equals("move")){
                    bea = topicMove(topicID, moveCCID);
                    if(bea){    
                        //topicLogSo = 已定义
                        bea = topicLog(topicID, topicReID); //写入日志     
                        if(bea){
                            bea = cu.userUpdate(userID, userMark, userMoney, userCredit, 3, 0);
                            if(bea){
                                this.message = this.topic + "<br /><br />文章移动成功!<br /><br />";
                            }
                        }
                        this.message += message2;
                    }else{
                        //message= "您的操作触发一个美丽的意外,指令将不被执行,请重新尝试!";
                    }
            }else if(act.equals("top")){
                    bea = topicFieldUpdate(topicID, "topicOrder", topicOrder);
                    if(bea){
                    	if(topicOrder>0){
                    		topicLogSo = "文章置顶";
                    	}else{
                    		topicLogSo = "解除置顶";
                    	}
                        bea = topicLog(topicID, topicReID); //写入日志
                        if(bea){  //判断日志是否正确写入
                            bea = cu.userUpdate(userID, userMark, userMoney, userCredit, 3, 0);
                            if(bea){
                                message = this.topic + "<br /><br />置顶操作成功!<br /><br />";
                            }
                        }
                        this.message += message2;
                    }else{
                        message= "您的操作触发一个美丽的意外,指令将不被执行,请重新尝试!";
                    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -