1
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\admin\app\controller;
|
||||
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
use Symfony\Component\Console\Input\Input;
|
||||
use support\think\Db;
|
||||
|
||||
/**
|
||||
* 问卷管理
|
||||
*
|
||||
* @icon fa fa-circle-o
|
||||
*/
|
||||
class QuestionnaireController extends Crud
|
||||
{
|
||||
|
||||
/**
|
||||
* Product模型对象
|
||||
* @var \app\model\Questionnaire
|
||||
*/
|
||||
protected $model = null;
|
||||
protected $noNeedAuth = [];
|
||||
protected $relationSearch = ['category'];
|
||||
|
||||
function __construct()
|
||||
{
|
||||
$this->model = new \app\model\Questionnaire;
|
||||
$statusList = $this->model->getStatusList();
|
||||
$this->assign("statusList", $statusList);
|
||||
$this->assignconfig("statusList", $statusList);
|
||||
|
||||
$categoryList = $this->model->getCategoryOptions();
|
||||
$this->assign("categoryList", $categoryList);
|
||||
$this->assignconfig("categoryList", $categoryList);
|
||||
}
|
||||
/**
|
||||
* selectpage
|
||||
* @param \support\Request $request
|
||||
*/
|
||||
function selectpage(Request $request)
|
||||
{
|
||||
$searchValue = $request->input('searchValue');
|
||||
$searchTable = $request->input('searchTable');
|
||||
$searchKey = $request->input('searchKey');
|
||||
$orderBy = $request->input('orderBy');
|
||||
$showField = $request->input('showField');
|
||||
$keyField = $request->input('keyField');
|
||||
$keyValue = $request->input('keyValue');
|
||||
$searchField = $request->input('searchField');
|
||||
[$where, $format, $limit, $field, $order] = $this->selectInput($request);
|
||||
$query = $this->doSelect($where, $field, $order);
|
||||
$ids = \app\model\Product::distinct(true)->column('questionnaire_id');
|
||||
if($keyValue && $keyField){
|
||||
$query = $query->whereIn($keyField,$keyValue);
|
||||
$ids =array_diff([$keyValue?:0],$ids);
|
||||
}
|
||||
if($showField && input($showField)){
|
||||
$query = $query->whereLike($showField,'%'.input($showField).'%');
|
||||
}
|
||||
//log_alert($ids,'cansnow');
|
||||
$query = $query->whereNotIn('id',$ids);
|
||||
$list = $query->field([$showField,$keyField])->paginate($limit);
|
||||
//log_alert($query->getLastSql(),'cansnow');
|
||||
|
||||
return $this->success('ok',$list);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user