作者 开飞机的舒克

后台系统校区名称更名为界次名称

<?php
namespace app\admin\controller;
use app\common\controller\Backend;
/**
* 项目详情表
*
* @icon fa fa-circle-o
*/
class ItemDetails extends Backend
{
/**
* ItemDetails模型对象
* @var \app\admin\model\ItemDetails
*/
protected $model = null;
public function _initialize()
{
parent::_initialize();
$this->model = new \app\admin\model\ItemDetails;
$this->view->assign("isSiftList", $this->model->getIsSiftList());
}
/**
* 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
* 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
* 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
*/
/**
* 查看
*/
public function index()
{
//当前是否为关联查询
$this->relationSearch = true;
//设置过滤方法
$this->request->filter(['strip_tags', 'trim']);
if ($this->request->isAjax()) {
//如果发送的来源是Selectpage,则转发到Selectpage
if ($this->request->request('keyField')) {
return $this->selectpage();
}
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
$list = $this->model
->with(['team','item'])
->where($where)
->order($sort, $order)
->paginate($limit);
foreach ($list as $row) {
$row->getRelation('team')->visible(['title']);
$row->getRelation('item')->visible(['title']);
}
$result = array("total" => $list->total(), "rows" => $list->items());
return json($result);
}
return $this->view->fetch();
}
}
<?php
return [
'Title' => '校区名称',
'Title' => '届次',
'School_id' => '学校名称',
'Activity_id' => '活动名称',
'Date' => '举办日期',
... ...
<?php
return [
'Campus_id' => '所属校区',
'Campus_id' => '届次',
'Ronda_id' => '所属场次',
'Title' => '项目名称',
'Radar_id' => '所属维度',
... ... @@ -14,5 +14,5 @@ return [
'User.teach_phone' => '老师手机号',
'Ronda.title' => '场次名称',
'Radar.title' => '维度名称',
'Campus.title' => '校区名称'
'Campus.title' => '届次'
];
... ...
<?php
return [
'Item_id' => '所属项目',
'Images' => '项目图片',
'Is_sift' => '是否为精选',
'Is_sift 0' => '否',
'Is_sift 1' => '是',
'Team_id' => '所属战队',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Team.title' => '战队昵称',
'Item.title' => '名称'
];
<?php
return [
'Campus_id' => '所属校区',
'Campus_id' => '界次',
'Title' => '场次名称',
'Holdtime' => '举办日期',
'Images' => '场次图片',
'Details' => '场次详情',
'Createtime' => '创建时间',
'Updatetime' => '更新时间',
'Campus.title' => '校区名称'
'Campus.title' => '界次名称'
];
... ...
... ... @@ -2,7 +2,7 @@
return [
'Title' => '活动标题',
'Campus_id' => '校区名称',
'Campus_id' => '界次',
'Images' => '背景图',
'Starttime' => '开始时间',
'Endtime' => '结束时间',
... ...
... ... @@ -52,7 +52,7 @@ class Activity extends Api
}
/**
* @ApiTitle (项目校区)
* @ApiTitle (届次)
* @ApiMethod (POST)
* @ApiParams (name="id", type="interge", required=true, description="活动id")
* @ApiReturnParams (name="code", type="integer", required=true, description="状态码")
... ... @@ -74,15 +74,15 @@ class Activity extends Api
->where('c.activity_id',$param['id'])
->select();
if (empty($data)) {
$this->error('当前还没有校区', ['status' => 2]);
$this->error('当前还没有届次', ['status' => 2]);
}
$this->success('项目校区', $data);
$this->success('届次', $data);
}
/**
* @ApiTitle (场次筛选)
* @ApiMethod (POST)
* @ApiParams (name="cid", type="string", required=false, description="校区id")
* @ApiParams (name="cid", type="string", required=false, description="届次id")
* @ApiReturnParams (name="code", type="integer", required=true, description="状态码")
* @ApiReturnParams (name="msg", type="string", required=true, description="提示语")
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
... ... @@ -90,7 +90,7 @@ class Activity extends Api
"code":"状态码",
"msg": "提示消息",
"data": {
"campus_title": "校区名称",
"campus_title": "届次名称",
"ronda_title": "场次",
"ronda_holdtime": "场次时间",
}
... ... @@ -125,7 +125,7 @@ class Activity extends Api
"code":"状态码",
"msg": "提示消息",
"data": {
"campus_title": "校区名称",
"campus_title": "届次名称",
"ronda_title": "场次",
"ronda_holdtime": "场次时间",
}
... ... @@ -189,7 +189,7 @@ class Activity extends Api
"code":"状态码",
"msg": "提示消息",
"data": {
"campus_title": "校区名称",
"campus_title": "届次名称",
"ronda_title": "场次名称",
"images": "项目图片",
"details": "项目详情"
... ... @@ -197,24 +197,18 @@ class Activity extends Api
*/
public function getItemDetails()
{
$user = $this->auth->getUserinfo();
$rid = $this->request->param('rid');
$id = $this->request->param('id');
$data = db('item i')
->join('ronda r','i.ronda_id = r.id')
->join('campus c','c.id = r.campus_id')
->field('c.title as campus_title,r.title as ronda_title,r.holdtime,i.details')
->field('c.title as campus_title,r.title as ronda_title,r.holdtime,i.details,i.images')
->where([
'i.ronda_id'=>$rid,
'i.id'=> $id,
])
->find();
$model = new ItemDetails();
$res = db('study')->where('user_id',$user['id'])->find();
if (!empty($res)) {
$list = $model->where(['item_id' => $id, 'team' => $res['team']])->find()->toArray();
$data['images'] = $list['images'];
}
$data['holdtime'] = date('Y-m-d',$data['holdtime']);
$data['details'] = strip_tags($data['details']);
$this->success('获取项目详情成功', $data);
... ...