Files
huangjingfen/pro_v3.5.1/app/model/user/label/UserLabelRelation.php

73 lines
1.8 KiB
PHP
Raw Normal View History

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\model\user\label;
use crmeb\basic\BaseModel;
use crmeb\traits\ModelTrait;
use think\Model;
/**
* 用户关联标签
* Class UserLabelRelation
* @package app\model\user\label
*/
class UserLabelRelation extends BaseModel
{
use ModelTrait;
/**
* 模型名称
* @var string
*/
protected $name = 'user_label_relation';
/**
* @return \think\model\relation\HasOne
*/
public function label()
{
return $this->hasOne(UserLabel::class, 'id', 'label_id')->bind([
'label_name' => 'label_name',
'label_type' => 'label_type',
]);
}
/**
* uid搜索器
* @param Model $query
* @param $value
*/
public function searchUidAttr($query, $value)
{
if($value !== ''){
if(is_array($value)){
$query->whereIn('uid', $value);
}else{
$query->where('uid', $value);
}
}
}
/**
* 门店id搜索器
* @param $query
* @param $value
*/
public function searchStoreIdAttr($query, $value)
{
if ($value !== '') {
$query->where('store_id', $value);
}
}
}