新增公司任务排期接口
This commit is contained in:
parent
aeb98c2585
commit
76860ba871
70
app/middleapi/controller/DictDataController.php
Normal file
70
app/middleapi/controller/DictDataController.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\middleapi\controller;
|
||||||
|
|
||||||
|
use app\common\model\dict\DictData;
|
||||||
|
use app\common\controller\BaseLikeAdminController;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字典数据
|
||||||
|
* Class DictDataController
|
||||||
|
* @package app\adminapi\controller\dictionary
|
||||||
|
*/
|
||||||
|
class DictDataController extends BaseLikeAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取字典数据列表
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author 段誉
|
||||||
|
* @date 2022/6/20 16:35
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
if(!$this->request->isPost()){
|
||||||
|
return $this->fail('请求方式错误');
|
||||||
|
}
|
||||||
|
$params=$this->request->post(['page_no','page_size','name','type_id','type_value']);
|
||||||
|
$where = [];
|
||||||
|
if(!empty($params['name'])){
|
||||||
|
$where[] = ['name','like','%' . $params['name'] . '%'];
|
||||||
|
}
|
||||||
|
if(!empty($params['type_id'])){
|
||||||
|
$where[] = ['type_id', '=', $params['type_id']];
|
||||||
|
}
|
||||||
|
if(!empty($params['type_value'])){
|
||||||
|
$where[] = ['type_value', '=', $params['type_value']];
|
||||||
|
}
|
||||||
|
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||||
|
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||||
|
$data = DictData::where($where)
|
||||||
|
->append(['status_desc'])
|
||||||
|
->page($pageNo, $pageSize)
|
||||||
|
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
$count = DictData::where($where)->count();
|
||||||
|
$result = [
|
||||||
|
'lists' => $data,
|
||||||
|
'count' => $count,
|
||||||
|
'page_no' => $pageNo,
|
||||||
|
'page_size' => $pageSize
|
||||||
|
];
|
||||||
|
return $this->success('请求成功',$result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取字典详情
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author 段誉
|
||||||
|
* @date 2022/6/20 17:14
|
||||||
|
*/
|
||||||
|
public function detail()
|
||||||
|
{
|
||||||
|
$params = (new DictDataValidate())->goCheck('id');
|
||||||
|
$result = DictDataLogic::detail($params);
|
||||||
|
return $this->data($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
132
app/middleapi/controller/TaskSchedulingController.php
Normal file
132
app/middleapi/controller/TaskSchedulingController.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\middleapi\controller;
|
||||||
|
|
||||||
|
use app\common\model\task_scheduling\TaskScheduling;
|
||||||
|
use app\common\model\Company;
|
||||||
|
use app\common\controller\BaseLikeAdminController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务公司排期控制器
|
||||||
|
* Class TaskSchedulingController
|
||||||
|
* @package app\adminapi\controller\task_scheduling
|
||||||
|
*/
|
||||||
|
class TaskSchedulingController extends BaseLikeAdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取任务公司排期列表
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/08/08 10:08
|
||||||
|
*/
|
||||||
|
public function lists()
|
||||||
|
{
|
||||||
|
if(!$this->request->isPost()){
|
||||||
|
return $this->fail('请求方式错误');
|
||||||
|
}
|
||||||
|
$params=$this->request->post(['page_no','page_size','company_id']);
|
||||||
|
$where = [];
|
||||||
|
if (isset($params['company_id']) && $params['company_id'] != '') {
|
||||||
|
$arr = Company::where('company_name', 'like', '%' . $params['company_id'] . '%')->column('id');
|
||||||
|
if ($arr) {
|
||||||
|
$where[] = ['company_id', 'in', $arr];
|
||||||
|
} else {
|
||||||
|
$where[] = ['company_id', 'in', [0]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||||
|
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||||
|
$data = TaskScheduling::where($where)
|
||||||
|
->with(['admin', 'company', 'company_type'])
|
||||||
|
->page($pageNo, $pageSize)
|
||||||
|
->order(['id' => 'desc'])
|
||||||
|
->select()
|
||||||
|
->toArray();
|
||||||
|
$count = TaskScheduling::where($where)->count();
|
||||||
|
$result = [
|
||||||
|
'lists' => $data,
|
||||||
|
'count' => $count,
|
||||||
|
'page_no' => $pageNo,
|
||||||
|
'page_size' => $pageSize
|
||||||
|
];
|
||||||
|
return $this->success('请求成功',$result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 添加任务公司排期
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/08/08 10:08
|
||||||
|
*/
|
||||||
|
public function add()
|
||||||
|
{
|
||||||
|
return $this->fail('暂未开放');
|
||||||
|
$params = (new TaskSchedulingValidate())->post()->goCheck('add');
|
||||||
|
$params['create_user_id']=$this->adminId;
|
||||||
|
$result = TaskSchedulingLogic::add($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('添加成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(TaskSchedulingLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 编辑任务公司排期
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/08/08 10:08
|
||||||
|
*/
|
||||||
|
public function edit()
|
||||||
|
{
|
||||||
|
$params = (new TaskSchedulingValidate())->post()->goCheck('edit');
|
||||||
|
$result = TaskSchedulingLogic::edit($params);
|
||||||
|
if (true === $result) {
|
||||||
|
return $this->success('编辑成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail(TaskSchedulingLogic::getError());
|
||||||
|
}
|
||||||
|
//编辑金额
|
||||||
|
public function editMoney()
|
||||||
|
{
|
||||||
|
$params = $this->request->param();
|
||||||
|
$moeny=$params['money'];
|
||||||
|
$result = TaskScheduling::where(['id'=>$params['id']])->update(['money'=>$moeny]);
|
||||||
|
if ( $result) {
|
||||||
|
return $this->success('编辑成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
return $this->fail('编辑失败');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 删除任务公司排期
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/08/08 10:08
|
||||||
|
*/
|
||||||
|
public function delete()
|
||||||
|
{
|
||||||
|
$params = (new TaskSchedulingValidate())->post()->goCheck('delete');
|
||||||
|
TaskSchedulingLogic::delete($params);
|
||||||
|
return $this->success('删除成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 获取任务公司排期详情
|
||||||
|
* @return \think\response\Json
|
||||||
|
* @author likeadmin
|
||||||
|
* @date 2023/08/08 10:08
|
||||||
|
*/
|
||||||
|
public function detail()
|
||||||
|
{
|
||||||
|
$params = (new TaskSchedulingValidate())->goCheck('detail');
|
||||||
|
$result = TaskSchedulingLogic::detail($params);
|
||||||
|
return $this->data($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user