|
|
|
@ -154,17 +154,27 @@ class Goods extends GoodsModel |
|
|
|
|
$model = new GoodsBrowseLog; |
|
|
|
|
$end_time = date('Y-m-d'); |
|
|
|
|
$start_time = date('Y-m-d', strtotime($end_time . ' - 15 days')); |
|
|
|
|
$list = $model->with(['sku', 'goods', 'images.file']) |
|
|
|
|
$list = $model->with(['goods', 'images.file']) |
|
|
|
|
->whereBetween('ctime', [$start_time, $end_time]) |
|
|
|
|
// ->where('ctime', '>=', $start_time) |
|
|
|
|
// ->where('ctime', '<=', $end_time) |
|
|
|
|
->order('ctime', 'desc') |
|
|
|
|
->where(['user_id' => $userId]) |
|
|
|
|
->select(); |
|
|
|
|
$goodsList = $list->toArray()['data'] ?? $list->toArray(); |
|
|
|
|
|
|
|
|
|
// |
|
|
|
|
$origin_goods_ids = []; |
|
|
|
|
foreach ($list as $key => $value) { |
|
|
|
|
$origin_goods_ids[] = $value['goods']['origin_goods_id'] ?? 0; |
|
|
|
|
} |
|
|
|
|
$goods_images = $this->storeUsePlatformGoodsImage($origin_goods_ids); |
|
|
|
|
|
|
|
|
|
$data = []; |
|
|
|
|
$array = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]; |
|
|
|
|
if (!$list->isEmpty()) { |
|
|
|
|
foreach ($list as $value) { |
|
|
|
|
if ($value['goods']['origin_goods_id'] && $value['store_id'] > 0) { |
|
|
|
|
$value['images'] = $goods_images[$value['goods']['origin_goods_id']] ?? []; |
|
|
|
|
} |
|
|
|
|
$data[$value['ctime']]['name'] = date('m-d', strtotime($value['ctime'])); |
|
|
|
|
$data[$value['ctime']]['week'] = $array[date("w", strtotime($value['ctime']))]; |
|
|
|
|
$data[$value['ctime']]['list'][] = $value; |
|
|
|
@ -436,7 +446,6 @@ class Goods extends GoodsModel |
|
|
|
|
} |
|
|
|
|
// 获取商品记录 |
|
|
|
|
$goodsInfo = $this->getGoodsMain($goodsId, $with, $verifyStatus); |
|
|
|
|
|
|
|
|
|
//$this->dealGoodsImage($goodsInfo); |
|
|
|
|
|
|
|
|
|
// 商品规格列表 |
|
|
|
@ -581,6 +590,16 @@ class Goods extends GoodsModel |
|
|
|
|
$value->goods_sku_no = $goodsInfo['goods_no_other']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//使用总后台的商品的图片作为商城商品的图片 |
|
|
|
|
|
|
|
|
|
if ($goodsInfo->origin_goods_id && $goodsInfo->store_id > 0) { |
|
|
|
|
|
|
|
|
|
$goods_images = $this->storeUsePlatformGoodsImage([$goodsInfo->origin_goods_id]); |
|
|
|
|
$goodsInfo->images = $goods_images[$goodsInfo->origin_goods_id] ?? []; |
|
|
|
|
// echo "<pre>"; |
|
|
|
|
// print_r($goodsInfo->images); |
|
|
|
|
// exit(); |
|
|
|
|
} |
|
|
|
|
//是否展示看同款按钮 |
|
|
|
|
$goodsInfo->is_show_ktk = 1; |
|
|
|
|
if (in_array($goodsInfo['channel'], ['sn','sn1']) && !$goodsInfo['link_other']) { |
|
|
|
|