// +---------------------------------------------------------------------- namespace app\talent\controller; use app\admin\model\UserModel; use app\talent\model\TalentAppointmentLogModel; use app\talent\model\TalentAppointmentModel; use app\talent\model\TalentModel; use cmf\controller\AdminBaseController; class AdminAppointmentController extends AdminBaseController { public function index() { $param = $this->request->param(); //搜索条件 $where = []; if (!empty($param['name'])) { $where[] = ['cmf_talent_appointment.name', 'like', "%{$param['name']}%"]; } if (!empty($param['mobile'])) { $where[] = ['cmf_talent_appointment.mobile', '=', $param['mobile']]; } if (!empty($param['shift'])) { $where[] = ['shift', 'like', "%{$param['shift']}%"]; } $list = TalentAppointmentModel::alias('ta') ->join('cmf_talent t', 'ta.talent_id = t.id') ->field(['ta.*','t.name','t.mobile']) ->where($where) ->append(['status_text']) ->paginate(10, false, ['query' => $param]); $this->assign('name', isset($param['name']) ? $param['name'] : ''); $this->assign('mobile', isset($param['mobile']) ? $param['mobile'] : ''); $this->assign('shift', isset($param['shift']) ? $param['shift'] : ''); $this->assign('list', $list->items()); $this->assign('page', $list->render()); return $this->fetch(); } public function edit() { $id = $this->request->param('id', 0, 'intval'); $info = TalentModel::get($id); $this->assign('info', $info); return $this->fetch(); } public function editPost() { if ($this->request->isPost()) { $data = $this->request->post(); TalentModel::update($data, ['id' => $data['id']]); $this->success('编辑成功!', url('index')); } } public function log() { $param = $this->request->param(); $list = TalentAppointmentLogModel::order('create_time desc')->paginate(10, false, ['query' => $param]); $this->assign('list', $list->items()); $this->assign('page', $list->render()); return $this->fetch(); } }