<?php

namespace App\Models\goods\mysql;

use Api\PhpUtils\Mysql\MysqlBase;

/**
 * Class GoodsSku
 * 商品sku信息
 * @package App\Models\goods\mysql
 */
class GoodsSku extends MysqlBase
{
    const TABLE_NAME = 'goods_sku';
    const CONFIG_INDEX = 'goods';

    const STATUS_AUDIT = 0;//待审核
    const STATUS_PASS = 1;//审核通过
    const STATUS_REJECT = 2;//审核驳回

    const ONLINE_STATUS_NO_ONLINE = 0;//未上架
    const ONLINE_STATUS_ONLINE = 1;//已上架
    const ONLINE_STATUS_OFFLINE = 2;//已下架

    public static function getRecord($where, $colums = [])
    {
        if (empty($colums)) {
            $colums = '*';
        }
        return self::get($colums, $where);
    }

    public static function getRecordMaster($where, $colums = [])
    {
        if (empty($colums)) {
            $colums = '*';
        }
        return self::selectMaster($colums, $where);
    }

    public static function save($data, $where = [])
    {
        if (empty($where)) {
            return self::insert($data);
        }
        return self::update($data, $where);
    }

    public static function deleteRecord($where)
    {
        return self::delete($where);
    }

    public static function getCount($where)
    {
        return self::count($where);
    }
}