ShopGoodsLogic.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\workerapi\logic\shops;
  15. use app\common\model\shops\ShopGoods;
  16. use app\common\logic\BaseLogic;
  17. use app\common\model\shops\ShopGoodSpecsInventory;
  18. use think\db\Query;
  19. use think\facade\Db;
  20. /**
  21. * ShopGoods逻辑
  22. * Class ShopGoodsLogic
  23. * @package app\adminapi\logic\shops
  24. */
  25. class ShopGoodsLogic extends BaseLogic
  26. {
  27. /**
  28. * @notes 获取详情
  29. * @param $params
  30. * @return array
  31. * @author likeadmin
  32. * @date 2024/08/04 11:07
  33. */
  34. public static function detail($params): array
  35. {
  36. return ShopGoods::with(['goodSpecsInventory'=>function(Query $query){
  37. $query->field(['id','shop_goods_id','remaining_inventory','specs','service_fee','service_total']);
  38. }])->hidden(['create_time','update_time'])->findOrEmpty($params['id'])->toArray();
  39. }
  40. }