GoodsNoticeData.php 504 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: yunzhong
  5. * Date: 2020/6/9
  6. * Time: 17:37
  7. */
  8. namespace app\common\services\notice\share;
  9. use app\common\models\Notice;
  10. Trait GoodsNoticeData
  11. {
  12. public $goodsBuy ;
  13. public function getGoodsBuy($goodsIds)
  14. {
  15. $goods = Notice::select()->whereIn('goods_id', $goodsIds)->with(['hasOneMini'=>function($query){
  16. $query->select('member_id','openid');
  17. }])->get();
  18. $this->goodsBuy = empty($goods) ? [] : $goods->toArray();
  19. }
  20. }