|
|
@@ -3,6 +3,7 @@
|
|
|
namespace app\api\controller;
|
|
|
|
|
|
use think\Db;
|
|
|
+use think\db\Expression;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\ProductLists;
|
|
|
use app\common\model\ProductsModel;
|
|
|
@@ -28,15 +29,27 @@ class Product extends Api
|
|
|
{
|
|
|
$list = $productsModel->where('status', 1)->column('id,'.$this->lan.'_title as title');
|
|
|
$resp = array();
|
|
|
- foreach ($list as $kk =>$val) {
|
|
|
- $pro = $productLists->with('productpopular')->where('productpopular.status', '<', $productPopular::STOP)->where('product_lists.type_id', $kk)
|
|
|
- ->order('productpopular.start_time', 'asc')->select();
|
|
|
+
|
|
|
+ foreach ($list as $kk =>$val)
|
|
|
+ {
|
|
|
+ $pro= $productPopular->alias('a')
|
|
|
+ ->join("product_list b", "b.id=a.product_id", "LEFT")
|
|
|
+ ->field('a.id,'.'b.'.$this->lan.'_name as name,a.product_id,b.thum as img_url,price,cost_price,stock,num,start_time,end_time,a.status')
|
|
|
+ ->where('a.status', '<', $productPopular::STOP)
|
|
|
+ ->where('b.type_id', $kk)
|
|
|
+ ->order('a.status')
|
|
|
+ ->select();
|
|
|
+
|
|
|
$resp[] = ['type_id'=>$kk,'title'=>$val, 'product'=>$pro];
|
|
|
}
|
|
|
+
|
|
|
$this->success('', $resp);
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 转让列表
|
|
|
* sort: 0 默认排序 1价格从高到低 2价格从低到高
|