|
@@ -8,6 +8,7 @@ use App\Models\MemberInfo;
|
|
|
use App\Models\Resume;
|
|
|
use App\Models\TalentHouse;
|
|
|
use App\Models\TalentHouseApply;
|
|
|
+use App\Models\TalentHousePeople;
|
|
|
use App\Services\Content\ArticleService;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
@@ -48,10 +49,11 @@ class BuyhouseController extends WebBaseController
|
|
|
//房源
|
|
|
$house = TalentHouse::orderBy('updated_at', 'desc')->orderByRaw(DB::raw("FIELD(status,2,1,3)"))->limit(8)->get();
|
|
|
foreach ($house as $v) {
|
|
|
- $v['declare_time_text'] = date('Y-m-d', strtotime($v['declare_time']));
|
|
|
- $v['status_text'] = $this->house_status[$v['status']];
|
|
|
- $v['status_tag'] = $this->tag_status[$v['status']];
|
|
|
- $v['url'] = route('buyhouse.list', ['id' => $v['id']]);
|
|
|
+ $v['apply_time_start'] = date('Y-m-d', strtotime($v['apply_time_start']));
|
|
|
+ $v['apply_time_end'] = date('Y-m-d', strtotime($v['apply_time_end']));
|
|
|
+ $v['status_text'] = $this->house_status[$v['status']];
|
|
|
+ $v['status_tag'] = $this->tag_status[$v['status']];
|
|
|
+ $v['url'] = route('buyhouse.list', ['id' => $v['id']]);
|
|
|
}
|
|
|
$return_data['house'] = $house;
|
|
|
|
|
@@ -68,6 +70,7 @@ class BuyhouseController extends WebBaseController
|
|
|
$apply = TalentHouseApply::with('house')
|
|
|
->select(['id', 'house_id', 'status'])
|
|
|
->where('is_draft', 2)
|
|
|
+ ->where('is_back', 2)
|
|
|
->where('user_id', $user_id)
|
|
|
->get();
|
|
|
foreach ($apply as $v) {
|
|
@@ -88,8 +91,10 @@ class BuyhouseController extends WebBaseController
|
|
|
{
|
|
|
$lists = TalentHouse::orderByRaw(DB::raw("FIELD(status,2,1,3)"))->paginate(10);
|
|
|
foreach ($lists as $v) {
|
|
|
- $v['status_text'] = $this->house_status[$v['status']];
|
|
|
- $v['status_tag'] = $this->tag_status[$v['status']];
|
|
|
+ $v['apply_time_start'] = date('Y-m-d', strtotime($v['apply_time_start']));
|
|
|
+ $v['apply_time_end'] = date('Y-m-d', strtotime($v['apply_time_end']));
|
|
|
+ $v['status_text'] = $this->house_status[$v['status']];
|
|
|
+ $v['status_tag'] = $this->tag_status[$v['status']];
|
|
|
}
|
|
|
|
|
|
$return_data = [
|
|
@@ -114,6 +119,33 @@ class BuyhouseController extends WebBaseController
|
|
|
return view('app.content.buyhouse.news', $return_data);
|
|
|
}
|
|
|
|
|
|
+ public function detail(Request $request)
|
|
|
+ {
|
|
|
+ $id = $request->get('id');
|
|
|
+ if (empty($id)) {
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage('该房源不存在或已删除', $back_url, true, '上一页', '3');
|
|
|
+ }
|
|
|
+
|
|
|
+ //房源信息
|
|
|
+ $house = TalentHouse::where('id', $id)->first();
|
|
|
+ if (empty($house)) {
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage('该房源不存在或已删除', $back_url, true, '上一页', '3');
|
|
|
+ }
|
|
|
+
|
|
|
+ $house['status_text'] = $this->house_status[$house['status']];
|
|
|
+ $house['status_tag'] = $this->tag_status[$house['status']];
|
|
|
+ $house['url'] = route('buyhouse.list', ['id' => $house['id']]);
|
|
|
+ $house['apply_time'] = date('Y-m-d', strtotime($house['apply_time_start'])) . ' - ' . date('Y-m-d', strtotime($house['apply_time_end']));
|
|
|
+
|
|
|
+ $return_data = [
|
|
|
+ 'info' => $house,
|
|
|
+ ];
|
|
|
+
|
|
|
+ return view('app.content.buyhouse.detail', $return_data);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 报名列表
|
|
|
*/
|
|
@@ -131,6 +163,13 @@ class BuyhouseController extends WebBaseController
|
|
|
return $this->showMessage('该房源不存在或已删除', $back_url, true, '上一页', '3');
|
|
|
}
|
|
|
|
|
|
+ //是否报名其他
|
|
|
+ $sock = TalentHouseApply::where('user_id', $user_id)->where('house_id', '<>', $id)->where('is_sock', 1)->where('is_draft', 2)->first();
|
|
|
+ if (!empty($sock)) {
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage('不可以同时申报多个房源', $back_url, true, '上一页', '3');
|
|
|
+ }
|
|
|
+
|
|
|
//房源信息
|
|
|
$house = TalentHouse::where('id', $id)->first();
|
|
|
if (empty($house)) {
|
|
@@ -143,8 +182,9 @@ class BuyhouseController extends WebBaseController
|
|
|
$house['apply_time'] = date('Y-m-d', strtotime($house['apply_time_start'])) . ' - ' . date('Y-m-d', strtotime($house['apply_time_end']));
|
|
|
|
|
|
//报名信息
|
|
|
- $apply = TalentHouseApply::where('house_id', $id)->where('user_id', $user_id)->first();
|
|
|
+ $apply = TalentHouseApply::where('house_id', $id)->where('is_back', 2)->where('user_id', $user_id)->first();
|
|
|
$check = [];
|
|
|
+ $time = time();
|
|
|
if ($apply) {
|
|
|
if ($house['status'] != 2 && $apply['is_draft'] == 1) {
|
|
|
$back_url = \Illuminate\Support\Facades\URL::previous();
|
|
@@ -173,7 +213,6 @@ class BuyhouseController extends WebBaseController
|
|
|
return $this->showMessage('该房源未在申报时间', $back_url, true, '上一页', '3');
|
|
|
}
|
|
|
|
|
|
- $time = time();
|
|
|
$resume = Resume::where('uid', $user_id)->where('def', 1)->first();
|
|
|
if (empty($resume)) {
|
|
|
$back_url = route('person.resume');
|
|
@@ -200,6 +239,10 @@ class BuyhouseController extends WebBaseController
|
|
|
$back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
return $this->showMessage('目前仅支持一到五层次人才申报', $back_url, true, '上一页', '3');
|
|
|
}
|
|
|
+ if ($talent['type'] > 2) {
|
|
|
+ $back_url = \Illuminate\Support\Facades\URL::previous();
|
|
|
+ return $this->showMessage('其他人才暂不支持', $back_url, true, '上一页', '3');
|
|
|
+ }
|
|
|
$add = [
|
|
|
'user_id' => $user_id,
|
|
|
'house_id' => $id,
|
|
@@ -222,6 +265,12 @@ class BuyhouseController extends WebBaseController
|
|
|
];
|
|
|
$id = TalentHouseApply::insertGetId($add);
|
|
|
$apply = TalentHouseApply::find($id);
|
|
|
+
|
|
|
+ //报名人员列表
|
|
|
+ $people = TalentHousePeople::where('user_id',$user_id)->first();
|
|
|
+ if (empty($people)) {
|
|
|
+ TalentHousePeople::create(['user_id'=>$user_id]);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
$apply['family'] = json_decode($apply['family'], true);
|
|
@@ -233,13 +282,18 @@ class BuyhouseController extends WebBaseController
|
|
|
|
|
|
//是否可填表格
|
|
|
$formDisable = 'true';
|
|
|
- if ($house['status'] == 2) {
|
|
|
- if ($apply['is_draft'] == 1) {
|
|
|
+ if ($apply['is_draft'] == 1) {
|
|
|
+ //草稿
|
|
|
+ $formDisable = 'false';
|
|
|
+ } else {
|
|
|
+ if ($time < $house['apply_time_end'] && $apply['status'] != 2) {
|
|
|
$formDisable = 'false';
|
|
|
+ } else {
|
|
|
+ if ($time < $house['supply_time'] && ($apply['rs_check_status'] == 3 || $apply['zj_check_status'] == 3)) {
|
|
|
+ $formDisable = 'false';
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- if ($apply['rs_check_status'] == 3 || $apply['zj_check_status'] == 3) {
|
|
|
- $formDisable = 'false';
|
|
|
+
|
|
|
}
|
|
|
|
|
|
$return_data = [
|
|
@@ -253,6 +307,9 @@ class BuyhouseController extends WebBaseController
|
|
|
return view('app.content.buyhouse.list', $return_data);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 申报提交
|
|
|
+ */
|
|
|
public function listPost(Request $request)
|
|
|
{
|
|
|
//数据校验
|
|
@@ -328,11 +385,46 @@ class BuyhouseController extends WebBaseController
|
|
|
if ($info->is_draft == 1) {
|
|
|
$info->is_draft = 2;
|
|
|
}
|
|
|
+ if ($info->is_sock == 2) {
|
|
|
+ $info->is_sock = 1;
|
|
|
+ }
|
|
|
$info->save();
|
|
|
|
|
|
return response()->json(['status' => 1]);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 撤消
|
|
|
+ */
|
|
|
+ public function back(Request $request)
|
|
|
+ {
|
|
|
+ $id = $request->get('id');
|
|
|
+ if (empty($id)) {
|
|
|
+ return response()->json(['status' => 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ $apply = TalentHouseApply::find($id);
|
|
|
+ if (empty($apply) || $apply['user_id'] != auth('web-member')->id() || $apply['is_back'] == 1) {
|
|
|
+ return response()->json(['status' => 1]);
|
|
|
+ }
|
|
|
+ if ($apply['status'] == 2) {
|
|
|
+ return response()->json(['status' => 0, 'msg' => '已通过审核的申报无法撤消']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $house = TalentHouse::find($apply['house_id']);
|
|
|
+ if (strtotime($house['apply_time_end']) > time()) {
|
|
|
+ return response()->json(['status' => 0, 'msg' => '报名结束的申报无法撤消']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $apply->is_back = 1;
|
|
|
+ $apply->is_sock = 2;
|
|
|
+ $apply->save();
|
|
|
+ return response()->json(['status' => 1]);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 图片上传
|
|
|
+ */
|
|
|
public function upload(Request $request)
|
|
|
{
|
|
|
header('Access-Control-Allow-Origin:*');
|
|
@@ -372,6 +464,25 @@ class BuyhouseController extends WebBaseController
|
|
|
return response()->json($res);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 清除名额锁定
|
|
|
+ */
|
|
|
+ public function clearSock()
|
|
|
+ {
|
|
|
+ $list = TalentHouse::where('is_end',2)->where('supply_time','>=',date('Y-m-d H:i:s'))->get();
|
|
|
+ if ($list->isEmpty()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach ($list as $v) {
|
|
|
+ TalentHouseApply::where('house_id',$v['id'])->where('status','<>',2)->update(['is_sock'=>2]);
|
|
|
+ $v->is_end = 1;
|
|
|
+ $v->save();
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 登录状态
|
|
|
*/
|