Merge branch 'main' of http://git.njrzwl.cn:3000/wangmingchuan/crmeb_php
commit
56c582d8c7
@ -0,0 +1,43 @@ |
||||
<?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\user; |
||||
|
||||
|
||||
use app\common\dao\BaseDao; |
||||
use app\common\model\user\UserPartner as model; |
||||
|
||||
class UserPartnerDao extends BaseDao |
||||
{ |
||||
|
||||
|
||||
/** |
||||
* @return string |
||||
* @author Qinii |
||||
*/ |
||||
protected function getModel(): string |
||||
{ |
||||
return model::class; |
||||
} |
||||
|
||||
|
||||
public function userFieldExists($field, $value, $uid): bool |
||||
{ |
||||
return (($this->getModel()::getDB())->where('uid', $uid)->where($field, $value)->count()) > 0; |
||||
} |
||||
|
||||
public function getAll(int $uid) |
||||
{ |
||||
return (($this->getModel()::getDB())->where('uid', $uid)); |
||||
} |
||||
} |
@ -0,0 +1,67 @@ |
||||
<?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\repositories\user; |
||||
|
||||
use app\common\repositories\BaseRepository; |
||||
use app\common\dao\user\UserPartnerDao as dao; |
||||
|
||||
/** |
||||
* Class UserAddressRepository |
||||
* @package app\common\repositories\user |
||||
* @day 2020/6/3 |
||||
* @mixin dao |
||||
*/ |
||||
class UserPartnerRepository extends BaseRepository |
||||
{ |
||||
/** |
||||
* @var dao |
||||
*/ |
||||
protected $dao; |
||||
|
||||
|
||||
/** |
||||
* UserAddressRepository constructor. |
||||
* @param dao $dao |
||||
*/ |
||||
public function __construct(dao $dao) |
||||
{ |
||||
$this->dao = $dao; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param int $id |
||||
* @param int $uid |
||||
* @return bool |
||||
* @author Qinii |
||||
*/ |
||||
public function fieldExists(int $id, int $uid) |
||||
{ |
||||
return $this->dao->userFieldExists($this->dao->getPk(), $id, $uid); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @param $uid |
||||
* @param $page |
||||
* @param $limit |
||||
* @return array |
||||
* @author Qinii |
||||
*/ |
||||
public function getList($uid) |
||||
{ |
||||
$list = $this->dao->getAll($uid)->order('id desc')->select(); |
||||
return compact('list'); |
||||
} |
||||
} |
Loading…
Reference in new issue