123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <?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\matchmaker\model\MatchmakerModel;
- use app\matchmaker\model\MatchmakerUserModel;
- class MyController extends MatchmakerBaseController
- {
- public function index()
- {
- $data['matchmaker'] = $this->matchmaker;
- $data['matchmaker']['avatar'] = cmf_get_image_url($data['matchmaker']['avatar']);
- return $this->fetch('', $data);
- }
- public function info()
- {
- $data['matchmaker'] = $this->matchmaker;
- $data['matchmaker']['avatar'] = cmf_get_image_url($data['matchmaker']['avatar']);
- return $this->fetch('', $data);
- }
- public function infoPost()
- {
- $data = $this->request->post();
- MatchmakerModel::update($data);
- $this->success();
- }
- public function password()
- {
- return $this->fetch();
- }
- public function passwordPost()
- {
- $data = $this->request->post();
- if ($data['new_pass'] != $data['re_pass']) {
- $this->error('两次密码不一致!');
- }
- if ($data['old_pass'] != $this->matchmaker['password']) {
- $this->error('旧密码错误!');
- }
- MatchmakerModel::update(['password' => $data['new_pass']], ['id' => $this->matchmaker['id']]);
- $this->success();
- }
- public function statistics()
- {
- $data = [];
- $data['total'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->count();
- $data['sex_man'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('sex', 1)
- ->count();
- $data['sex_woman'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('sex', 2)
- ->count();
- $data['education_bkyx'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('education', '本科以下')
- ->count();
- $data['education_bk'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('education', '本科')
- ->count();
- $data['education_ss'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('education', '硕士')
- ->count();
- $data['education_bs'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('education', '博士')
- ->count();
- $data['marry_wh'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('marry', '未婚')
- ->count();
- $data['marry_lh'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('marry', '离婚')
- ->count();
- $data['marry_so'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('marry', '丧偶')
- ->count();
- $data['status_1'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('status', 1)
- ->count();
- $data['status_2'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('status', 2)
- ->count();
- $data['status_3'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('status', 3)
- ->count();
- $data['status_4'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('status', 4)
- ->count();
- $data['status_5'] = MatchmakerUserModel::where('matchmaker_id', $this->matchmaker->id)
- ->where('status', 5)
- ->count();
- return view('', $data);
- }
- }
|