| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262 |
- <?php
- // +----------------------------------------------------------------------
- // | likeadmin快速开发前后端分离管理后台(PHP版)
- // +----------------------------------------------------------------------
- // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
- // | 开源版本可自由商用,可去除界面版权logo
- // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
- // | github下载:https://github.com/likeshop-github/likeadmin
- // | 访问官网:https://www.likeadmin.cn
- // | likeadmin团队 版权所有 拥有最终解释权
- // +----------------------------------------------------------------------
- // | author: likeadminTeam
- // +----------------------------------------------------------------------
- namespace app\adminapi\controller\agricultural_machinery;
- use app\adminapi\controller\BaseAdminController;
- use app\adminapi\lists\agricultural_machinery\AgriculturalMachineryCategoryLists;
- use app\adminapi\lists\agricultural_machinery\UserServiceLists;
- use app\adminapi\logic\agricultural_machinery\AgriculturalMachineryServiceCategoryLogic;
- use app\adminapi\validate\agricultural_machinery\AgriculturalMachineryServiceCategoryValidate;
- use app\adminapi\validate\agricultural_machinery\UserServiceValidate;
- use app\adminapi\logic\agricultural_machinery\UserServiceLogic;
- use app\adminapi\lists\agricultural_machinery\MechanicalCateLists;
- use app\api\logic\ServiceLogic;
- use app\api\validate\ServiceValidate;
- /**
- * 社会服务管理控制器
- * Class ArticleCateController
- * @package app\adminapi\controller\article
- */
- class UserServiceController extends BaseAdminController
- {
- public array $notNeedLogin = ['getUserServiceData'];
- /**
- * @notes 获取服务列表
- * @return \think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author 段誉
- * @date 2022/10/13 10:54
- */
- public function getUserServiceList()
- {
- $params = (new UserServiceValidate())->get()->goCheck('userService');
- return $this->dataLists(new UserServiceLists());
- }
- /**
- * @notes 添加服务商信息
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 17:31
- */
- public function addUserService()
- {
- if($this->request->isPost()) {
- $params = (new UserServiceValidate())->post()->goCheck('add');
- // $userId = $this->userId;
- // $params['user_id'] = $userId;
- switch ($params['type']){
- case 1 :
- $type_name = '农机手';
- break;
- case 2 :
- $type_name = '烘干服务';
- break ;
- case 3 :
- $type_name = '飞防服务';
- break;
- default :
- $type_name = '';
- break;
- }
- $result = UserServiceLogic::add($params,$type_name);
- if (1 === $result['code']) {
- return $this->success($type_name.'入驻信息添加成功', $result['data'], 1, 1);
- }else{
- return $this->fail(UserServiceLogic::getError());
- }
- }else{
- return $this->fail('请求方式错误');
- }
- //
- //
- // $params = (new UserServiceValidate())->post()->goCheck('add');
- // UserServiceLogic::add($params);
- // return $this->success('添加成功', [], 1, 1);
- }
- /**
- * @notes 删除服务商
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 17:52
- */
- public function delete()
- {
- $params = (new UserServiceValidate())->post()->goCheck('delete');
- UserServiceLogic::delete($params);
- return $this->success('删除成功', [], 1, 1);
- }
- /**
- * @notes 服务详情
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 17:54
- */
- public function detail()
- {
- $params = (new UserServiceValidate())->goCheck('detail');
- $result = UserServiceLogic::detail($params);
- return $this->data($result);
- }
- /**
- * @notes 更改服务商状态
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 10:15
- */
- public function updateStatus()
- {
- $params = (new UserServiceValidate())->post()->goCheck('status');
- $result = UserServiceLogic::updateStatus($params);
- if (true === $result) {
- return $this->success('修改成功', [], 1, 1);
- }
- return $this->fail(UserServiceLogic::getError());
- }
- /**
- * @notes 服务商审核
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 10:15
- */
- public function auditUserService()
- {
- $params = (new UserServiceValidate())->post()->goCheck('audit');
- $params['user_id'] = $this->adminId;
- $result = UserServiceLogic::auditUserService($params);
- if (true === $result) {
- return $this->success('操作成功', [], 1, 1);
- }
- return $this->fail(UserServiceLogic::getError());
- }
- /**
- * @notes 获取会员列表
- * @return \think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author 段誉
- * @date 2022/10/13 10:54
- */
- public function getUserList()
- {
- $result = UserServiceLogic::getValidUserData();
- return $this->data($result);
- }
- /**
- * @notes 获取W服务信息
- * @return \think\response\Json
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- * @author 段誉
- * @date 2022/10/13 10:54
- */
- public function getServiceContent()
- {
- $result = UserServiceLogic::getServiceContent();
- return $this->data($result);
- }
- public function editServiceContent()
- {
- $params = (new UserServiceValidate())->post()->goCheck('editContent');
- $result = UserServiceLogic::saveServiceContent($params);
- if (true === $result) {
- return $this->success('保存成功', [], 1, 1);
- }
- return $this->fail(UserServiceLogic::getError());
- }
- public function getUserServiceData(){
- $result = UserServiceLogic::getServiceList();
- return $this->success('查询成功', $result, 1, 1);
- }
- public function getServiceDisclaimer()
- {
- $result = UserServiceLogic::getServiceDisclaimer();
- return $this->data($result);
- }
- public function editServiceDisclaimer()
- {
- $params = (new UserServiceValidate())->post()->goCheck('disclaimer');
- $result = UserServiceLogic::saveServiceDisclaimer($params);
- if (true === $result) {
- return $this->success('保存成功', [], 1, 1);
- }
- return $this->fail(UserServiceLogic::getError());
- }
- public function getMechanicalCateList()
- {
- return $this->dataLists(new MechanicalCateLists());
- }
- /**
- * @notes 添加机械分类
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 17:31
- */
- public function addMechanicalCate()
- {
- $params = (new UserServiceValidate())->post()->goCheck('addMechanicalCate');
- UserServiceLogic::addMechanicalCate($params);
- return $this->success('添加成功', [], 1, 1);
- }
- /**
- * @notes 机械分类详情
- * @return \think\response\Json
- * @author heshihu
- * @date 2022/2/21 17:54
- */
- public function mechanicalCateDetail()
- {
- $params = (new UserServiceValidate())->goCheck('cateDetail');
- $result = UserServiceLogic::cate_detail($params);
- return $this->data($result);
- }
- public function editMechanicalCate()
- {
- $params = (new UserServiceValidate())->post()->goCheck('editCate');
- $result = UserServiceLogic::editCate($params);
- if (true === $result) {
- return $this->success('编辑成功', [], 1, 1);
- }
- return $this->fail(UserServiceLogic::getError());
- }
- }
|