<?php

namespace app\admin\model;

use support\Db;
use support\Model;

/**
 * 角色模型
 * Class Users
 * @package app\admin\model
 */
class PackageOrderDetail extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'package_order_detail';

    public $timestamps = false;

    /**
     * Notes:获取产品列表
     * @param string $keywords
     * @param int $page
     * @param int $limit
     * @return array
     * User: QJF
     * Date: 2022/9/20
     */
    public static function getPackageOrderInfo($keywords)
    {
        $list = static::select('*')
            ->orderBy('goods_update_time','DESC')
            ->get();
        $count = static::count();
        return [$list, $count];
    }

    public function getDetailCreateTimeAttribute($value)
    {
        return date('Y-m-d H:i:s', $value);
    }

    /**
     * Notes:插入子订单数据
     * @param array $data
     * @return false|int
     * User: yym
     * Date: 2022/9/27
     */
    public static function insertData(array $data)
    {
        if(empty($data))
        {
            return false;
        }
        return static::insertGetId($data);
    }
}
