|
|
@ -21,6 +21,8 @@ use app\api\model\store\Module as StoreModuleModel; |
|
|
|
use app\common\model\GoodsCategoryRel as GoodsCategoryRelModel; |
|
|
|
use app\common\model\GoodsCategoryRel as GoodsCategoryRelModel; |
|
|
|
use app\api\model\GoodsSpecRel as GoodsSpecRelModel; |
|
|
|
use app\api\model\GoodsSpecRel as GoodsSpecRelModel; |
|
|
|
use app\common\model\Goods as GoodsModel; |
|
|
|
use app\common\model\Goods as GoodsModel; |
|
|
|
|
|
|
|
use app\common\model\GoodsImage as GoodsImageModel; |
|
|
|
|
|
|
|
use app\common\model\UploadFile as UploadFileModel; |
|
|
|
use app\common\enum\goods\Status as GoodsStatusEnum; |
|
|
|
use app\common\enum\goods\Status as GoodsStatusEnum; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use cores\exception\BaseException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
|
use think\db\exception\DataNotFoundException; |
|
|
@ -209,12 +211,26 @@ class Goods extends GoodsModel |
|
|
|
$goods = explode(',', $info->goods_list); |
|
|
|
$goods = explode(',', $info->goods_list); |
|
|
|
|
|
|
|
|
|
|
|
$list = goods::alias('a') |
|
|
|
$list = goods::alias('a') |
|
|
|
->join('goods_category_rel b', 'a.goods_id = b.goods_id')->where([ |
|
|
|
->join('goods_category_rel b', 'a.goods_id = b.goods_id') |
|
|
|
|
|
|
|
->where([ |
|
|
|
'a.store_id' => request()->header()['storeid'], |
|
|
|
'a.store_id' => request()->header()['storeid'], |
|
|
|
'a.status' => 10, |
|
|
|
'a.status' => 10, |
|
|
|
'b.category_id' => $_GET['category_id'] |
|
|
|
'b.category_id' => $_GET['category_id'] |
|
|
|
])->whereIn('a.goods_id', $goods)->field('a.goods_id,a.goods_name,a.goods_price_min,b.category_id,a.sales_initial,a.sales_actual')->select()->toArray(); |
|
|
|
])->whereIn('a.goods_id', $goods)->field('a.goods_id,a.goods_name,a.goods_price_min,b.category_id,a.sales_initial,a.sales_actual')->select()->toArray(); |
|
|
|
|
|
|
|
//暂时 要优化 |
|
|
|
|
|
|
|
foreach ($list as &$v) { |
|
|
|
|
|
|
|
$file_id = GoodsImageModel::where([ |
|
|
|
|
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
|
|
|
|
'goods_id' => $v['goods_id'], |
|
|
|
|
|
|
|
])->field('image_id')->find()->image_id; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$file_path = UploadFileModel::where([ |
|
|
|
|
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
|
|
|
|
'file_id' => $file_id, |
|
|
|
|
|
|
|
])->field('file_path')->find()->file_path; |
|
|
|
|
|
|
|
$v['image'] = $_SERVER['HTTP_HOST'] . '/uploads/' . $file_path; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return $list; |
|
|
|
return $list; |
|
|
|
} |
|
|
|
} |
|
|
|
return []; |
|
|
|
return []; |
|
|
|