OrderGoods.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types=1);
  12. namespace app\api\model;
  13. use app\common\model\OrderGoods as OrderGoodsModel;
  14. /**
  15. * 订单商品模型
  16. * Class OrderGoods
  17. * @package app\api\model
  18. */
  19. class OrderGoods extends OrderGoodsModel
  20. {
  21. /**
  22. * 隐藏字段
  23. * @var array
  24. */
  25. protected $hidden = [
  26. 'image',
  27. 'content',
  28. 'store_id',
  29. 'create_time',
  30. ];
  31. /**
  32. * 获取未评价的商品
  33. * @param int $orderId 订单ID
  34. * @return \think\Collection
  35. * @throws \think\db\exception\DataNotFoundException
  36. * @throws \think\db\exception\DbException
  37. * @throws \think\db\exception\ModelNotFoundException
  38. */
  39. public static function getNotCommentGoodsList(int $orderId): \think\Collection
  40. {
  41. return (new static)->with(['image'])
  42. ->where('order_id', '=', $orderId)
  43. ->where('is_comment', '=', 0)
  44. ->select();
  45. }
  46. }