...
|
...
|
@@ -326,10 +326,58 @@ class User extends Api |
|
|
$this->error($validate->getError());
|
|
|
}
|
|
|
|
|
|
$res = Common::selectWhereData('collection',['uid'=>$this->uid],'id,g_id');
|
|
|
$goods_ids = array_column($res,'g_id');
|
|
|
$res1 = Common::goodsList(['id'=>['in',$goods_ids]],$page,$this->uid);
|
|
|
$this->success('成功',$res1);
|
|
|
$is_news = Common::is_new($this->uid);
|
|
|
$limit = config('verify.limit');
|
|
|
$where = ['uid'=>$this->uid];
|
|
|
if($is_news == 1){
|
|
|
//旧人
|
|
|
$where['is_new'] = 0;
|
|
|
}
|
|
|
$res = Db::name('collection')
|
|
|
->alias('c')
|
|
|
->join('goods g','c.g_id = g.id')
|
|
|
->where($where)
|
|
|
->field('g.id,g.image,g.name,g.tag,g.style,g.sale_price1 sale_price,g.expense_price,g.is_new')
|
|
|
->page($page,$limit)
|
|
|
->order('c.id desc')
|
|
|
->useSoftDelete('g.deletetime')
|
|
|
->select();
|
|
|
|
|
|
foreach ($res as &$value){
|
|
|
if($is_news == 2 || $is_news == 0){//未登录或者新人
|
|
|
if($value['is_new'] == 0){
|
|
|
//非新人优惠标签
|
|
|
$value['is_new_tag'] = 0;//不用显示新人价标签
|
|
|
}else{
|
|
|
//新人优惠标签
|
|
|
$value['is_new_tag'] = 1;//显示新人价标签
|
|
|
}
|
|
|
}else{
|
|
|
$value['is_new_tag'] = 0;//不用显示新人价标签(新人价标签商品不会出来)
|
|
|
}
|
|
|
$value['image'] = Common::absolutionUrlOne($value['image']);
|
|
|
$value['style'] = explode('|',$value['style']);
|
|
|
$value['tag'] = explode('|',$value['tag']);
|
|
|
$sale_price = Common::salePrice($value['sale_price']);
|
|
|
if($sale_price){
|
|
|
$value['sale_price'] = $sale_price[0];
|
|
|
}else{
|
|
|
$value['sale_price'] = '';
|
|
|
}
|
|
|
unset($value['is_new']);
|
|
|
}
|
|
|
$arr['data'] = $res;
|
|
|
//总页数
|
|
|
|
|
|
$count= Db::name('collection')
|
|
|
->alias('c')
|
|
|
->join('goods g','c.g_id = g.id')
|
|
|
->where($where)
|
|
|
->order('c.id desc')
|
|
|
->useSoftDelete('g.deletetime')
|
|
|
->count();
|
|
|
$arr['total_page'] = ceil($count/$limit);
|
|
|
$this->success('成功',$arr);
|
|
|
}else{
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
...
|
...
|
|