|
@@ -5,6 +5,7 @@ namespace app\api\controller; |
|
@@ -5,6 +5,7 @@ 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\Ronda;
|
8
|
|
9
|
|
9
|
/**
|
10
|
/**
|
10
|
* 活动接口
|
11
|
* 活动接口
|
|
@@ -121,15 +122,14 @@ class Activity extends Api |
|
@@ -121,15 +122,14 @@ class Activity extends Api |
121
|
if (empty($cid)) {
|
122
|
if (empty($cid)) {
|
122
|
$this->error('参数错误', ['status' => 2]);
|
123
|
$this->error('参数错误', ['status' => 2]);
|
123
|
}
|
124
|
}
|
124
|
- $data = db('ronda r')
|
|
|
125
|
- ->join('campus c','c.id = r.campus_id')
|
|
|
126
|
- ->field('r.id as rid,c.title as campus_title,r.title as ronda_title,r.holdtime as ronda_holdtime')
|
|
|
127
|
- ->where('r.campus_id',$cid)
|
|
|
128
|
- ->paginate(10,false)
|
|
|
129
|
- ->each(function ($item,$key){
|
|
|
130
|
- $item['holdtime'] = date('Y-m-d',$item['ronda_holdtime']);
|
|
|
131
|
- return $item;
|
|
|
132
|
- });
|
125
|
+ $data = db('ronda')
|
|
|
126
|
+ ->where('campus_id',$cid)
|
|
|
127
|
+ ->select();
|
|
|
128
|
+ foreach ($data as $k => $v){
|
|
|
129
|
+ $data[$k]['holdtime'] = date('Y-m-d',$v['holdtime']);
|
|
|
130
|
+ $data[$k]['images'] = cdnurl($v['images'],true);
|
|
|
131
|
+ $data[$k]['details'] = strip_tags($v['details']);
|
|
|
132
|
+ }
|
133
|
$this->success('获取场次列表成功', $data);
|
133
|
$this->success('获取场次列表成功', $data);
|
134
|
}
|
134
|
}
|
135
|
|
135
|
|
|
@@ -156,8 +156,12 @@ class Activity extends Api |
|
@@ -156,8 +156,12 @@ class Activity extends Api |
156
|
if (empty($rid)) {
|
156
|
if (empty($rid)) {
|
157
|
$this->error('参数错误', ['status' => 2]);
|
157
|
$this->error('参数错误', ['status' => 2]);
|
158
|
}
|
158
|
}
|
159
|
- $model = new Item();
|
|
|
160
|
- $data = collection($model->whereIn('ronda_ids',$rid)->select())->toArray();
|
159
|
+ $model = new Ronda();
|
|
|
160
|
+ $list = $model->where('id',$rid)->value('item_ids');
|
|
|
161
|
+ $item = explode(',',$list);
|
|
|
162
|
+ foreach ($item as $k){
|
|
|
163
|
+ $data[] = db('item')->where('id',$k)->find();
|
|
|
164
|
+ }
|
161
|
$this->success('获取项目列表成功', $data);
|
165
|
$this->success('获取项目列表成功', $data);
|
162
|
}
|
166
|
}
|
163
|
|
167
|
|
|
@@ -216,8 +220,6 @@ class Activity extends Api |
|
@@ -216,8 +220,6 @@ class Activity extends Api |
216
|
$where['id'] = $id;
|
220
|
$where['id'] = $id;
|
217
|
$model = new Item();
|
221
|
$model = new Item();
|
218
|
$data = $model->where($where)->find();
|
222
|
$data = $model->where($where)->find();
|
219
|
-
|
|
|
220
|
- //$data['holdtime'] = date('Y-m-d',$data['holdtime']);
|
|
|
221
|
$data['details'] = strip_tags($data['details']);
|
223
|
$data['details'] = strip_tags($data['details']);
|
222
|
$this->success('获取项目详情成功', $data);
|
224
|
$this->success('获取项目详情成功', $data);
|
223
|
}
|
225
|
}
|