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.
crmeb_php/app/common/dao/system/admin/PartnerDao.php

68 lines
1.9 KiB

12 months ago
<?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;
12 months ago
use app\common\model\user\UserPartner;
12 months ago
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;
}
12 months ago
public function existsUser(int $id)
12 months ago
{
12 months ago
return UserPartner::getInstance()->where('partner_id', $id)
->field(['id'])
12 months ago
->find();
}
12 months ago
12 months ago
}