Blame view

addons/exam/controller/RoomSignup.php 1.24 KB
2db47680   hexiaodong   chore: 初始提交 php 遗...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
  <?php

  

  namespace addons\exam\controller;

  

  use addons\exam\model\RoomSignupModel;

  

  

  /**

   * 考场接口

   */

  class RoomSignup extends Base

  {

      protected $noNeedLogin = [''];

      protected $noNeedRight = ['*'];

      protected $user;

  

      /**

       * 我的报名记录

       */

      public function index()

      {

          $query = RoomSignupModel::with(

              [

                  'room' => function ($query) {

                      $query->with(

                          [

                              // 'cates' => function ($query) {

                              //     $query->withField('id, name');

                              // },

                              'paper' => function ($query) {

                                  $query->withField('id, title');

                              },

                          ]

                      );//->field('id,name,contents,cate_id,paper_id,');

                  }

              ]

          )->where('user_id', $this->auth->id);

  

          // 状态查询

          $status = input('status', '');

          if (is_numeric($status)) {

              $query->where('status', $status);

          }

  

          $list = $query->order('id desc')->paginate();

          $this->success('', ['list' => $list]);

      }

  }