|
|
@@ -8,35 +8,83 @@ use App\Services\Common\SmsService;
|
|
|
use App\Models\Member;
|
|
|
use Illuminate\Http\Request;
|
|
|
use App\Services\Common\SearchService;
|
|
|
+use App\Models\C2M;
|
|
|
+use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
class ShuoboController extends WebBaseController
|
|
|
{
|
|
|
|
|
|
private $smsService;
|
|
|
protected $searchService;
|
|
|
+ protected $c2m;
|
|
|
|
|
|
public function __construct(SmsService $smsService,SearchService $searchService)
|
|
|
{
|
|
|
$this->smsService = $smsService;
|
|
|
$this->searchService = $searchService;
|
|
|
+ $this->c2m = new C2M();
|
|
|
}
|
|
|
|
|
|
public function talent()
|
|
|
{
|
|
|
- dd(MemberShuobo::search("郑明炜")->get());
|
|
|
|
|
|
return view('app.shuobo.talent');
|
|
|
}
|
|
|
|
|
|
+ public function getCompanyToShuobo(Request $request){
|
|
|
+ $user = auth('web-company')->user();
|
|
|
+ if($user){
|
|
|
+ $info = $this->c2m->where("company_id",$user->id)->where('status',0)->first();
|
|
|
+ if($info){
|
|
|
+ $data = [
|
|
|
+ 'number' => 1,
|
|
|
+ 'shuobo_id' => $info->shuobo_id,
|
|
|
+ 'info' => MemberShuobo::where('id',$info->shuobo_id)->first()
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $data = [
|
|
|
+ 'number' => 0
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ return json_encode(['status' => 1,'data' => $data,'msg' => '','login' => 1]);
|
|
|
+ }else{
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '未登录','login' => 0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public function getTalentData(Request $request)
|
|
|
{
|
|
|
-
|
|
|
$keyword = $request->input('keyword');
|
|
|
$page = $request->input('page');
|
|
|
- $list = $this->searchService->search('Shuobo', [], [], $keyword,10,$page);
|
|
|
+ $list = $this->searchService->search('Shuobo', [], ['sort'=>'desc','updated_at' => 'desc','id'=>'desc'], $keyword,10,$page);
|
|
|
$list_data =[];
|
|
|
+ $has_shuobo_id = $this->c2m->whereRaw('status = 0 or status = 1')->select('shuobo_id')->get()->toArray();
|
|
|
+ $no_show_shuobo = [];
|
|
|
+ if(is_array($has_shuobo_id)){
|
|
|
+ foreach ($has_shuobo_id as $v){
|
|
|
+ array_push($no_show_shuobo,$v['shuobo_id']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $user = auth('web-company')->user();
|
|
|
+ $notice_show_shuobo = [];
|
|
|
+ if($user){
|
|
|
+ //如果有登录,查找之前有跟进过的人才并标记
|
|
|
+ $notice_shobo_id = $this->c2m->where('company_id',$user->id)->select('shuobo_id')->get()->toArray();
|
|
|
+ if(is_array($notice_shobo_id)){
|
|
|
+ foreach ($notice_shobo_id as $v){
|
|
|
+ array_push($notice_show_shuobo,$v['shuobo_id']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
foreach ($list->items() as $k => $v){
|
|
|
+ if(in_array($v->id,$no_show_shuobo)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
$item = [
|
|
|
+ 'id' => $v->id,
|
|
|
'name' => $this->splitName($v->realname)[0] . ($v->sex == '男' ? '先生' : '女士'),
|
|
|
'sex' => $v->sex,
|
|
|
'birthday' => date('Y-m-d H:i:s',$v->birthday),
|
|
|
@@ -44,7 +92,8 @@ class ShuoboController extends WebBaseController
|
|
|
'school' => $v->school,
|
|
|
'pro' => $v->pro,
|
|
|
'trade_type' => $v->trade_type,
|
|
|
- 'speciality' => $v->speciality
|
|
|
+ 'speciality' => $v->speciality,
|
|
|
+ 'notice' => in_array($v->id,$notice_show_shuobo) ? 1 : 0
|
|
|
];
|
|
|
array_push($list_data,$item);
|
|
|
}
|
|
|
@@ -54,6 +103,81 @@ class ShuoboController extends WebBaseController
|
|
|
'list' => $list_data
|
|
|
);
|
|
|
|
|
|
+
|
|
|
+ return json_encode($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getTalentInfo(Request $request)
|
|
|
+ {
|
|
|
+ $user = auth('web-company')->user();
|
|
|
+ if(!$user){
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '未登录']);
|
|
|
+ }
|
|
|
+ $id = $request->input('id');
|
|
|
+ $info = MemberShuobo::where('id',$id)->first();
|
|
|
+ if(!$info){
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '找不到该人才信息']);
|
|
|
+ }
|
|
|
+ $c2m_data = [
|
|
|
+ 'company_id' => $user->id,
|
|
|
+ 'company_name' => $user->companyname,
|
|
|
+ 'shuobo_id' => $id,
|
|
|
+ 'shuobo_name' => $info->realname,
|
|
|
+ 'status' => 0
|
|
|
+ ];
|
|
|
+
|
|
|
+ $scid = $this->c2m->create($c2m_data);
|
|
|
+
|
|
|
+ return json_encode(['status' => 1,'data' => $info,'msg' => '']);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ public function updateCompanyToShuobo(Request $request)
|
|
|
+ {
|
|
|
+ $user = auth('web-company')->user();
|
|
|
+ if($user){
|
|
|
+ $id = $request->input('id');
|
|
|
+ if(!$id){
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '必要参数缺失!']);
|
|
|
+ }
|
|
|
+ $info = $this->c2m->where("company_id",$user->id)->where('shuobo_id',$id)->where('status',0)->first();
|
|
|
+ if(!$info){
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '这条硕博跟进记录不存在。']);
|
|
|
+ }
|
|
|
+ $status = $request->input('status');
|
|
|
+ $remark = $request->input('remark');
|
|
|
+ if(!in_array($status,[-1,0,1,2])){
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '状态不正确。']);
|
|
|
+ }
|
|
|
+ $this->c2m->where("company_id",$user->id)->where('shuobo_id',$id)->update(['status' => $status,'remark' => $remark]);
|
|
|
+ $ret = [
|
|
|
+ 'number' => 0
|
|
|
+ ];
|
|
|
+ return json_encode(['status' => 1,'data' => $ret,'msg' => '更新成功。']);
|
|
|
+ }
|
|
|
+ return json_encode(['status' => 1,'data' => '','msg' => '未登录','login' => 0]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function enterprise(Request $request)
|
|
|
+ {
|
|
|
+ return view('app.shuobo.enterprise');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function getShuoboJob(Request $request)
|
|
|
+ {
|
|
|
+ $keyword = $request->input('keyword');
|
|
|
+ $page = $request->input('page');
|
|
|
+ if(!empty($keyword)){
|
|
|
+ $list = DB::table("shuobo_jobs")->where("company_name","like","%{$keyword}%")->orWhere("job",'like',"%{$keyword}%")->orderBy('id','desc')->get()->toArray();
|
|
|
+ }else{
|
|
|
+ $list = DB::table("shuobo_jobs")->orderBy('id','desc')->get()->toArray();
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = array(
|
|
|
+ 'total' => count($list),
|
|
|
+ 'list' => array_slice($list,($page-1)*10,10)
|
|
|
+ );
|
|
|
+
|
|
|
return json_encode($data);
|
|
|
}
|
|
|
|