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.
51 lines
2.3 KiB
51 lines
2.3 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\user;
|
|
|
|
use app\common\dao\BaseDao;
|
|
use app\common\model\user\UserExtract;
|
|
use app\common\model\user\UserExtract as model;
|
|
|
|
class UserExtractDao extends BaseDao
|
|
{
|
|
protected function getModel(): string
|
|
{
|
|
return model::class;
|
|
}
|
|
|
|
public function search(array $where)
|
|
{
|
|
|
|
$query = model::alias('UserExtract');
|
|
$query->when(isset($where['uid']) && $where['uid'] != '',function($query)use($where){
|
|
$query->where('uid',$where['uid']);
|
|
})->when(isset($where['extract_type']) && $where['extract_type'] != '',function($query)use($where){
|
|
$query->where('extract_type',$where['extract_type']);
|
|
})->when(isset($where['status']) && $where['status'] != '',function($query)use($where){
|
|
$query->where('UserExtract.status',$where['status']);
|
|
})->when(isset($where['real_name']) && $where['real_name'] != '',function($query)use($where){
|
|
$query->where('UserExtract.real_name','%'.$where['real_name'].'%');
|
|
})->when(isset($where['date']) && $where['date'] != '',function($query)use($where){
|
|
getModelTime($query, $where['date']);
|
|
})->when(isset($where['brokerage_level']) && $where['brokerage_level'], function ($query) use ($where) {
|
|
$query->join('User user', 'UserExtract.uid = user.uid', 'left')->where('user.brokerage_level', intval($where['brokerage_level']));
|
|
})->order('UserExtract.create_time DESC');
|
|
|
|
return $query;
|
|
}
|
|
|
|
public function getPromoterInfo(array $uids)
|
|
{
|
|
return UserExtract::getDB()->field('sum(extract_price) as total_price,count(extract_id) as total_num, uid')->whereIn('uid', $uids)->group('uid')->where('status', 1)->select()->toArray();
|
|
}
|
|
}
|
|
|