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

📄 auctionviewshowmsg.java

📁 云网论坛CWBBS 源码,内容丰富,学习,参考,教学的好资料,具体见内说明,
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package com.redmoon.forum.plugin.auction;

import javax.servlet.http.HttpServletRequest;

import com.redmoon.forum.MsgDb;
import com.redmoon.forum.plugin.base.IPluginViewShowMsg;
import com.redmoon.forum.plugin.base.UIShowMsg;
import cn.js.fan.util.StrUtil;
import com.redmoon.forum.Privilege;
import com.redmoon.forum.plugin.ScoreMgr;
import com.redmoon.forum.plugin.ScoreUnit;
import cn.js.fan.web.SkinUtil;
import java.util.Vector;
import java.util.Iterator;
import cn.js.fan.util.DateUtil;
import cn.js.fan.util.ErrMsgException;
import cn.js.fan.util.ResKeyException;
import com.redmoon.forum.person.UserDb;
import org.apache.log4j.Logger;
import com.redmoon.forum.person.UserMgr;

public class AuctionViewShowMsg implements IPluginViewShowMsg {
    HttpServletRequest request;
    boolean isRoot = false;
    Logger logger = Logger.getLogger(AuctionViewShowMsg.class.getName());
    /**
     *
     * @param request HttpServletRequest
     * @param boardCode String
     * @param msgDb MsgDb 当在每个贴子的显示区时,msgDb为对应的贴子,当在NOTE区域时,msgDb为根贴,当在快速回复区时,msgDb也为根贴
     */
    public AuctionViewShowMsg(HttpServletRequest request, String boardCode, MsgDb msgDb) {
        this.request = request;
        this.msgDb = msgDb;
        this.boardCode = boardCode;
        if (msgDb.getReplyid()==-1)
            isRoot = true;
    }

    public String getShowtopicSql(HttpServletRequest request, MsgDb rootMsgDb, String userId) {
        return "";
    }

    public String getQuickReplyFormElement() {
        String str = "";
        String username = Privilege.getUser(request);
        // 如果浏览者为楼主
/*
                 if (username.equals(msgDb.getName()))
            str = AuctionViewAddReply.getFormSecretLevel(request, AuctionMsgDb.SECRET_LEVEL_FORUM_PUBLIC);
        else {

            AuctionUserDb su = new AuctionUserDb();
            su = su.getAuctionUserDb(msgDb.getId(), username);
            if (su.isLoaded()) {
                // 如果用户是申请者
                if (su.getType() == su.TYPE_APPLIER) {
                }
                else // 默认密级为楼主可见
                    str = AuctionViewAddReply.getFormSecretLevel(request, AuctionMsgDb.SECRET_LEVEL_MSG_OWNER);
            }
            else {
                // 如果用户尚未申请
                str = AuctionSkin.LoadString(request, "LABEL_NOTE_CANNOT_QUICKREPLY");
            }

        }
*/
return "";
    }

    public String getQucikReplyNote() {
        String str = "";
        String username = Privilege.getUser(request);
        if (username.equals(msgDb.getName()))
            str = AuctionSkin.LoadString(request, "LABEL_NOTE_OWNER");
        else {
/*
            AuctionUserDb su = new AuctionUserDb();
            su = su.getAuctionUserDb(msgDb.getId(), username);
            if (su.isLoaded()) {
                if (su.getType() == su.TYPE_APPLIER) {
                    str = AuctionSkin.LoadString(request, "LABEL_NOTE_CANNOT_QUICKREPLY");
                }
            }
            else {
                str = AuctionSkin.LoadString(request, "LABEL_NOTE_CANNOT_QUICKREPLY");
            }
*/
        }
        return str;
    }

    public String getNote() {
        UserMgr um = new UserMgr();
        String str = AuctionSkin.LoadString(request, "LABEL_MSG_OWNER") + "<a href='../userinfo.jsp?username=" + StrUtil.UrlEncode(msgDb.getName()) + "'>" + um.getUser(msgDb.getName()).getNick() + "</a>";
        String str2 = AuctionSkin.LoadString(request, "LABEL_MSG_NOTE");

        AuctionDb ad = new AuctionDb();
        ad = ad.getAuctionDb(msgDb.getRootid());
        // 发布商品时失败了
        if (!ad.isLoaded())
            return AuctionSkin.LoadString(request, "err_fail_add_auction");

        UserDb user = new UserDb();
        user = user.getUser(ad.getUserName());

        AuctionShopDb as = new AuctionShopDb();
        as = as.getAuctionShopDb(user.getName());

        str2 = str2.replaceFirst("\\$state", ad.getStateDesc(request));
        str2 = str2.replaceFirst("\\$credit", user.getCredit()+"");
        str = str + "&nbsp;" + str2;

        if (as.isLoaded()) {
            str2 = AuctionSkin.LoadString(request, "LABEL_ENTER_USER_SHOP");
            str2 = str2.replaceFirst("\\$user", user.getName());
            str2 = str2.replaceFirst("\\$shopName", as.getShopName());
            str2 = str2.replaceFirst("\\$shopId", as.getId()+"");
            str += str2;
        }
        return str;
    }

    public String render(int position) {
        String str = "";
        switch (position) {
        case UIShowMsg.POS_NOTE:
            str = getNote();
            break;
        case UIShowMsg.POS_BEFORE_MSG:
            // 如果是根贴
            AuctionBoardDb ab = new AuctionBoardDb();
            ab = ab.getAuctionBoardDb(boardCode);
            String skinCode = ab.getSkinCode();
            String skinPath = AuctionSkin.getSkinPath(skinCode);

            if (isRoot) {
                AuctionDb ad = new AuctionDb();
                ad = ad.getAuctionDb(msgDb.getId());

                // 发布商品时失败了
                if (!ad.isLoaded())
                    return AuctionSkin.LoadString(request, "err_fail_add_auction");

                str += ad.getName() + "<BR>";
                str += AuctionSkin.LoadString(request, "count") + ":&nbsp;" + ad.getCount() + "<BR>";
                str += AuctionSkin.LoadString(request, "sell_type") + ":&nbsp;";
                // 如果是拍卖
                if (ad.getSellType()==ad.SELL_TYPE_AUCTION) {
                    str += AuctionSkin.LoadString(request, "sell_type_auction") +
                            "<BR>";

                    AuctionWorthDb aw = new AuctionWorthDb();
                    long[] ids = aw.getWorthOfAuction(ad.getMsgRootId());
                    int id = (int)ids[0];
                    aw = aw.getAuctionWorthDb(id);
                    ScoreMgr sm = new ScoreMgr();
                    ScoreUnit su = sm.getScoreUnit(aw.getMoneyCode());
                    // 当前出价
                    String strcurPrice = LoadString("bid_cur_price");
                    double curPrice = ad.getCurBidPrice();
                    if (curPrice==0)
                        curPrice = aw.getPrice();
                    strcurPrice = strcurPrice.replaceFirst("\\$curPrice", StrUtil.FormatPrice(curPrice));
                    str += strcurPrice + su.getDanWei();

                    AuctionConfig ac = new AuctionConfig();
                    String bitFormAction = ac.getProperty("bidFormAction");
                    str += "<table class=watermark width=300><form id=auctionform1 name=auctionform1 action='" + bitFormAction + "' method=post>";

⌨️ 快捷键说明

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