88 lines
2.2 KiB
PHP
88 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use app\BaseController;
|
|
use app\common\service\TicketService;
|
|
use app\admin\service\CompanyOperatorsService;
|
|
|
|
class CompanyAndOperators extends BaseController
|
|
{
|
|
/**
|
|
* 获取所有运营人员名称
|
|
*/
|
|
public function getAllOperators(TicketService $ticketService)
|
|
{
|
|
$result = $ticketService->getAllOperators();
|
|
return $this->success('查询成功', $result);
|
|
}
|
|
|
|
|
|
|
|
public function TestgetAllOperators(TicketService $ticketService)
|
|
{
|
|
|
|
$result = $ticketService->TestgetAllOperators();
|
|
|
|
return $this->success('查询成功', $result);
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
* 获取我方员工列表
|
|
*/
|
|
public function getStaffList(TicketService $ticketService)
|
|
{
|
|
$result = $ticketService->getStaffList();
|
|
return $this->success('查询成功', $result);
|
|
}
|
|
|
|
|
|
/* 删除运营 */
|
|
public function deleteOperator(CompanyOperatorsService $CompanyOperatorService, $id)
|
|
{
|
|
|
|
$result = $CompanyOperatorService->deleteOperator($id);
|
|
|
|
return $this->success('删除成功', $result);
|
|
}
|
|
|
|
/* 删除客户单位 */
|
|
public function deleteCompany(CompanyOperatorsService $CompanyOperatorService, $id)
|
|
{
|
|
$result = $CompanyOperatorService->deleteCompany($id);
|
|
if (!$result) {
|
|
return $this->error('删除失败');
|
|
}
|
|
return $this->success('删除成功');
|
|
}
|
|
|
|
|
|
/* 新增公司(客户)单位 */
|
|
public function addCompany(CompanyOperatorsService $CompanyOperatorService)
|
|
{
|
|
$data = $this->request->post();
|
|
try {
|
|
$result = $CompanyOperatorService->addCompany($data);
|
|
return $this->success('创建成功', $result);
|
|
} catch (\Exception $e) {
|
|
return $this->error($e->getMessage());
|
|
}
|
|
}
|
|
|
|
/* 新增运营人员 */
|
|
public function addOperator(CompanyOperatorsService $CompanyOperatorService)
|
|
{
|
|
$data = $this->request->post();
|
|
try {
|
|
$result = $CompanyOperatorService->addOperator($data);
|
|
return $this->success('创建成功', $result);
|
|
} catch (\Exception $e) {
|
|
return $this->error($e->getMessage());
|
|
}
|
|
}
|
|
|
|
}
|