parent
5aadf7b0c9
commit
77080f71b0
@ -0,0 +1,39 @@ |
||||
<?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\BaseModel; |
||||
use app\common\model\user\UserSpreadLog; |
||||
|
||||
class UserAssetsDao extends BaseDao |
||||
{ |
||||
|
||||
protected function getModel(): string |
||||
{ |
||||
return UserSpreadLog::class; |
||||
} |
||||
|
||||
public function add($uid, $spread_uid, $old_spread_uid, $admin_id = 0) |
||||
{ |
||||
$this->create(compact('uid', 'spread_uid', 'admin_id', 'old_spread_uid')); |
||||
} |
||||
|
||||
public function search($where) |
||||
{ |
||||
return UserSpreadLog::getDB()->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) { |
||||
$query->where('uid', $where['uid']); |
||||
})->order('create_time DESC'); |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?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\BaseModel; |
||||
use app\common\model\user\UserSpreadLog; |
||||
|
||||
class UserAssetsLogDao extends BaseDao |
||||
{ |
||||
|
||||
protected function getModel(): string |
||||
{ |
||||
return UserSpreadLog::class; |
||||
} |
||||
|
||||
public function add($uid, $spread_uid, $old_spread_uid, $admin_id = 0) |
||||
{ |
||||
$this->create(compact('uid', 'spread_uid', 'admin_id', 'old_spread_uid')); |
||||
} |
||||
|
||||
public function search($where) |
||||
{ |
||||
return UserSpreadLog::getDB()->when(isset($where['uid']) && $where['uid'] !== '', function ($query) use ($where) { |
||||
$query->where('uid', $where['uid']); |
||||
})->order('create_time DESC'); |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
<?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\model\user; |
||||
|
||||
|
||||
use app\common\model\BaseModel; |
||||
|
||||
class UserAssets extends BaseModel |
||||
{ |
||||
|
||||
public static function tablePk(): ?string |
||||
{ |
||||
return 'uid'; |
||||
} |
||||
|
||||
public static function tableName(): string |
||||
{ |
||||
return 'user_assets'; |
||||
} |
||||
|
||||
public function user() |
||||
{ |
||||
return $this->hasOne(User::class, 'uid', 'uid'); |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
<?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\model\user; |
||||
|
||||
|
||||
use app\common\model\BaseModel; |
||||
|
||||
class UserAssetsLog extends BaseModel |
||||
{ |
||||
|
||||
public static function tablePk(): ?string |
||||
{ |
||||
return 'id'; |
||||
} |
||||
|
||||
public static function tableName(): string |
||||
{ |
||||
return 'user_assets_log'; |
||||
} |
||||
|
||||
public function user() |
||||
{ |
||||
return $this->hasOne(User::class, 'uid', 'uid'); |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?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\dao\user\UserSpreadLogDao; |
||||
use app\common\repositories\BaseRepository; |
||||
|
||||
/** |
||||
* @mixin UserSpreadLogDao |
||||
*/ |
||||
class UserAssetsLogRepository extends BaseRepository |
||||
{ |
||||
public function __construct(UserSpreadLogDao $dao) |
||||
{ |
||||
$this->dao = $dao; |
||||
} |
||||
|
||||
public function getList(array $where, $page, $limit) |
||||
{ |
||||
$query = $this->dao->search($where); |
||||
$count = $query->count(); |
||||
$list = $query->page($page, $limit)->with(['spread' => function ($query) { |
||||
$query->field('uid,nickname,avatar'); |
||||
}])->select(); |
||||
|
||||
return compact('count', 'list'); |
||||
} |
||||
} |
@ -0,0 +1,39 @@ |
||||
<?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\dao\user\UserSpreadLogDao; |
||||
use app\common\repositories\BaseRepository; |
||||
|
||||
/** |
||||
* @mixin UserSpreadLogDao |
||||
*/ |
||||
class UserAssetsRepository extends BaseRepository |
||||
{ |
||||
public function __construct(UserSpreadLogDao $dao) |
||||
{ |
||||
$this->dao = $dao; |
||||
} |
||||
|
||||
public function getList(array $where, $page, $limit) |
||||
{ |
||||
$query = $this->dao->search($where); |
||||
$count = $query->count(); |
||||
$list = $query->page($page, $limit)->with(['spread' => function ($query) { |
||||
$query->field('uid,nickname,avatar'); |
||||
}])->select(); |
||||
|
||||
return compact('count', 'list'); |
||||
} |
||||
} |
Loading…
Reference in new issue