You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.9 KiB
67 lines
1.9 KiB
<?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\common\dao\system\admin;
|
|
|
|
|
|
use app\common\dao\BaseDao;
|
|
use app\common\model\BaseModel;
|
|
use app\common\model\system\admin\Partner;
|
|
use app\common\model\user\UserPartner;
|
|
use app\common\model\system\admin\Admin;
|
|
use think\db\BaseQuery;
|
|
use think\db\exception\DataNotFoundException;
|
|
use think\db\exception\DbException;
|
|
use think\db\exception\ModelNotFoundException;
|
|
use think\Model;
|
|
|
|
class PartnerDao extends BaseDao
|
|
{
|
|
|
|
/**
|
|
* @return BaseModel
|
|
* @author xaboy
|
|
* @day 2020-03-30
|
|
*/
|
|
protected function getModel(): string
|
|
{
|
|
return Partner::class;
|
|
}
|
|
|
|
/**
|
|
* @param array $where
|
|
* @return BaseQuery
|
|
* @author xaboy
|
|
* @day 2020-04-09
|
|
*/
|
|
public function search(array $where = [])
|
|
{
|
|
$query = Partner::getDB();
|
|
if (isset($where['keyword']) && $where['keyword'] !== '') {
|
|
$query = $query->whereLike('name', '%' . $where['keyword'] . '%');
|
|
}
|
|
if (isset($where['status']) && $where['status'] !== '') {
|
|
$query = $query->where('status', intval($where['status']));
|
|
}
|
|
return $query;
|
|
}
|
|
|
|
public function existsUser(int $id)
|
|
{
|
|
return UserPartner::getInstance()->where('partner_id', $id)
|
|
->field(['id'])
|
|
->find();
|
|
}
|
|
|
|
}
|
|
|
|
|