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

5

... ... @@ -143,22 +143,34 @@ class PersonalcenterController extends WeChatBaseController{
$uid = cmf_get_current_user_id();
$data = Db::name('collect') -> where("uid =".$uid) -> select() -> toArray();
$data_count = count($data);
if(!empty($data)){
foreach($data as $key => $val){
$data_goods[] = Db::name('goods') -> where("id =".$val['goods_id']) -> find();
$collect_goods = Db::name('goods') -> where("id =".$val['goods_id']) -> where("is_out = 1") -> find();
if($collect_goods != null){
$data_goods[] = $collect_goods;
}
}
foreach ($data_goods as $key => $val){
$price = explode('.',$val['price']);
$pricing = explode('.',$val['pricing']);
$data_goods[$key]['price0'] = $price[0];
$data_goods[$key]['price1'] = $price[1];
$data_goods[$key]['pricing0'] = $pricing[0];
$data_goods[$key]['pricing1'] = $pricing[1];
if(!empty($data_goods)){
foreach ($data_goods as $key => $val){
$price = explode('.',$val['price']);
$pricing = explode('.',$val['pricing']);
$data_goods[$key]['price0'] = $price[0];
$data_goods[$key]['price1'] = $price[1];
$data_goods[$key]['pricing0'] = $pricing[0];
$data_goods[$key]['pricing1'] = $pricing[1];
}
}else{
$data_goods = '';
}
}else{
$data_goods = '';
}
if(!empty($data_goods)){
$data_count = count($data_goods);
}else{
$data_count = 0;
}
$this -> assign('data_count',$data_count);
$this -> assign('data_goods',$data_goods);
return $this -> fetch();
... ... @@ -204,7 +216,10 @@ class PersonalcenterController extends WeChatBaseController{
$uid = cmf_get_current_user_id();
$data = Db::name('browsing_history') -> where("uid =".$uid) -> select();
foreach($data as $key => $val){
$data_goods[] = Db::name('goods') -> where('id',$val['goods_id']) -> find();
$browsing_history_goods = Db::name('goods') -> where('id',$val['goods_id']) -> where("is_out = 1") -> find();
if($browsing_history_goods != null){
$data_goods[] = $browsing_history_goods;
}
}
if(!empty($data_goods)){
foreach($data_goods as $key => $val){
... ...