|
@@ -331,6 +331,12 @@ class GoodsService extends BaseService
|
|
|
*/
|
|
*/
|
|
|
public function getOrderGoods($userId, $ids)
|
|
public function getOrderGoods($userId, $ids)
|
|
|
{
|
|
{
|
|
|
|
|
+ $cacheKey = "caches:goods:order_{$userId}_".md5(json_encode($ids,256));
|
|
|
|
|
+ $datas = RedisService::get($cacheKey);
|
|
|
|
|
+ if($datas){
|
|
|
|
|
+ return $datas;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
$goods = $this->model->from('goods as a')
|
|
$goods = $this->model->from('goods as a')
|
|
|
->whereIn('a.goods_id',$ids)
|
|
->whereIn('a.goods_id',$ids)
|
|
|
->where(['a.status' => 1, 'a.mark' => 1])
|
|
->where(['a.status' => 1, 'a.mark' => 1])
|
|
@@ -338,6 +344,9 @@ class GoodsService extends BaseService
|
|
|
->select(['a.goods_id','a.merch_id','a.goods_name','a.cate_id','a.supply_type','a.main_img','a.retail_price'])
|
|
->select(['a.goods_id','a.merch_id','a.goods_name','a.cate_id','a.supply_type','a.main_img','a.retail_price'])
|
|
|
->get();
|
|
->get();
|
|
|
$goods = $goods? $goods->toArray() : [];
|
|
$goods = $goods? $goods->toArray() : [];
|
|
|
|
|
+ if($goods){
|
|
|
|
|
+ RedisService::set($cacheKey, $goods, rand(3,5));
|
|
|
|
|
+ }
|
|
|
return $goods;
|
|
return $goods;
|
|
|
}
|
|
}
|
|
|
|
|
|