This commit is contained in:
2025-03-26 11:55:10 +08:00
parent 3e7295fec4
commit 2fada5b9ac
7 changed files with 307 additions and 264 deletions

View File

@@ -0,0 +1,27 @@
<?php
/*
* description
* authorwh
* email
*/
namespace app\api\controller;
use think\Db;
use app\common\model\TabConf;
use wanghua\general_utility_tools_php\framework\base\BaseAuthController;
use think\facade\Request;
use wanghua\general_utility_tools_php\file\upload\FileUpload;
use wanghua\general_utility_tools_php\tool\Tools;
class BaseHttpApi extends BaseAuthController
{
//控制器注释
protected $controller_comments = '';
}

View File

@@ -1,42 +0,0 @@
<?php
/*
* description
* authorwh
* email
* createTime{2025/3/25} {10:00}
*/
namespace app\api\controller;
use think\Controller;
use think\Db;
use wanghua\general_utility_tools_php\Mmodel;
use wanghua\general_utility_tools_php\tool\Tools;
class Worker extends BaseApiAuthController
{
/**
* desc获取工作人员列表
*
* authorwh
*/
function getList(){
return Mmodel::catchJson(function (){
$firm_sign = input('firm_sign');//企业标识
if(empty($firm_sign)){
return Tools::set_fail('企业标识不能为空');
}
$info = Db::table('fa_admin')
->where('role','firm')
->where('firm_id',$firm_sign)
->select();
return Tools::set_ok('ok',[
'staff_list'=>array_column($info,'rel_wxid')
]);
});
}
}

View File

@@ -0,0 +1,95 @@
<?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'));
}
$model_obj->where('role','firm');
$model_obj->where('status','normal');
$data = $model_obj->select();
if(empty($data)){
return json(Tools::set_ok('ok',$data));
}
return json(Tools::set_ok('ok',['staff_list'=>implode(',',array_column($data,'rel_wxid'))]));
}catch(\Exception $e){
Tools::log_to_write_txt([
'error'=>'获取工作人员列表.异常.'.$e->getMessage(),
'参数'=>input(),
'error_info'=>$e->getTraceAsString()
]);
return json(Tools::set_res(500,'操作异常',[]));
}
}
}