Files
fast_response/admin/application/api/controller/Workers.php
Your Name dce091da91 t
2025-03-27 07:52:44 +00:00

92 lines
2.9 KiB
PHP
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use think\Db;
use app\common\model\TabConf;
use wanghua\general_utility_tools_php\file\upload\FileUpload;
use wanghua\general_utility_tools_php\tool\Tools;
use wanghua\general_utility_tools_php\Validate;
use think\Controller;
class Workers extends BaseHttpApi
{
protected $controller_comments = '管理员表';
/**
* desc获取工作人员列表(不传参数就是查所有企业的工作人员)
*
* 【请求地址】:
* api/Workers/getWorkers
*
* 【请求参数】:(如果有“必须”标识则表示该字段是必填项)
* mobile 手机号码
* rel_wxid 关联微信
* firm_id 所属企业
*
* 【所有字段说明】<span style="color: gray">(可能有部分额外字段未在此体现)</span>
* id ID
* username 用户名
* nickname 昵称
* password 密码
* salt 密码盐
* avatar 头像
* email 电子邮箱
* mobile 手机号码
* loginfailure 失败次数
* logintime 登录时间
* loginip 登录IP
* createtime 创建时间
* updatetime 更新时间
* token Session标识
* role 角色:admin=管理员,firm=企业人员
* status 状态
* rel_wxid 关联微信
* employee_type 类型:1=企业微信,2=个人微信
* firm_id 所属企业
* firmstore_id 所属店铺
* firmduty_id 职务
* authorwh
*/
function getWorkers(){
Tools::log_to_write_txt(['获取工作人员列表(不传参数就是查所有企业的工作人员) 入参:'=>input()]);
$api_desc = '获取工作人员列表(不传参数就是查所有企业的工作人员)';
try {
$mobile = input('mobile');
$rel_wxid = input('rel_wxid');
$firm_id = input('firm_id');
$model_obj = Db::table(TabConf::$fa_admin);
if(input('mobile')){
$model_obj->where('mobile',input('mobile'));
}
if(input('rel_wxid')){
$model_obj->where('rel_wxid',input('rel_wxid'));
}
if(input('firm_id')){
$model_obj->where('firm_id',input('firm_id'));
}
$data = $model_obj->select();
if(empty($data)){
return json(Tools::set_ok('ok',$data));
}
return json(Tools::set_ok('ok',$data));
}catch(\Exception $e){
Tools::log_to_write_txt([
'error'=>'获取工作人员列表(不传参数就是查所有企业的工作人员).异常.'.$e->getMessage(),
'参数'=>input(),
'error_info'=>$e->getTraceAsString()
]);
return json(Tools::set_res(500,'操作异常',[]));
}
}
}