微信标签管理

This commit is contained in:
JaguarJack
2020-06-21 18:04:30 +08:00
parent 4392f25e97
commit fbf9c11191
10 changed files with 400 additions and 11 deletions

View File

@@ -0,0 +1,38 @@
<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\wechat\model;
use catchAdmin\wechat\model\search\TagSearchTrait;
use catcher\base\CatchModel as Model;
class WechatTags extends Model
{
use TagSearchTrait;
protected $name = 'wechat_tags';
protected $field = [
'id', //
'tag_id', // 微信 tagId
'name', // 标签名称
'fans_amount', // 粉丝数量
'created_at', // 创建时间
'updated_at', // 更新时间
'deleted_at', // 软删除
];
public function hasManyUsers()
{
return $this->belongsToMany(WechatUsers::class, 'wechat_user_has_tags', 'user_id', 'tag_id');
}
}

View File

@@ -46,4 +46,9 @@ class WechatUsers extends CatchModel
const BlOCK = 2; // 拉黑
const UNBLOCK = 1; // 取消拉黑
public function hasManyTags()
{
return $this->belongsToMany(WechatTags::class, 'wechat_user_has_tags', 'tag_id', 'user_id');
}
}

View File

@@ -0,0 +1,27 @@
<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\wechat\model\search;
trait TagSearchTrait
{
/**
* 昵称搜索
* @time 2020年06月21日
* @param $query
* @param $value
* @param $data
* @return mixed
*/
public function searchNameAttr($query, $value, $data)
{
return $query->whereLike('name', $value);
}
}