| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <?php
- namespace App\Web\Controllers;
- use App\Http\Controllers\BaseController;
- use App\Web\Services\BlogService;
- use App\Web\Services\DictService;
- use Illuminate\Http\Request;
- class DictController extends BaseController
- {
- protected $service = null;
- /**
- * 构造函数
- * BlogController constructor.
- * @param BlogService $service
- */
- public function __construct(DictService $service)
- {
- $this->service = $service;
- }
- /**
- * 获取功能列表
- * */
- public function getDictFunctionList(Request $request){
- $params=$request->only(['page_size','page','status','keyword']);
- $ret=$this->service->getDictFunctionList($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- /**
- * 功能保存
- * */
- public function saveDictFunction(Request $request){
- $this->validate($request, [
- 'name' => 'required',
- ], [
- 'name.required' => '功能名称不能为空',
- ]);
- $params=$request->only(['id','name','remark','status']);
- $ret=$this->service->saveDictFunction($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- /**
- * 变更功能状态
- * */
- public function changeDictFunctionStatus(Request $request){
- $this->validate($request, [
- 'id' => 'required',
- ], [
- 'id.required' => 'id不能为空',
- ]);
- $params=$request->only(['id','status']);
- $ret=$this->service->saveDictFunction($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- /**
- * 获取行业列表
- * */
- public function getDictIndustryList(Request $request){
- $params=$request->only(['page_size','page','status','keyword']);
- $ret=$this->service->getDictIndustryList($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- /**
- * 行业保存
- * */
- public function saveDictIndustry(Request $request){
- $this->validate($request, [
- 'name' => 'required',
- ], [
- 'name.required' => '行业名称不能为空',
- ]);
- $params=$request->only(['id','name','pid','status','remark']);
- $ret=$this->service->saveDictIndustry($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- /**
- * 变更行业状态
- * */
- public function changeDictIndustryStatus(Request $request){
- $this->validate($request, [
- 'id' => 'required',
- ], [
- 'id.required' => 'id不能为空',
- ]);
- $params=$request->only(['id','status']);
- $ret=$this->service->saveDictIndustry($params);
- return $this->jsonResponse(
- 'ok',
- $ret
- );
- }
- }
|