<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台（PHP版）
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码，建议反馈是我们前进的动力
// | 开源版本可自由商用，可去除界面版权logo
// | gitee下载：https://gitee.com/likeshop_gitee/likeadmin
// | github下载：https://github.com/likeshop-github/likeadmin
// | 访问官网：https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------

namespace app\workerapi\logic\shops;


use app\common\model\shops\ShopGoods;
use app\common\logic\BaseLogic;
use app\common\model\shops\ShopGoodSpecsInventory;
use think\db\Query;
use think\facade\Db;


/**
 * ShopGoods逻辑
 * Class ShopGoodsLogic
 * @package app\adminapi\logic\shops
 */
class ShopGoodsLogic extends BaseLogic
{


    /**
     * @notes 获取详情
     * @param $params
     * @return array
     * @author likeadmin
     * @date 2024/08/04 11:07
     */
    public static function detail($params): array
    {
        return ShopGoods::with(['goodSpecsInventory'=>function(Query $query){
            $query->field(['id','shop_goods_id','remaining_inventory','specs','service_fee','service_total']);
            }])->hidden(['create_time','update_time'])->findOrEmpty($params['id'])->toArray();
    }
}