2020-11-17 14:30:54 +08:00
|
|
|
<?php
|
|
|
|
|
/*
|
|
|
|
|
* @Descripttion:
|
|
|
|
|
* @version:
|
|
|
|
|
* @Author: kangkang
|
|
|
|
|
* @Date: 2020-10-16 14:44:02
|
2020-11-20 16:02:54 +08:00
|
|
|
* @LastEditors: Please set LastEditors
|
2020-11-22 11:09:33 +08:00
|
|
|
* @LastEditTime: 2020-11-20 16:51:47
|
2020-11-17 14:30:54 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
namespace app\manager\model;
|
|
|
|
|
|
|
|
|
|
use fastphp\base\Model;
|
|
|
|
|
|
|
|
|
|
class User extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'user';
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @description: 获取所有客户经理客户数量
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function getAllManagerUserCount()
|
|
|
|
|
{
|
|
|
|
|
return $this->field('ManagerId,ManagerName,count(1) as count_num')->group(['ManagerId'])->fetchAll();
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
/**
|
|
|
|
|
* @description: 获取所有客户经理客户
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function getAllManagerUser($where = [])
|
|
|
|
|
{
|
|
|
|
|
return $this->field('Id,CreateTime')->where($where)->fetchAll();
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-17 14:30:54 +08:00
|
|
|
/**
|
|
|
|
|
* @description: 查询符合筛选条件的所有用户数量
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function getScreenUserCount($where)
|
|
|
|
|
{
|
|
|
|
|
return $this->field('ManagerId,ManagerName,count(1) as count_num')->where($where)->group(['ManagerId'])->fetchAll();
|
|
|
|
|
}
|
|
|
|
|
|
2020-11-20 16:02:54 +08:00
|
|
|
/**
|
|
|
|
|
* @description: 为客户经理分配用户
|
|
|
|
|
* @param {*}
|
|
|
|
|
* @return {*}
|
|
|
|
|
*/
|
|
|
|
|
public function setManager($where, $data, $limit)
|
|
|
|
|
{
|
2020-11-17 14:30:54 +08:00
|
|
|
return $this->where($where)->limit($limit)->update($data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|