作者 开飞机的舒克

新增活动详情接口

@@ -5,7 +5,6 @@ namespace app\api\controller; @@ -5,7 +5,6 @@ namespace app\api\controller;
5 use app\common\controller\Api; 5 use app\common\controller\Api;
6 use app\common\model\Active; 6 use app\common\model\Active;
7 use app\common\model\Item; 7 use app\common\model\Item;
8 -use app\common\model\ItemDetails;  
9 8
10 /** 9 /**
11 * 活动接口 10 * 活动接口
@@ -19,7 +18,6 @@ class Activity extends Api @@ -19,7 +18,6 @@ class Activity extends Api
19 /** 18 /**
20 * @ApiTitle (活动首页) 19 * @ApiTitle (活动首页)
21 * @ApiMethod (POST) 20 * @ApiMethod (POST)
22 - * @ApiParams (name="row", type="string", required=false, description="每页显示行数[非必填]")  
23 * @ApiParams (name="page", type="string", required=false, description="当前页[非必填]") 21 * @ApiParams (name="page", type="string", required=false, description="当前页[非必填]")
24 * @ApiReturn ({"code":状态码, 22 * @ApiReturn ({"code":状态码,
25 "msg":"提示信息" 23 "msg":"提示信息"
@@ -34,13 +32,10 @@ class Activity extends Api @@ -34,13 +32,10 @@ class Activity extends Api
34 */ 32 */
35 public function index() 33 public function index()
36 { 34 {
37 - $row = $this->request->param('row');  
38 $page = $this->request->param('page'); 35 $page = $this->request->param('page');
39 - $row = $row ? $row : 10;  
40 - $page = $page ? $page : 1;  
41 $data = db('activity') 36 $data = db('activity')
42 ->order('createtime DESC') 37 ->order('createtime DESC')
43 - ->paginate($row,false,['page'=>$page]) 38 + ->paginate(10,false,['page'=>$page])
44 ->each(function ($item,$key){ 39 ->each(function ($item,$key){
45 $item['images'] = cdnurl($item['image'], true); 40 $item['images'] = cdnurl($item['image'], true);
46 $item['createtime'] = date('Y-m-d', $item['createtime']); 41 $item['createtime'] = date('Y-m-d', $item['createtime']);
@@ -18,5 +18,8 @@ class Active extends Model @@ -18,5 +18,8 @@ class Active extends Model
18 protected $append = [ 18 protected $append = [
19 ]; 19 ];
20 20
21 - 21 + public function getImageAttr($value,$data){
  22 + $value = cdnurl($data['image'],true);
  23 + return $value;
  24 + }
22 } 25 }
@@ -2438,12 +2438,6 @@ @@ -2438,12 +2438,6 @@
2438 </thead> 2438 </thead>
2439 <tbody> 2439 <tbody>
2440 <tr> 2440 <tr>
2441 - <td>row</td>  
2442 - <td>string</td>  
2443 - <td></td>  
2444 - <td>每页显示行数[非必填]</td>  
2445 - </tr>  
2446 - <tr>  
2447 <td>page</td> 2441 <td>page</td>
2448 <td>string</td> 2442 <td>string</td>
2449 <td></td> 2443 <td></td>
@@ -2472,10 +2466,6 @@ @@ -2472,10 +2466,6 @@
2472 <div class="panel-body"> 2466 <div class="panel-body">
2473 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/activity/index" method="POST" name="form0" id="form0"> 2467 <form enctype="application/x-www-form-urlencoded" role="form" action="/api/activity/index" method="POST" name="form0" id="form0">
2474 <div class="form-group"> 2468 <div class="form-group">
2475 - <label class="control-label" for="row">row</label>  
2476 - <input type="string" class="form-control input-sm" id="row" placeholder="每页显示行数[非必填]" name="row">  
2477 - </div>  
2478 - <div class="form-group">  
2479 <label class="control-label" for="page">page</label> 2469 <label class="control-label" for="page">page</label>
2480 <input type="string" class="form-control input-sm" id="page" placeholder="当前页[非必填]" name="page"> 2470 <input type="string" class="form-control input-sm" id="page" placeholder="当前页[非必填]" name="page">
2481 </div> 2471 </div>
@@ -6340,7 +6330,7 @@ @@ -6340,7 +6330,7 @@
6340 6330
6341 </div> 6331 </div>
6342 <div class="col-md-6" align="right"> 6332 <div class="col-md-6" align="right">
6343 - Generated on 2023-04-12 17:35:22 <a href="./" target="_blank">校园活动</a> 6333 + Generated on 2023-04-12 17:40:22 <a href="./" target="_blank">校园活动</a>
6344 </div> 6334 </div>
6345 </div> 6335 </div>
6346 6336