public function Addgood($a, $b) { $Tuanid = $a; $good = $b; $array = explode(',', $good); $User = M("Tuanid"); if ($User->where("Tuanpid='{$Tuanid}'")->select()) { $User->where("Tuanpid='{$Tuanid}'")->delete(); //商品列表如果存在则删除,重新循环遍历 for ($i = 0; $i < count($array); $i++) { $goodid = $array[$i]; $data["goodid"] = $goodid; $data["price"] = get_good_tuanprice($goodid); $data["view"] = get_good_view($goodid); $data["salenumber"] = get_sales($goodid); $data["tuanpid"] = $Tuanid; $data["create_time"] = time(); // 设置用户的创建时间 $User->add($data); } } else { //商品列表不存在,遍历添加 for ($i = 0; $i < count($array); $i++) { $goodid = $array[$i]; $data["goodid"] = $goodid; $data["Tuanpid"] = $Tuanid; $data["price"] = get_good_price($goodid); $data["view"] = get_good_view($goodid); $data["salenumber"] = get_sales($goodid); $data["create_time"] = time(); // 设置用户的创建时间 $User->add($data); } } }
</div> <!-- /菜单 --> <!-- 主体 --> <div class="commom_wrapper"> <section> <div class="tuanlist"> <div class="category_nav"> <dl> <dt><a href="<?php echo U('Tuan/index'); ?> ">全部分类</a></dt> <dd><?php if (is_array($category)) { $i = 0; $__LIST__ = $category; if (count($__LIST__) == 0) { echo ""; } else { foreach ($__LIST__ as $key => $vo) { $mod = $i % 2; ++$i; ?> <a href="<?php echo U('Tuan/category?id=' . $vo['id']);