|
@@ -20,29 +20,7 @@ use app\common\Service\SkuSpec as SkuSpecService;
|
|
*/
|
|
*/
|
|
class Goods extends Base
|
|
class Goods extends Base
|
|
{
|
|
{
|
|
- protected $noNeedLogin = ['index', 'detail', 'lists', 'getWxCode'];
|
|
|
|
-
|
|
|
|
- //首页推荐商品
|
|
|
|
- public function index()
|
|
|
|
- {
|
|
|
|
- $hots = GoodsModel::where('status', 'normal')
|
|
|
|
- ->order('weigh desc')
|
|
|
|
- ->limit(12)
|
|
|
|
- ->cache(false)
|
|
|
|
- ->select();
|
|
|
|
- $recommends = GoodsModel::getIndexGoodsList();
|
|
|
|
- foreach ($hots as $item) {
|
|
|
|
- $item->visible(explode(',', 'id,title,price,marketprice,sales,views,image'));
|
|
|
|
- }
|
|
|
|
- foreach ($recommends as $item) {
|
|
|
|
- $item->visible(explode(',', 'id,title,price,marketprice,sales,views,image'));
|
|
|
|
- }
|
|
|
|
- $this->success('获取成功', [
|
|
|
|
- 'hots' => $hots,
|
|
|
|
- 'recommends' => $recommends
|
|
|
|
- ]);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ protected $noNeedLogin = [ 'detail', 'lists', 'getWxCode'];
|
|
//详情
|
|
//详情
|
|
public function detail()
|
|
public function detail()
|
|
{
|
|
{
|
|
@@ -136,7 +114,7 @@ class Goods extends Base
|
|
// }
|
|
// }
|
|
// $row->coupon = $couponList;
|
|
// $row->coupon = $couponList;
|
|
|
|
|
|
- $row->visible(explode(',', 'id,title,type,spec_type,subtitle,category_ids,price,marketprice,sales,views,
|
|
|
|
|
|
+ $row->visible(explode(',', 'id,title,type,spec_type,sub_title,category_ids,price,lineation_price,sales,views,is_hot,
|
|
image,content,images,sku_spec,sku,comment,is_collect,guarantee,attributes,favor_rate,coupon'));
|
|
image,content,images,sku_spec,sku,comment,is_collect,guarantee,attributes,favor_rate,coupon'));
|
|
$row = $row->toArray();
|
|
$row = $row->toArray();
|
|
$row['content'] = \app\common\library\Service::formatTplToUniapp($row['content']);
|
|
$row['content'] = \app\common\library\Service::formatTplToUniapp($row['content']);
|
|
@@ -210,7 +188,7 @@ class Goods extends Base
|
|
$list = $query->paginate($pageSize);
|
|
$list = $query->paginate($pageSize);
|
|
|
|
|
|
foreach ($list as $item) {
|
|
foreach ($list as $item) {
|
|
- $item->visible(explode(',', 'id,title,image,price,sales,views,description,marketprice,createtime'));
|
|
|
|
|
|
+ $item->visible(explode(',', 'id,title,image,price,sales,views,description,lineation_price,is_hot,createtime'));
|
|
}
|
|
}
|
|
|
|
|
|
$this->success('', $list);
|
|
$this->success('', $list);
|