关于加入购物车代码问题 JSP
问题描述
1、多人同时操作加入购物车出现加不进去的状况
2、单人操作,增加几个店铺之后,在增加就加不上了
3、有时加入购物车为空
加入购物车代码如下,代码是什么问题吗?还是哪里不对?
if(caozuoml_qt.equals("baocungwc"))//加入购物车
{
Map xiangqingcp=sjk.dedaoytjl("select * from chanpin where biaohao ='"+zfccl.dedaoqqbl("shuju1","")+"'");//产品详情
String cpwangzhi = "xiangqingcp-"+String.valueOf(xiangqingcp.get("biaohao"))+".htm";
Float yunfei=Float.parseFloat(String.valueOf(xiangqingcp.get("yunfei")));
int shuliang = Integer.parseInt(zfccl.dedaoqqbl("shuju2",""));
String yicunzcpbh = sjk.dedaozdz("select chanpinbh from gouwuche where chanpinbh='"+zfccl.dedaoqqbl("shuju1","")+"' ","");
Float zongjiage= Integer.parseInt(zfccl.dedaoqqbl("shuju2",""))*Float.parseFloat(String.valueOf(xiangqingcp.get("xiaoshoujg")));//总价
Float xsje= Float.parseFloat(String.valueOf(xiangqingcp.get("xiaoshoujg")));
Float scjg= Float.parseFloat(String.valueOf(xiangqingcp.get("shichangjg")));
Float zsjg= Float.parseFloat(String.valueOf(xiangqingcp.get("zengsongjf")));
Float dhjf= Float.parseFloat(String.valueOf(xiangqingcp.get("duihuanjf")));
int m = 0;
if(!yicunzcpbh.equals(""))
{
m=sjk.charugxjl("update gouwuche set chanpinsl=chanpinsl+"+shuliang+",chanpinzjg=chanpinzjg+"+zongjiage+" where chanpinbh='"+zfccl.dedaoqqbl("shuju1","")+"' ");//修改已存在商品数量,总价格
//out.print(yicunzcpbh);
}
else
{
m= sjk.charugxjl("insert into gouwuche (biaohao,chanpinbh,chanpinbt,chanpintp,chanpinwz,chanpinsl,chanpinzjg,chanpinxsjg,chanpinscjg,chanpinzsjf,chanpindhjf,chanpinyf,tianjiayhbh,shangjiabh,tianjiasj,tianjiaipdz,chanpinsx,xiugaiyhbh,xiugaisj,xiugaiipdz,yunfeizl ) values ('"+zfccl.dedaoqqbl("shuju3","")+"','"+String.valueOf(xiangqingcp.get("biaohao"))+"','"+String.valueOf(xiangqingcp.get("biaoti"))+"','"+String.valueOf(xiangqingcp.get("tupian"))+"','"+cpwangzhi+"',"+shuliang+","+zongjiage+","+xsje+","+scjg+","+zsjg+","+dhjf+","+yunfei+",'"+dlyh.get("biaohao")+"','"+xiangqingcp.get("tianjiayhbh")+"','"+zfccl.dedaodqsj("")+"','"+zfccl.dedaodqipdz()+"','"+String.valueOf(xiangqingcp.get("leixing"))+"','"+dlyh.get("biaohao")+"','"+zfccl.dedaodqsj("")+"','"+zfccl.dedaodqipdz()+"','"+String.valueOf(xiangqingcp.get("yunfeizl"))+"')"); //加入购物车
}
sjk.guanbi();
if( m ==1 )
{
out.print("chenggong");
}
else
{
out.print("cuowu");
}
return;
}
死魚量產型
10 years, 1 month ago