123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?php
- namespace app\admin\controller\consultant;
- use app\admin\service\consultant\ConsultantService;
- use app\admin\validate\consultant\IndexValidate;
- use app\controller\Curd;
- use app\model\Consultant;
- use support\Request;
- use support\Response;
- class IndexController extends Curd
- {
- public function __construct()
- {
- $this->model = new Consultant();
- $this->validate = true;
- $this->validateClass = new IndexValidate();
- }
- public function select(Request $request): Response
- {
- return ConsultantService::index($request);
- }
- /**
- * Notes: 添加员工
- * User: yb
- * Date: 2024/8/2
- * Time: 10:59
- * @param Request $request
- */
- public function addConsultant(Request $request)
- {
- $params = $request->post();
- if (empty($params['name'])) {
- return json_fail('请输入员工姓名');
- }
- if (empty($params['mobile'])) {
- return json_fail('请输入员工手机号');
- }
- if (empty($params['dept_id'])) {
- return json_fail('请选择所属团队');
- }
- return ConsultantService::add($params);
- }
- /**
- * Notes: 更新员工信息
- * User: yb
- * Date: 2024/8/2
- * Time: 13:31
- * @param Request $request
- * @return Response
- */
- public function updateConsultant(Request $request)
- {
- $params = $request->post();
- if (empty($params['name'])) {
- return json_fail('请输入员工姓名');
- }
- if (empty($params['mobile'])) {
- return json_fail('请输入员工手机号');
- }
- return ConsultantService::update($params);
- }
- /**
- * Notes: 删除员工
- * User: yb
- * Date: 2024/8/2
- * Time: 13:34
- * @param Request $request
- * @return Response
- */
- public function deleteConsultant(Request $request)
- {
- $params = $request->post();
- if (empty($params['ids'])) {
- return json_fail('请选择要删除的数据');
- }
- return ConsultantService::delete($params['ids']);
- }
- /**
- * Notes: 绑定后台用户
- * User: yb
- * Date: 2024/8/5
- * Time: 10:51
- */
- public function getUserList()
- {
- return ConsultantService::userList();
- }
- }
|