ApproveInfo.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | ThinkAdmin
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://demo.thinkadmin.top
  8. // +----------------------------------------------------------------------
  9. // | 开源协议 ( https://mit-license.org )
  10. // +----------------------------------------------------------------------
  11. // | gitee 代码仓库:https://gitee.com/zoujingli/ThinkAdmin
  12. // | github 代码仓库:https://github.com/zoujingli/ThinkAdmin
  13. // +----------------------------------------------------------------------
  14. namespace app\approve\controller;
  15. use app\common\constant\CommonConstant;
  16. use app\common\constant\OfferConstant;
  17. use app\common\service\CommonService;
  18. use app\common\service\UserService;
  19. use app\common\model\ApproveInfo as model;
  20. use library\Controller;
  21. /**
  22. * 审批申请
  23. */
  24. class ApproveInfo extends Controller
  25. {
  26. /**
  27. * 绑定数据表
  28. * @var string
  29. */
  30. protected $table = 'ApproveInfo';
  31. /**
  32. * 控制器初始化
  33. */
  34. protected function initialize()
  35. {
  36. $this->get_module_list = CommonConstant::get_module_list();
  37. $this->get_approve_status_list = CommonConstant::get_approve_status_list();
  38. $this->get_degree_list = OfferConstant::get_degree_list();
  39. }
  40. /**
  41. * 列表
  42. * @auth true
  43. * @menu true
  44. * @throws \think\Exception
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. * @throws \think\exception\DbException
  48. */
  49. public function index()
  50. {
  51. $this->module = input('module');
  52. $this->title = $this->get_module_list[$this->module].'列表';
  53. $this->get_type_list = CommonService::get_type_list($this->module);
  54. $this->limit = input('limit');
  55. // 分页每页显示记录数
  56. $limit = intval($this->request->get('limit', cookie('page-limit')));
  57. cookie('page-limit', $limit = $limit >= 10 ? $limit : 20);
  58. if ($this->limit > 0) $limit = $this->limit;
  59. $data = model::field('is_deleted',true)
  60. ->where('module',$this->module)
  61. ->where('is_deleted',CommonConstant::IS_DELETED_0)
  62. ->with([
  63. 'approveInfoUser' => function ($query) {
  64. $query->field('userid,name,mobile');
  65. },
  66. ])
  67. ->order('id desc')
  68. ->paginate($limit)
  69. ->toArray();
  70. $list = $data['data'];
  71. $result = ['page' => ['limit' => intval($limit), 'total' => intval($data['total']), 'pages' => intval($data['last_page']), 'current' => intval($data['current_page'])], 'list' => $list];
  72. return $this->fetch('', $result);
  73. }
  74. }