json_encode(TalentWorkModel::CONTACT), 'cate_list' => json_encode(TalentWorkModel::CATE), ]); } public function addPost() { $month = date('Y-m'); $work_check = TalentWorkModel::where('month', $month)->where('user_id', $this->user->id)->find(); if (!empty($work_check)) { ajax_return(1, '该月已填写,请勿重复填写!'); } $post = input('post.'); $post['user_id'] = $this->user->id; $post['month'] = $month; TalentWorkModel::create($post); ajax_return(); } /** * 编辑 */ public function edit() { $id = input('id', 0); if (empty($id)) { jump('该信息不存在'); } $info = TalentWorkModel::where('user_id', $this->user->id)->where('id', $id)->find(); if (empty($info)) { jump('该信息不存在'); } return view('', [ 'info' => $info, 'contact_list' => json_encode(TalentWorkModel::CONTACT), 'cate_list' => json_encode(TalentWorkModel::CATE), ]); } public function editPost() { $post = input('post.'); unset($post['create_time'], $post['update_time']); TalentWorkModel::update($post); ajax_return(); } /** * 复制 */ public function copy() { $id = input('id', 0); if (empty($id)) { jump('该信息不存在'); } $info = TalentWorkModel::where('user_id', $this->user->id)->where('id', $id)->find(); if (empty($info)) { jump('该信息不存在'); } $month = date('Y-m'); $work_check = TalentWorkModel::where('month', $month)->where('user_id', $this->user->id)->find(); if (!empty($work_check)) { jump('该月已填写,请勿重复填写!'); } return view('', [ 'info' => $info, 'contact_list' => json_encode(TalentWorkModel::CONTACT), 'cate_list' => json_encode(TalentWorkModel::CATE), ]); } public function copyPost() { $month = date('Y-m'); $work_check = TalentWorkModel::where('month', $month)->where('user_id', $this->user->id)->find(); if (!empty($work_check)) { ajax_return(1, '该月已填写,请勿重复填写!'); } $post = input('post.'); unset($post['id'], $post['create_time'], $post['update_time']); $post['month'] = $month; TalentWorkModel::create($post); ajax_return(); } }