new_naweigete/app/model/product/sku/StoreProductAttrResult.php
2025-03-12 10:47:34 +08:00

76 lines
1.8 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\model\product\sku;
use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;
use think\Model;
/**
* Class StoreProductAttrResult
* @package app\common\model\product
*/
class StoreProductAttrResult extends BaseModel
{
use ModelTrait;
/**
* 模型名称
* @var string
*/
protected $name = 'store_product_attr_result';
protected $insert = ['change_time'];
/**
* 自动增加改变时间
* @param $value
* @return int
*/
protected static function setChangeTimeAttr($value)
{
return time();
}
/**
* 数据json化
* @param $value
* @return false|string
*/
protected static function setResultAttr($value)
{
return is_array($value) ? json_encode($value) : $value;
}
/**
* 商品搜索器
* @param Model $query
* @param $value
* @param $data
*/
public function searchProductIdAttr($query, $value)
{
$query->where('product_id', $value);
}
/**
* 商品类型搜索器
* @param Model $query
* @param $value
* @param $data
*/
public function searchTypeAttr($query, $value)
{
$query->where('type', $value);
}
}