123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <?php
- namespace app\talent\controller;
- use app\common\model\TalentWorkModel;
- use app\talent\TalentBaseController;
- class Work extends TalentBaseController
- {
- /**
- * 新增
- */
- public function add()
- {
- return view('', [
- 'contact_list' => 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();
- }
- }
|