60 lines
1.6 KiB
PHP
60 lines
1.6 KiB
PHP
<?php
|
||
|
||
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\admin\model\store\paramter;
|
||
|
||
use think\Model;
|
||
|
||
class Parameter extends Model
|
||
{
|
||
protected $connection = 'shop';
|
||
protected $pk = 'parameter_id';
|
||
|
||
|
||
// public static function tablePk(): string
|
||
// {
|
||
// return 'parameter_id';
|
||
// }
|
||
|
||
// public static function tableName(): string
|
||
// {
|
||
// return 'parameter';
|
||
// }
|
||
|
||
public function searchTemplateIdAttr($query, $value)
|
||
{
|
||
$query->where('template_id',$value);
|
||
}
|
||
|
||
/**
|
||
* TODO 搜索
|
||
* @param $where
|
||
*/
|
||
public function getSearch(array $where)
|
||
{
|
||
foreach ($where as $key => $item) {
|
||
if ($item !== '') {
|
||
$keyArray[] = $key;
|
||
$whereArr[$key] = $item;
|
||
}
|
||
}
|
||
// var_dump($where);
|
||
$class = get_called_class();
|
||
if(empty($keyArray)){
|
||
return $class::self();
|
||
}else{
|
||
return $class::withSearch($keyArray, $whereArr);
|
||
}
|
||
}
|
||
|
||
}
|