OrderGoods.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 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\api\service\User as UserService;
  14. use app\common\exception\BaseException;
  15. use app\common\model\OrderGoods as OrderGoodsModel;
  16. /**
  17. * 订单商品模型
  18. * Class OrderGoods
  19. * @package app\api\model
  20. */
  21. class OrderGoods extends OrderGoodsModel
  22. {
  23. /**
  24. * 隐藏字段
  25. * @var array
  26. */
  27. protected $hidden = [
  28. 'content',
  29. 'store_id',
  30. 'create_time',
  31. ];
  32. /**
  33. * 获取未评价的商品
  34. * @param int $orderId 订单ID
  35. * @return \think\Collection
  36. * @throws \think\db\exception\DataNotFoundException
  37. * @throws \think\db\exception\DbException
  38. * @throws \think\db\exception\ModelNotFoundException
  39. */
  40. public static function getNotCommentGoodsList(int $orderId)
  41. {
  42. return (new static)->with(['image'])
  43. ->where('order_id', '=', $orderId)
  44. ->where('is_comment', '=', 0)
  45. ->select();
  46. }
  47. }