|
@@ -16,7 +16,7 @@ use think\Db;
|
|
|
*/
|
|
|
class Product extends Base
|
|
|
{
|
|
|
- protected $noNeedLogin = ['detail', 'lists','index_sifang','cate_list'];
|
|
|
+ protected $noNeedLogin = ['detail', 'lists','pifa_lists','index_sifang','cate_list'];
|
|
|
|
|
|
/**
|
|
|
* @ApiTitle (产品详情)
|
|
@@ -172,23 +172,24 @@ class Product extends Base
|
|
|
public function pifa_lists(){
|
|
|
$page = $this->request->request('page', 1);
|
|
|
$pagesize = $this->request->request('listrow', 10);
|
|
|
- $by = $this->request->request('by', 'weigh');
|
|
|
- $desc = $this->request->request('desc', 'desc');
|
|
|
|
|
|
$result = Db::name('unishop_order_product')->alias('op')
|
|
|
->join('unishop_order o','op.order_id = o.id','LEFT')
|
|
|
- ->where(['o.status' => 1,'o.have_paid' => 1])
|
|
|
+ ->join('user','op.user_id = user.id','LEFT')
|
|
|
+ ->where(['o.status' => 1,'o.have_paid' => ['GT',0]])
|
|
|
->page($page, $pagesize)
|
|
|
- ->order($by, $desc)
|
|
|
- ->field('id,title,image,sales_price,sales,real_sales')
|
|
|
+ ->order('op.id desc')
|
|
|
+// ->group('op.user_product')
|
|
|
+ ->group('op.user_id,op.product_id')
|
|
|
+ ->field('product_id,title,image,pifa_price as price,user.nickname,user.avatar,sum(pifa_stock) as pifa_stock')
|
|
|
->select();
|
|
|
|
|
|
- if ($result) {
|
|
|
- $result = collection($result)->toArray();
|
|
|
- } else {
|
|
|
- $this->success(1,[]);
|
|
|
+ $list = list_domain_image($result,['image','avatar']);
|
|
|
+ foreach($list as $key => &$val){
|
|
|
+ $val['product_id'] = \addons\unishop\extend\Hashids::encodeHex($val['product_id']);
|
|
|
}
|
|
|
- $this->success('', $result);
|
|
|
+
|
|
|
+ $this->success(1, $list);
|
|
|
}
|
|
|
|
|
|
//首页商品四方列表
|