12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?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: 老猫 <thinkcmf@126.com>
- // +----------------------------------------------------------------------
- namespace app\matchmaker\controller;
- use app\common\Constant;
- use app\common\Fun;
- use app\matchmaker\model\MatchmakerUserModel;
- class IndexController extends MatchmakerBaseController
- {
- public function index()
- {
- $status = $this->request->get('status', 0);
- return $this->fetch('', ['status' => $status]);
- }
- public function listUser()
- {
- $param = $this->request->post();
- $where = [
- ['matchmaker_id', '=', $this->matchmaker['id']],
- ];
- if (!empty($param['status'])) {
- $where[] = ['status', '=', $param['status']];
- }
- if (!empty($param['keyword'])) {
- $where[] = ['realname|mobile|id', 'like', "%{$param['keyword']}%"];
- }
- $list = MatchmakerUserModel::where($where)
- ->order('id desc')
- ->append(['status_text'])
- ->limit(6)
- ->page($param['page'])
- ->select();
- foreach ($list as $v) {
- $v['age'] = Fun::getAgeByBirth($v['birthday']);
- $v['sex_text'] = Constant::SEX[$v['sex']];
- }
- $this->result($list, 1);
- }
- }
|