作者 anyv
1 个管道 的构建 通过 耗费 0 秒

首页

... ... @@ -22,6 +22,13 @@ class ClassifyController extends WeChatBaseController{
$data_classify = Db::name('classification') -> select();
//所有标签
$data_label = Db::name('label') -> select();
$classify_id = $this -> request -> param();
if($classify_id){
echo '有';
}else{
echo '没有';
}
die;
//获取默认分类商品
$data_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$data_classify[0]['id']) -> select() -> toArray();
foreach($data_goods as $key => $val){
... ... @@ -41,14 +48,8 @@ class ClassifyController extends WeChatBaseController{
*/
public function classify_goods(){
if($this -> request -> isPost()){
$classify_id = $_POST['classify_id'];
$data_classify_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$classify_id) -> select() -> toArray();
}else{
$id = $this -> request -> param();
$classify_id = $id['classify_id'];
$data_classify_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$classify_id) -> select() -> toArray();
}
foreach($data_classify_goods as $key => $val){
$price = explode('.',$data_classify_goods[$key]['price']);
$data_classify_goods[$key]['price0'] = $price[0];
... ...