添加网站文件
This commit is contained in:
119
application/admin/logic/CollectionLogic.php
Normal file
119
application/admin/logic/CollectionLogic.php
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\logic;
|
||||
use app\admin\server\LoginServer;
|
||||
use think\Db;
|
||||
|
||||
class CollectionLogic
|
||||
{
|
||||
/**
|
||||
* 管理员列表
|
||||
* @param $get
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @throws \think\exception\DbException
|
||||
*/
|
||||
public static function lists($get)
|
||||
{
|
||||
|
||||
$admin_count = Db::name('collection')
|
||||
->count();
|
||||
$admin_lists = Db::name('collection')
|
||||
->page($get['page'], $get['limit'])
|
||||
->select();
|
||||
foreach( $admin_lists as &$itme){
|
||||
$itme['create_time']= date('Y-m-d H:i:s',$itme['create_time']);
|
||||
}
|
||||
return ['count' => $admin_count, 'lists' => $admin_lists];
|
||||
}
|
||||
/**
|
||||
* 编辑管理员
|
||||
* @param $post
|
||||
* @return mixed
|
||||
*/
|
||||
public static function edit($post)
|
||||
{
|
||||
$post['create_time']=time();
|
||||
return Db::name('collection')->where(['id' => $post['id']])->update($post);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示派单配置列表
|
||||
* @param $post
|
||||
* @return mixed
|
||||
*/
|
||||
public static function stafflists($get){
|
||||
$where = [];
|
||||
|
||||
//根据员工编号查询
|
||||
if(isset($get['type']) && $get['type'] != ''){
|
||||
$where[] = ['onwork','=',$get['type']];
|
||||
}
|
||||
|
||||
if(isset($get['id']) && $get['id'] != ''){
|
||||
$where[] = ['id','=',$get['id']];
|
||||
}
|
||||
//根据姓名查询
|
||||
if(isset($get['name']) && $get['name'] != ''){
|
||||
$where[] = ['name', 'like', '%' . $get['name'] . '%'];
|
||||
}
|
||||
//手机号码查询
|
||||
if(isset($get['mobile']) && $get['mobile'] != ''){
|
||||
$where[] = ['mobile', 'like', '%' . $get['mobile'] . '%'];
|
||||
}
|
||||
//地区查询
|
||||
if(isset($get['area_id']) && $get['area_id'] != ''){
|
||||
$where[] = ['area','=',$get['area_id']];
|
||||
}
|
||||
//是否结婚查询
|
||||
if(isset($get['marry']) && $get['marry'] != ''){
|
||||
$where[] = ['marry','=',$get['marry']];
|
||||
}
|
||||
//是否过敏
|
||||
if(isset($get['allergy']) && $get['allergy'] != ''){
|
||||
$where[] = ['allergy','=',$get['allergy']];
|
||||
}
|
||||
//员工性别
|
||||
if(isset($get['sex']) && $get['sex'] != ''){
|
||||
$where[] = ['sex','=',$get['sex']];
|
||||
}
|
||||
|
||||
//分组查询
|
||||
if(isset($get['group_id']) && $get['group_id']){
|
||||
$where[] = ['group_id','=',$get['group_id']];
|
||||
}
|
||||
//注册时间
|
||||
if(isset($get['start_time']) && $get['start_time']!=''){
|
||||
$where[] = ['createtime','>=',strtotime($get['start_time'])];
|
||||
}
|
||||
if(isset($get['end_time']) && $get['end_time']!=''){
|
||||
$where[] = ['createtime','<=',strtotime($get['end_time'])];
|
||||
}
|
||||
$user_count = Db::name('staff')
|
||||
->where($where)
|
||||
->where('onwork',1)
|
||||
->count();
|
||||
$user_list = Db::name('staff')
|
||||
->where($where)
|
||||
->where('onwork',1)
|
||||
->field('password,pay_password,salt',true)
|
||||
->page($get['page'],$get['limit'])
|
||||
->order('id desc')
|
||||
->select();
|
||||
//员工分组
|
||||
$user_group = Db::name('staff_group')->column('name','id');
|
||||
foreach ($user_list as &$item){
|
||||
if(isset($user_group[$item['group_id']])){
|
||||
$item['group_name'] = $user_group[$item['group_id']];
|
||||
}
|
||||
$item['updatetime']=date("Y-m-d H:i:s",$item['updatetime']);
|
||||
|
||||
}
|
||||
return ['count'=>$user_count , 'lists'=>$user_list];
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user