123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- // +----------------------------------------------------------------------
- // | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
- // +----------------------------------------------------------------------
- // | Author: Powerless < wzxaini9@gmail.com>
- // +----------------------------------------------------------------------
- namespace app\matchmaker\controller;
- use app\common\Constant;
- use app\matchmaker\model\MatchmakerUserMatingModel;
- use app\matchmaker\model\MatchmakerUserModel;
- use cmf\controller\AdminBaseController;
- use think\facade\Request;
- class AdminMatchmakerUserController extends AdminBaseController
- {
- public function index()
- {
- $data = $this->request->param();
- $where = [];
- if (!empty($data['realname'])) {
- $where[] = ['realname', 'like', "%{$data['realname']}%"];
- }
- if (!empty($data['mobile'])) {
- $where[] = ['mobile', 'like', "%{$data['mobile']}%"];
- }
- $count = MatchmakerUserModel::with('matchmaker')
- ->where($where)
- ->count();
- $this->assign('total', $count);
- $list = MatchmakerUserModel::with('matchmaker')
- ->where($where)
- ->order("id DESC")
- ->paginate(10, false, [
- 'query' => Request::param(),//不丢失已存在的url参数
- ]);
- // 获取分页显示
- $page = $list->render();
- $this->assign('list', $list);
- $this->assign('page', $page);
- // 渲染模板输出
- return $this->fetch();
- }
- /**
- * 详情
- */
- public function show()
- {
- //获取id
- $id = input('param.id');
- if (empty($id)) {
- $this->error(lang('信息不存在或已删除'));
- }
- //获取信息
- $info = MatchmakerUserModel::get($id, ['matchmaker']);
- $info['family_text'] = $info['family'] ? implode(',', $info['family']) : '未填写';
- $info['have_house'] = Constant::COND_TINYINT[$info['have_house']];
- $info['have_car'] = Constant::COND_TINYINT[$info['have_car']];
- $info['with_parent_live'] = Constant::COND_TINYINT[$info['with_parent_live']];
- if (empty($info)) {
- $this->error(lang('信息不存在或已删除'));
- }
- $this->assign('info', $info);
- $mating = MatchmakerUserMatingModel::get(['user_id' => $id]);
- $mating['have_house'] = Constant::COND_TINYINT[$mating['have_house']];
- $mating['have_car'] = Constant::COND_TINYINT[$mating['have_car']];
- $mating['with_parent_live'] = Constant::COND_TINYINT[$mating['with_parent_live']];
- $this->assign('mating', $mating);
- return $this->fetch();
- }
- }
|