- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明 Made-with: Cursor
67 lines
1.4 KiB
PHP
67 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ScottPan Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
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);
|
|
}
|
|
}
|
|
}
|