linwu 2 жил өмнө
parent
commit
9d0139905a

+ 31 - 0
app/common/model/ResumeInvite.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace app\common\model;
+
+use think\Model;
+
+class ResumeInvite extends Model
+{
+    // 设置字段信息
+    protected $schema = [
+        'id'         => 'int',
+        'workerid'   => 'int',
+        'userid'     => 'int',
+        'status'     => 'tinyint',
+        'remark'     => 'string',
+        'createtime' => 'int',
+    ];
+
+    // 设置字段自动转换类型
+    protected $type = [
+        'createtime' => 'timestamp:Y-m-d H:i:s',
+    ];
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $status = [1 => '邀请中', 2 => '邀请成功'];
+        return $status[$data['status']];
+    }
+
+
+}

+ 106 - 99
app/common/model/User.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\common\model;
 
 use think\Model;
@@ -10,119 +11,125 @@ class User extends Model
     protected $deleteTime = 'deletetime';
     protected $defaultSoftDelete = 0;
 
-	// 设置字段信息
+    // 设置字段信息
     protected $schema = [
-        'id'          		=> 'int',
-		'groupsid'			=> 'int',
-		'brokerid'			=> 'int',
-		'nickname'    		=> 'string',
-		'avatar'      		=> 'string',
-		'realname'			=> 'string',
-		'mobile'			=> 'string',
-		'integral'			=> 'int',
-		'inttotal'			=> 'int',
-		'status'			=> 'tinyint',
-		'isvip'				=> 'tinyint',
-		'authstatus'		=> 'int',
-		'authremark'    	=> 'string',
-		'idcardzpic'    	=> 'string',
-		'idcardfpic'    	=> 'string',
-		'idcard'    		=> 'string',
-		'gender'      		=> 'tinyint',
-		'birthday'    		=> 'string',
-		'address'      		=> 'string',
-		'education'     	=> 'string',
-		'createtime'  		=> 'int',
-		'jobintention'  	=> 'string',
-		'workexperience'	=> 'string',
-		'eduexperience'		=> 'string',
-		'followstatus'		=> 'tinyint',
-		'wxampcode'			=> 'string',
-		'bankcard'			=> 'string',
-		'emp_time'			=> 'string',
-		'com_cate'			=> 'string',
+        'id'             => 'int',
+        'groupsid'       => 'int',
+        'brokerid'       => 'int',
+        'nickname'       => 'string',
+        'avatar'         => 'string',
+        'realname'       => 'string',
+        'mobile'         => 'string',
+        'integral'       => 'int',
+        'inttotal'       => 'int',
+        'status'         => 'tinyint',
+        'isvip'          => 'tinyint',
+        'authstatus'     => 'int',
+        'authremark'     => 'string',
+        'idcardzpic'     => 'string',
+        'idcardfpic'     => 'string',
+        'idcard'         => 'string',
+        'gender'         => 'tinyint',
+        'birthday'       => 'string',
+        'address'        => 'string',
+        'education'      => 'string',
+        'createtime'     => 'int',
+        'jobintention'   => 'string',
+        'workexperience' => 'string',
+        'eduexperience'  => 'string',
+        'followstatus'   => 'tinyint',
+        'wxampcode'      => 'string',
+        'bankcard'       => 'string',
+        'emp_time'       => 'string',
+        'com_cate'       => 'string',
+        'is_public'      => 'int',
+        'volume'         => 'int',
+    ];
+
+    // 设置字段自动转换类型
+    protected $type = [
+        'bankcard'   => 'json',
+        'createtime' => 'timestamp:Y-m-d H:i:s',
+        'emp_time'   => 'json',
+        'com_cate'   => 'json',
     ];
-	
-	// 设置字段自动转换类型
-	protected $type = [
-		'bankcard'		=> 'json',
-		'createtime'	=> 'timestamp:Y-m-d H:i:s',
-		'emp_time'		=> 'json',
-		'com_cate'		=> 'json',
-	];
-	protected $jsonAssoc = true;
-	
-	
-	public function getStatusTextAttr($value,$data)
-	{
-		$status = [1=>'待审核', 2=>'已通过', 3=>'未通过'];
-		return $status[$data['status']];
-	}
-	
-	public function getIsvipTextAttr($value,$data)
-	{
-		$isvip = [1=>'否', 2=>'是'];
-		return $isvip[$data['isvip']];
-	}
-	
-	public function getAuthstatusTextAttr($value,$data)
-	{
-		$authstatus = [1=>'待认证', 2=>'待审核', 3=>'已认证'];
-		return $authstatus[$data['authstatus']];
-	}
-	
-	public function getFollowstatusTextAttr($value,$data)
-	{
-		$followstatus = [1=>'未跟进', 2=>'未面试', 3=>'面试通过', 4=>'面试未通过', 5=>'用户放弃', 6=>'已入职', 7=>'已离职'];
-		return $followstatus[$data['followstatus']];
-	}
-    public function getEducationTextAttr($value,$data)
+    protected $jsonAssoc = true;
+
+
+    public function getStatusTextAttr($value, $data)
+    {
+        $status = [1 => '待审核', 2 => '已通过', 3 => '未通过'];
+        return $status[$data['status']];
+    }
+
+    public function getIsvipTextAttr($value, $data)
+    {
+        $isvip = [1 => '否', 2 => '是'];
+        return $isvip[$data['isvip']];
+    }
+
+    public function getAuthstatusTextAttr($value, $data)
+    {
+        $authstatus = [1 => '待认证', 2 => '待审核', 3 => '已认证'];
+        return $authstatus[$data['authstatus']];
+    }
+
+    public function getFollowstatusTextAttr($value, $data)
+    {
+        $followstatus = [1 => '未跟进', 2 => '未面试', 3 => '面试通过', 4 => '面试未通过', 5 => '用户放弃', 6 => '已入职', 7 => '已离职'];
+        return $followstatus[$data['followstatus']];
+    }
+
+    public function getEducationTextAttr($value, $data)
     {
-        $education = [''=>'',1=>'初中', 2=>'高中', 3=>'中技',4=>'中专', 5=>'大专', 6=>'本科', 7=>'硕士', 8=>'博士'];
+        $education = ['' => '', 1 => '初中', 2 => '高中', 3 => '中技', 4 => '中专', 5 => '大专', 6 => '本科', 7 => '硕士', 8 => '博士'];
         return $education[$data['education']];
     }
-    public function getWorkerTextAttr($value,$data)
+
+    public function getWorkerTextAttr($value, $data)
     {
-        $experience = [''=>'',1=>'无经验', 2=>'一年以下', 3=>'1-3年',4=>'3-5年', 5=>'5-10年', 6=>'10年以上'];
+        $experience = ['' => '', 1 => '无经验', 2 => '一年以下', 3 => '1-3年', 4 => '3-5年', 5 => '5-10年', 6 => '10年以上'];
         return $experience[$data['workexperience']];
     }
-    public function getJobintentionTextAttr($value,$data)
+
+    public function getJobintentionTextAttr($value, $data)
     {
         $title = '';
-        if($data['jobintention']){
-            $title = UserWill::where('id',$data['jobintention'])->value('title');
+        if ($data['jobintention']) {
+            $title = UserWill::where('id', $data['jobintention'])->value('title');
         }
         return $title;
     }
-	// 关联UserGroups
-	public function userGroups()
-	{
-	    return $this->hasOne(UserGroups::class, "id", "groupsid");
-	}
- 
-	// 关联Broker
-	public function broker()
-	{
-	    return $this->hasOne(Broker::class, "id", "brokerid");
-	}
-	
-	// 关联UserPart
-	public function userPart()
-	{
-	    return $this->hasMany(UserPart::class, "puserid", "id");
-	}
-	
-	// 关联UserAuths
-	public function userAuths()
+
+    // 关联UserGroups
+    public function userGroups()
+    {
+        return $this->hasOne(UserGroups::class, "id", "groupsid");
+    }
+
+    // 关联Broker
+    public function broker()
+    {
+        return $this->hasOne(Broker::class, "id", "brokerid");
+    }
+
+    // 关联UserPart
+    public function userPart()
+    {
+        return $this->hasMany(UserPart::class, "puserid", "id");
+    }
+
+    // 关联UserAuths
+    public function userAuths()
     {
         return $this->hasMany(UserAuths::class, "userid", "id");
     }
-	
-	// 关联UserFollow
-	public function userFollow()
-	{
-	    return $this->hasMany(UserFollow::class, "userid", "id")->order('id','desc');
-	}
-
-	
+
+    // 关联UserFollow
+    public function userFollow()
+    {
+        return $this->hasMany(UserFollow::class, "userid", "id")->order('id', 'desc');
+    }
+
+
 }

+ 462 - 460
app/mainapp/controller/Comjobs.php

@@ -1,4 +1,5 @@
 <?php
+
 namespace app\mainapp\controller;
 
 use app\common\model\WorkerThird;
@@ -22,154 +23,155 @@ use echowx\WxProgram;
 
 class Comjobs extends BaseController
 {
-	
-	// 报备信息
-	public function setReport()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::with('worker')->where('status','in','3,4')->where('id','=',$comjobsid)->findOrEmpty();
-		if ($comjobs->isEmpty()){
-			page_result(1, "招聘信息不存在。");
-		}
-		$userid = input('userid/d', 0);
-		$brokerall = BrokerModel::where('userid','=',$userid)->where('status','=',1)->where('powerreport','=',1)->select();
-		page_result(0, "", array(
-			'comjobs'		=> $comjobs,
-			'brokerall'		=> $brokerall,
-			'arrivetime'	=> date("Y-m-d", strtotime("+1 day")) 
-			));
-	}
-	
-	public function getUserList()
-	{
-		$ppage = input('ppage/d', 1);
-		$psize = input('psize/d', 20);
-		$map = array();
-		$userid = input('userid/d', 0);
-		$brokeridarr = BrokerModel::where('userid','=',$userid)->column('id');
-		if (empty($brokeridarr)){
-			page_result(1, "职业顾问信息不存在。");
-		} 
-		$map[] = ['brokerid','IN',$brokeridarr];
-		$searchval = input('searchval/s', "");
-		if (!empty($searchval)){
-			$map[] =['nickname|realname|mobile', 'like', '%'.$searchval.'%']; 
-		}
-		$plist = UserModel::where($map)->order(['id'=>'desc'])->page($ppage)->limit($psize)->select();
-		page_result(0, "", array(
-			'plist' => $plist,
-			'pstatus' => $psize > count($plist) ? 'noMore' : 'more'
-			));
-	}
-	
-	public function disIdcard()
-	{
-		$picpath = input('picpath/s',"");
-		$picpath = root_path()."public".$picpath;
-		$idcard = aliyun_ocr_idcard( $picpath );
-		if ($idcard==false){
-			page_result(1, "身份证信息识别失败。");
-		}
-		page_result(0, "", array(
-			'idcard'		=> $idcard
-		));
-	}
-	
-	public function addReport()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::where('id','=',$comjobsid)->findOrEmpty();
-		if ($comjobs->isEmpty()){
-			page_result(1, "招聘信息不存在。");
-		}
-		$brokerid = input('brokerid/d', 0);
-		$broker = BrokerModel::where('id','=',$brokerid)->findOrEmpty();
-		if ($broker->isEmpty()){
-			page_result(1, "职业顾问信息不存在。");
-		}
-		$data = array(
-			'comjobsid'		=> $comjobsid,
-			'workerid'		=> $comjobs->workerid,
-			'agentid'		=> $broker->agentid,
-			'brokerid'		=> $brokerid, 
-			'realname'		=> input('realname/s', ""),
-			'mobile'		=> input('mobile/s', ""),
-			'idcard'		=> input('idcard/s', ""),
-			'arrivetime'	=> input('arrivetime/s', ""),
-			'status'		=> 1,
-			'remark'		=> input('remark/s', ""),
-			'retremark'		=> "",
-			'createtime'	=> date("Y-m-d H:i:s")
-		); 
-		ComjobsReportModel::create($data);
-		page_result(0, "", array());
-	}
-	
-	
-	
-	// 招聘总列表
-	public function pageComjobs()
-	{
-	    $searchval = trim(input('searchval/s', ""));
-        $map = array();
-        if (!empty($searchval)){
-            $map[] =['title', 'like', '%'.$searchval.'%'];
-        }
-        
-		$catelist = ComjobsCateModel::field('id as value, title, priority')->where($map)->order(['priority'=>'desc','id'=>'desc'])
-		            ->select()->toArray();
-		array_unshift( $catelist, array('value'=>0,'title'=>'全部') );
-		$wtypelist = array(['value'=>0,'title'=>'全部'], ['value'=>1,'title'=>'月薪'], ['value'=>2,'title'=>'日薪'], ['value'=>3,'title'=>'时薪'], ['value'=>4,'title'=>'面议'] );
-		$rectypelist = array(['value'=>0,'title'=>'全部'], ['value'=>1,'title'=>'普通招聘'], ['value'=>2,'title'=>'无忧聘'] );
-		page_result(0, "", array(
-			'catelist'			=> $catelist,
-			'wtypelist'			=> $wtypelist,
-			'rectypelist'		=> $rectypelist,
-			'provincelist'		=> $this->provincelist
-			)); 
-	}
-	
-	public function listComjobs()
-	{
-		$ppage = input('ppage/d', 1);
-		$psize = input('psize/d', 20);
-		$map = array();
-		$map[] = ['createtime','<=',time()];
-		$map[] = ['status','in','3,4'];
-		$searchval = input('searchval/s', "");
-		$whereor=[];
-		if (!empty($searchval)){
-			$whereor[] =['title', 'like', '%'.$searchval.'%'];
-			$lmap= array();
-            $lmap[]=['title', 'like', '%'.$searchval.'%'];
-            $worklike=WorkerModel::where($lmap)->select();
-
-            $wkids=array();
-            foreach ($worklike as $lk=>$v){
-                $wkids[]=$v["id"];
+
+    // 报备信息
+    public function setReport()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::with('worker')->where('status', 'in', '3,4')->where('id', '=', $comjobsid)->findOrEmpty();
+        if ($comjobs->isEmpty()) {
+            page_result(1, "招聘信息不存在。");
+        }
+        $userid    = input('userid/d', 0);
+        $brokerall = BrokerModel::where('userid', '=', $userid)->where('status', '=', 1)->where('powerreport', '=', 1)->select();
+        page_result(0, "", [
+            'comjobs'    => $comjobs,
+            'brokerall'  => $brokerall,
+            'arrivetime' => date("Y-m-d", strtotime("+1 day")),
+        ]);
+    }
+
+    public function getUserList()
+    {
+        $ppage       = input('ppage/d', 1);
+        $psize       = input('psize/d', 20);
+        $map         = [];
+        $userid      = input('userid/d', 0);
+        $brokeridarr = BrokerModel::where('userid', '=', $userid)->column('id');
+        if (empty($brokeridarr)) {
+            page_result(1, "职业顾问信息不存在。");
+        }
+        $map[]     = ['brokerid', 'IN', $brokeridarr];
+        $searchval = input('searchval/s', "");
+        if (!empty($searchval)) {
+            $map[] = ['nickname|realname|mobile', 'like', '%' . $searchval . '%'];
+        }
+        $plist = UserModel::where($map)->order(['id' => 'desc'])->page($ppage)->limit($psize)->select();
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
+    }
+
+    public function disIdcard()
+    {
+        $picpath = input('picpath/s', "");
+        $picpath = root_path() . "public" . $picpath;
+        $idcard  = aliyun_ocr_idcard($picpath);
+        if ($idcard == false) {
+            page_result(1, "身份证信息识别失败。");
+        }
+        page_result(0, "", [
+            'idcard' => $idcard,
+        ]);
+    }
+
+    public function addReport()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::where('id', '=', $comjobsid)->findOrEmpty();
+        if ($comjobs->isEmpty()) {
+            page_result(1, "招聘信息不存在。");
+        }
+        $brokerid = input('brokerid/d', 0);
+        $broker   = BrokerModel::where('id', '=', $brokerid)->findOrEmpty();
+        if ($broker->isEmpty()) {
+            page_result(1, "职业顾问信息不存在。");
+        }
+        $data = [
+            'comjobsid'  => $comjobsid,
+            'workerid'   => $comjobs->workerid,
+            'agentid'    => $broker->agentid,
+            'brokerid'   => $brokerid,
+            'realname'   => input('realname/s', ""),
+            'mobile'     => input('mobile/s', ""),
+            'idcard'     => input('idcard/s', ""),
+            'arrivetime' => input('arrivetime/s', ""),
+            'status'     => 1,
+            'remark'     => input('remark/s', ""),
+            'retremark'  => "",
+            'createtime' => date("Y-m-d H:i:s"),
+        ];
+        ComjobsReportModel::create($data);
+        page_result(0, "", []);
+    }
+
+
+    // 招聘总列表
+    public function pageComjobs()
+    {
+        $searchval = trim(input('searchval/s', ""));
+        $map       = [];
+        if (!empty($searchval)) {
+            $map[] = ['title', 'like', '%' . $searchval . '%'];
+        }
+
+        $catelist = ComjobsCateModel::field('id as value, title, priority')->where($map)->order(['priority' => 'desc', 'id' => 'desc'])
+            ->select()->toArray();
+        array_unshift($catelist, ['value' => 0, 'title' => '全部']);
+        $wtypelist   = [['value' => 0, 'title' => '全部'], ['value' => 1, 'title' => '月薪'], ['value' => 2, 'title' => '日薪'], ['value' => 3, 'title' => '时薪'], ['value' => 4, 'title' => '面议']];
+        $rectypelist = [['value' => 0, 'title' => '全部'], ['value' => 1, 'title' => '普通招聘'], ['value' => 2, 'title' => '无忧聘']];
+        page_result(0, "", [
+            'catelist'     => $catelist,
+            'wtypelist'    => $wtypelist,
+            'rectypelist'  => $rectypelist,
+            'provincelist' => $this->provincelist,
+        ]);
+    }
+
+    public function listComjobs()
+    {
+        $ppage     = input('ppage/d', 1);
+        $psize     = input('psize/d', 20);
+        $map       = [];
+        $map[]     = ['createtime', '<=', time()];
+        $map[]     = ['status', 'in', '3,4'];
+        $searchval = input('searchval/s', "");
+        $whereor   = [];
+        if (!empty($searchval)) {
+            $whereor[] = ['title', 'like', '%' . $searchval . '%'];
+            $lmap      = [];
+            $lmap[]    = ['title', 'like', '%' . $searchval . '%'];
+            $worklike  = WorkerModel::where($lmap)->select();
+
+            $wkids = [];
+            foreach ($worklike as $lk => $v) {
+                $wkids[] = $v["id"];
             }
             $whereor[] = ['workerid', 'in', $wkids];
-		}
-		$cateid = input('cateid/s', "");
-		if (!empty($cateid)){
-			$map[] = ['cateid', 'IN', $cateid];
-		}
-		$wtype = input('wtype/d', 0);
-		if ($wtype!=0){
-			$map[] = ['wtype', '=', $wtype];
-		}  
-		$rectype = input('rectype/d', 0);
-		if ($rectype!=0){
-			$map[] = ['recruitment_cate', '=', $rectype];
-		}  
-		$district = input('district/s', "");
-		if (!empty($district)){
-			$map[] = ['district', '=', $district];
-		}
-		$orderby = array('status'=>'asc', 'updatetime'=>'desc', 'id'=>'desc');
-		$plist = ComjobsModel::with(['worker'])->where($map)->where(function ($q) use($whereor){$q->whereOr($whereor);})->order($orderby)->page($ppage)->limit($psize)->select();
-
-		//数据处理
+        }
+        $cateid = input('cateid/s', "");
+        if (!empty($cateid)) {
+            $map[] = ['cateid', 'IN', $cateid];
+        }
+        $wtype = input('wtype/d', 0);
+        if ($wtype != 0) {
+            $map[] = ['wtype', '=', $wtype];
+        }
+        $rectype = input('rectype/d', 0);
+        if ($rectype != 0) {
+            $map[] = ['recruitment_cate', '=', $rectype];
+        }
+        $district = input('district/s', "");
+        if (!empty($district)) {
+            $map[] = ['district', '=', $district];
+        }
+        $orderby = ['status' => 'asc', 'updatetime' => 'desc', 'id' => 'desc'];
+        $plist   = ComjobsModel::with(['worker'])->where($map)->where(function ($q) use ($whereor) {
+            $q->whereOr($whereor);
+        })->order($orderby)->page($ppage)->limit($psize)->select();
+
+        //数据处理
         //第三方id
         $third_ids   = [];
         $third_lists = [];
@@ -188,319 +190,319 @@ class Comjobs extends BaseController
             }
         }
 
-		page_result(0, "", array(
-			'plist' => $plist,
-			'pstatus' => $psize > count($plist) ? 'noMore' : 'more'
-			));
-	}
-
-	// 招聘详情
-	public function getComjobs()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::with('worker')->where('status','in','3,4')->where('id','=',$comjobsid)->findOrEmpty();
-		if (!empty($comjobs['company_name'])) {
-		    $comjobs['worker']['title'] = $comjobs['company_name'];
-		    $comjobs['worker']['city'] = $comjobs['city'];
-		    $comjobs['worker']['district'] = $comjobs['district'];
-		    $comjobs['worker']['address'] = $comjobs['address'];
-        }
-		if ($comjobs->isEmpty()){
-			page_result(1, "招聘信息不存在。");
-		}
-		$comjobs->inc('volume', 1)->update();
-		$comjobslist = ComjobsModel::with('worker')->where(['status'=>3,'workerid'=>$comjobs->workerid])->where('createtime','<=',time())->order(['updatetime'=>'desc','createtime'=>'desc','id'=>'desc'])->limit(5)->select();
-		$userid = input('userid/d', 0);
-		$comjobsstar = ComjobsStarModel::where(['userid'=>$userid,'comjobsid'=>$comjobsid])->count();
-		$workerlog = WorkerLogModel::where(['workerid'=>$comjobs->workerid,'userid'=>$userid])->whereDay('createtime')->findOrEmpty();
-		$comjobsshare = ComjobsShareModel::where(['status'=>1])->order(['priority'=>'desc','id'=>'desc'])->select();
-		if ($workerlog->isEmpty()){
-			WorkerLogModel::create([
-				'workerid'		=> $comjobs->workerid,
-				'userid'		=> $userid,
-				'ltotal'		=> 1,
-				'createtime'	=> date("Y-m-d")
-			]);
-		}else{
-			$workerlog->inc('ltotal', 1)->update();
-		}
-		if($userid==0){
-			$brokertol = 0;
-		}else{
-			$brokertol = BrokerModel::where('userid','=',$userid)->where('status','=',1)->where('powerreport','=',1)->count();
-		}
-		page_result(0, "", array(
-			'comjobs'		=> $comjobs,
-			'comjobslist'	=> $comjobslist,
-			'comjobsstar'	=> $comjobsstar,
-			'comjobsshare'	=> $comjobsshare,
-			'brokertol'		=> $brokertol
-			));
-	}
-	
-	// 招聘海报
-	public function getComjobsImage()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$shareid = input('shareid/d',0);
-		$userid = input('userid/d',0);
-		$share = ComjobsShareModel::findOrEmpty($shareid);
-		$user = UserModel::findOrEmpty($userid);
-		$comjobs = ComjobsModel::findOrEmpty($comjobsid);
-		if ($share->isEmpty() || $user->isEmpty() || $comjobs->isEmpty()){
-			page_result(1, "招聘、海报或用户信息不存在");
-		}
-		$filename = $comjobsid."_".$userid."_".md5(time()).".jpg";
-		$dst_comjobspic = root_path("public/attachment/comjobspic").$filename;
-		$url_comjobspic = request()->domain()."/attachment/comjobspic/".$filename;
-		$wxprogram = new WxProgram();
-		$comjobspic = $wxprogram->wxacode_get_unlimited($comjobsid."&".$userid, "pages/comjobs/detail", 430, "attachment/comjobspic/".md5(time()).".jpg");
-		image_copy_image($share->tilpic, $comjobspic, 500,1270,200,200,$dst_comjobspic);
-		image_copy_image($url_comjobspic, $user->avatar, 50, 1040,90,90,$dst_comjobspic); 
-		
-		$font = root_path("public/static/images")."msyh.ttf";
-		
-		$fnickname = subtext($user->nickname, 16);
-		image_copy_text($dst_comjobspic, $fnickname, $font, 24, 0, 170, 1070, 0x00, 0x00, 0x00);
-		
-		$ftitle = subtext($comjobs->title, 20);
-		image_copy_text($dst_comjobspic, $ftitle, $font, 20, 0, 60, 1200, 0x66, 0x66, 0x66);
-		
-		$texttil = "";
-		if ($comjobs->wtype==1){
-			$texttil .= $comjobs->bwagall."~".$comjobs->zwagall."元/月";
-		}elseif($comjobs->wtype==2){
-			$texttil .= $comjobs->bwagall."元/日";
-		}elseif($comjobs->wtype==3){
-			$texttil .= $comjobs->bwagall."元/时";
-		}elseif($comjobs->wtype==4){
-			$texttil .= "面议";
-		}
-		$texttil .= " | ".$comjobs->city." | ".$comjobs->agegroup;
-		$texttil = subtext($texttil, 35);
-		image_copy_text($dst_comjobspic, $texttil, $font, 20, 0, 60, 1255, 0x66, 0x66, 0x66);
-		page_result(0, "", array(
-			'comjobspic'	=> $url_comjobspic
-			));
-	}
-	
-	// public function getComjobsImage()
-	// {
-	// 	$comjobsid = input('comjobsid/d', 0);
-	// 	$comjobs = ComjobsModel::where('status','in','3,4')->where('id','=',$comjobsid)->findOrEmpty()->toArray();
-	// 	if (empty($comjobs)){
-	// 		page_result(1, "招聘信息不存在。");
-	// 	}
-	// 	$userid = input('userid/d',0);
-	// 	$user = UserModel::findOrEmpty($userid);
-		
-	// 	$filename = $comjobsid."_".$userid."_".md5(time()).".jpg";
-	// 	$dst_comjobspic = root_path("public/attachment/comjobspic").$filename;
-	// 	$url_comjobspic = request()->domain()."/attachment/comjobspic/".$filename;
-		
-	// 	$shareid = input('shareid/d',0);
-	// 	$share = WorkerShareModel::findOrEmpty($shareid);
-		
-	// 	$bg_image = request()->domain() ."/static/images/comjobs_bg.jpg";
-	// 	image_copy_image($bg_image, $user->avatar, 55,170,640,320,$dst_comjobspic);
-		
-	// 	$scene = $comjobsid."&".$userid;
-	// 	$wxprogram = new WxProgram();
-	// 	$comjobscode = $wxprogram->wxacode_get_unlimited($scene, "pages/comjobs/detail", 430, "attachment/comjobspic/".md5(time()).".jpg");
-	// 	image_copy_image($url_comjobspic, $comjobscode, 285,940,180,180,$dst_comjobspic);
-	
-	// 	$font = root_path("public/static/images")."msyh.ttf";
-	// 	$title = subtext($comjobs['title'], 12);
-	// 	image_copy_text($dst_comjobspic, $title, $font, 32, 750, 580, 0x2c, 0xac, 0x3f);
-		
-	// 	$tags = @implode(" ", $comjobs['tags']);
-	// 	$tags = subtext($tags, 12);
-	// 	image_copy_text($dst_comjobspic, $tags, $font, 24, 740, 650, 0x03, 0x32, 0xa4);
-	
-	// 	if ($comjobs['wtype']==1){
-	// 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'-'.$comjobs['zwagall'].'元/月';
-	// 	}elseif ($comjobs['wtype']==2){
-	// 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/日';
-	// 	}elseif ($comjobs['wtype']==3){
-	// 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/时';
-	// 	}elseif ($comjobs['wtype']==4){
-	// 		$wagall = '薪资待遇:面议';
-	// 	}
-	// 	image_copy_text($dst_comjobspic, $wagall, $font, 24, 750, 710, 0x03, 0x32, 0xa4);
-		
-	// 	image_copy_text($dst_comjobspic, config('wxconfig.appName'), $font, 36, 750, 90, 0xff, 0xff, 0xff); 
-		
-	// 	page_result(0, "", array(
-	// 		'comjobspic'	=> $url_comjobspic
-	// 		));
-	// }
-	
-	
-	// 招聘海报
-	public function getComjobsCode()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::where('status','in','3,4')->where('id','=',$comjobsid)->findOrEmpty()->toArray();
-		if (empty($comjobs)){
-			page_result(1, "招聘信息不存在。");
-		}
-		$userid = input('userid/d',0);
-		$user = UserModel::findOrEmpty($userid);
-		
-		$filename = $comjobsid."_".$userid."_".md5(time()).".jpg";
-		$dst_comjobspic = root_path("public/attachment/comjobspic").$filename;
-		$url_comjobspic = request()->domain()."/attachment/comjobspic/".$filename;
-		
-		$bg_image = request()->domain() ."/static/images/comjobs_bg.jpg";
-		image_copy_image($bg_image, $user->avatar, 55,170,640,320,$dst_comjobspic);
-		
-		$scene = $comjobsid."&".$userid;
-		$wxprogram = new WxProgram();
-		$comjobscode = $wxprogram->wxacode_get_unlimited($scene, "pages/comjobs/detail", 430, "attachment/comjobspic/".md5(time()).".jpg");
-		image_copy_image($url_comjobspic, $comjobscode, 285,940,180,180,$dst_comjobspic);
-
-		$font = root_path("public/static/images")."msyh.ttf";
-		$title = subtext($comjobs['title'], 12);
-		image_copy_text($dst_comjobspic, $title, $font, 32, 750, 580, 0x2c, 0xac, 0x3f,0x00);
-		
-		$tags = @implode(" ", $comjobs['tags']);
-		$tags = subtext($tags, 12);
-		image_copy_text($dst_comjobspic, $tags, $font, 24, 740, 650, 0x03, 0x32, 0xa4,0x00);
-
-		if ($comjobs['wtype']==1){
-			$wagall = '薪资待遇:'.  $comjobs['bwagall'].'-'.$comjobs['zwagall'].'元/月';
-		}elseif ($comjobs['wtype']==2){
-			$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/日';
-		}elseif ($comjobs['wtype']==3){
-			$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/时';
-		}elseif ($comjobs['wtype']==4){
-			$wagall = '薪资待遇:面议';
-		}
-		image_copy_text($dst_comjobspic, $wagall, $font, 24, 750, 710, 0x03, 0x32, 0xa4,0x00);
-		
-		image_copy_text($dst_comjobspic, config('wxconfig.appName'), $font, 36, 750, 90, 0xff, 0xff, 0xff,0x00);
-		
-		page_result(0, "", array(
-			'comjobspic'	=> $url_comjobspic
-			));
-	}
-
-
-	// 关注招聘信息
-	public function delStar()
-	{	
-		$starid = input('starid/d', 0);
-		$userid = input('userid/d', 0);
-		$star = ComjobsStarModel::where(['id'=>$starid, 'userid'=>$userid])->findOrEmpty();
-		if ($star->isEmpty()){
-			page_result(1, "关注信息不存在或已被删除。");
-		}
-		$star->delete();
-		page_result(0, "", array());
-	}
-	
-	public function setComjobsStar()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::findOrEmpty($comjobsid);
-		if ($comjobs->isEmpty()){
-			page_result(1, "招聘信息不存在");
-		}
-		$userid = input('userid/d', 0);
-		$user = UserModel::findOrEmpty($userid);
-		if ($user->isEmpty()){
-			page_result(1, "用户信息不存在");
-		}
-		$star = ComjobsStarModel::where(['userid'=>$userid,'comjobsid'=>$comjobsid])->findOrEmpty();
-		if ($star->isEmpty()){
-			$star->save([
-				'comjobsid'		=> $comjobsid,
-				'userid'		=> $userid,
-				'createtime'	=> time()
-			]);
-			page_result(0, "", array('comjobsstar'=>1));
-		}else{
-			$star->delete();
-			page_result(0, "", array('comjobsstar'=>0));
-		}
-	}
-	
-	public function listStar()
-	{	
-		$ppage = input('ppage/d', 1);
-		$psize = input('psize/d', 20);
-		$userid = input('userid/d', 0);
-		$map[] = ['userid','=',$userid];
-		$plist = ComjobsStarModel::with(['comjobs.worker'])->where($map)->order(['createtime'=>'desc','id'=>'desc'])->page($ppage)->limit($psize)->select();
-		page_result(0, "", array(
-			'plist' => $plist,
-			'pstatus' => $psize > count($plist) ? 'noMore' : 'more'
-			));
-	}
-	
-	// 报名招聘信息
-	public function delLog()
-	{	
-		$logid = input('logid/d', 0);
-		$userid = input('userid/d', 0);
-		$log = ComjobsLogModel::where(['id'=>$logid, 'userid'=>$userid])->findOrEmpty();
-		if ($log->isEmpty()){
-			page_result(1, "报名记录信息不存在或已被删除。");
-		}
-		$log->delete();
-		page_result(0, "", array());
-	}
-	
-	public function listLog()
-	{	
-		$ppage = input('ppage/d', 1);
-		$psize = input('psize/d', 20);
-		$userid = input('userid/d', 0);
-		$map[] = ['userid','=',$userid];
-		$plist = ComjobsLogModel::with(['comjobs.worker'])->where($map)->order(['createtime'=>'desc','id'=>'desc'])->page($ppage)->limit($psize)->append(['status_text'])->select();
-		page_result(0, "", array(
-			'plist' => $plist,
-			'pstatus' => $psize > count($plist) ? 'noMore' : 'more'
-			));
-	}
-	
-	public function setComjobsLog()
-	{
-		$comjobsid = input('comjobsid/d', 0);
-		$comjobs = ComjobsModel::findOrEmpty($comjobsid);
-		if ($comjobs->isEmpty()){
-			page_result(1, "招聘信息不存在");
-		}
-		if ( strtotime($comjobs->enddate)+86400 < time() ){
-			page_result(1, "该招聘信息报名已截止,不能再报名了。");
-		}
-		$userid = input('userid/d', 0);
-		$user = UserModel::findOrEmpty($userid);
-		if ($user->isEmpty()){
-			page_result(1, "用户信息不存在");
-		}
-		$log = ComjobsLogModel::where(['comjobsid'=>$comjobsid,'userid'=>$userid])->findOrEmpty();
-		if ($log->isEmpty()){
-			$log->save([
-				'workerid' 		=> $comjobs->workerid,
-				'comjobsid'		=> $comjobsid,
-				'userid'		=> $userid,
-				'status'		=> 1,
-				'remark'		=> "",
-				'createtime'	=> time()
-			]);
-			UserFollowModel::create([
-				'userid'		=> $userid,
-				'ftype'			=> "招聘报名",
-				'fstatus'		=> 1,
-				'remark'		=> $comjobs->title,
-				'createtime'	=> time()
-			]);
-			page_result(0, "", array());
-		}else{
-			page_result(1, "你已报名过了,无需重复报名。");
-		}
-	}
-	
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
+    }
+
+    // 招聘详情
+    public function getComjobs()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::with('worker')->where('status', 'in', '3,4')->where('id', '=', $comjobsid)->findOrEmpty();
+        if (!empty($comjobs['company_name'])) {
+            $comjobs['worker']['title']    = $comjobs['company_name'];
+            $comjobs['worker']['city']     = $comjobs['city'];
+            $comjobs['worker']['district'] = $comjobs['district'];
+            $comjobs['worker']['address']  = $comjobs['address'];
+        }
+        if ($comjobs->isEmpty()) {
+            page_result(1, "招聘信息不存在。");
+        }
+        $comjobs->inc('volume', 1)->update();
+        $comjobslist  = ComjobsModel::with('worker')->where(['status' => 3, 'workerid' => $comjobs->workerid])->where('createtime', '<=', time())->order(['updatetime' => 'desc', 'createtime' => 'desc', 'id' => 'desc'])->limit(5)->select();
+        $userid       = input('userid/d', 0);
+        $comjobsstar  = ComjobsStarModel::where(['userid' => $userid, 'comjobsid' => $comjobsid])->count();
+        $workerlog    = WorkerLogModel::where(['workerid' => $comjobs->workerid, 'userid' => $userid])->whereDay('createtime')->findOrEmpty();
+        $comjobsshare = ComjobsShareModel::where(['status' => 1])->order(['priority' => 'desc', 'id' => 'desc'])->select();
+        if ($workerlog->isEmpty()) {
+            WorkerLogModel::create([
+                'workerid'   => $comjobs->workerid,
+                'userid'     => $userid,
+                'ltotal'     => 1,
+                'createtime' => date("Y-m-d"),
+            ]);
+        } else {
+            $workerlog->inc('ltotal', 1)->update();
+        }
+        if ($userid == 0) {
+            $brokertol = 0;
+        } else {
+            $brokertol = BrokerModel::where('userid', '=', $userid)->where('status', '=', 1)->where('powerreport', '=', 1)->count();
+        }
+        page_result(0, "", [
+            'comjobs'      => $comjobs,
+            'comjobslist'  => $comjobslist,
+            'comjobsstar'  => $comjobsstar,
+            'comjobsshare' => $comjobsshare,
+            'brokertol'    => $brokertol,
+        ]);
+    }
+
+    // 招聘海报
+    public function getComjobsImage()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $shareid   = input('shareid/d', 0);
+        $userid    = input('userid/d', 0);
+        $share     = ComjobsShareModel::findOrEmpty($shareid);
+        $user      = UserModel::findOrEmpty($userid);
+        $comjobs   = ComjobsModel::findOrEmpty($comjobsid);
+        if ($share->isEmpty() || $user->isEmpty() || $comjobs->isEmpty()) {
+            page_result(1, "招聘、海报或用户信息不存在");
+        }
+        $filename       = $comjobsid . "_" . $userid . "_" . md5(time()) . ".jpg";
+        $dst_comjobspic = root_path("public/attachment/comjobspic") . $filename;
+        $url_comjobspic = request()->domain() . "/attachment/comjobspic/" . $filename;
+        $wxprogram      = new WxProgram();
+        $comjobspic     = $wxprogram->wxacode_get_unlimited($comjobsid . "&" . $userid, "pages/comjobs/detail", 430, "attachment/comjobspic/" . md5(time()) . ".jpg");
+        image_copy_image($share->tilpic, $comjobspic, 500, 1270, 200, 200, $dst_comjobspic);
+        image_copy_image($url_comjobspic, $user->avatar, 50, 1040, 90, 90, $dst_comjobspic);
+
+        $font = root_path("public/static/images") . "msyh.ttf";
+
+        $fnickname = subtext($user->nickname, 16);
+        image_copy_text($dst_comjobspic, $fnickname, $font, 24, 0, 170, 1070, 0x00, 0x00, 0x00);
+
+        $ftitle = subtext($comjobs->title, 20);
+        image_copy_text($dst_comjobspic, $ftitle, $font, 20, 0, 60, 1200, 0x66, 0x66, 0x66);
+
+        $texttil = "";
+        if ($comjobs->wtype == 1) {
+            $texttil .= $comjobs->bwagall . "~" . $comjobs->zwagall . "元/月";
+        } elseif ($comjobs->wtype == 2) {
+            $texttil .= $comjobs->bwagall . "元/日";
+        } elseif ($comjobs->wtype == 3) {
+            $texttil .= $comjobs->bwagall . "元/时";
+        } elseif ($comjobs->wtype == 4) {
+            $texttil .= "面议";
+        }
+        $texttil .= " | " . $comjobs->city . " | " . $comjobs->agegroup;
+        $texttil = subtext($texttil, 35);
+        image_copy_text($dst_comjobspic, $texttil, $font, 20, 0, 60, 1255, 0x66, 0x66, 0x66);
+        page_result(0, "", [
+            'comjobspic' => $url_comjobspic,
+        ]);
+    }
+
+    // public function getComjobsImage()
+    // {
+    // 	$comjobsid = input('comjobsid/d', 0);
+    // 	$comjobs = ComjobsModel::where('status','in','3,4')->where('id','=',$comjobsid)->findOrEmpty()->toArray();
+    // 	if (empty($comjobs)){
+    // 		page_result(1, "招聘信息不存在。");
+    // 	}
+    // 	$userid = input('userid/d',0);
+    // 	$user = UserModel::findOrEmpty($userid);
+
+    // 	$filename = $comjobsid."_".$userid."_".md5(time()).".jpg";
+    // 	$dst_comjobspic = root_path("public/attachment/comjobspic").$filename;
+    // 	$url_comjobspic = request()->domain()."/attachment/comjobspic/".$filename;
+
+    // 	$shareid = input('shareid/d',0);
+    // 	$share = WorkerShareModel::findOrEmpty($shareid);
+
+    // 	$bg_image = request()->domain() ."/static/images/comjobs_bg.jpg";
+    // 	image_copy_image($bg_image, $user->avatar, 55,170,640,320,$dst_comjobspic);
+
+    // 	$scene = $comjobsid."&".$userid;
+    // 	$wxprogram = new WxProgram();
+    // 	$comjobscode = $wxprogram->wxacode_get_unlimited($scene, "pages/comjobs/detail", 430, "attachment/comjobspic/".md5(time()).".jpg");
+    // 	image_copy_image($url_comjobspic, $comjobscode, 285,940,180,180,$dst_comjobspic);
+
+    // 	$font = root_path("public/static/images")."msyh.ttf";
+    // 	$title = subtext($comjobs['title'], 12);
+    // 	image_copy_text($dst_comjobspic, $title, $font, 32, 750, 580, 0x2c, 0xac, 0x3f);
+
+    // 	$tags = @implode(" ", $comjobs['tags']);
+    // 	$tags = subtext($tags, 12);
+    // 	image_copy_text($dst_comjobspic, $tags, $font, 24, 740, 650, 0x03, 0x32, 0xa4);
+
+    // 	if ($comjobs['wtype']==1){
+    // 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'-'.$comjobs['zwagall'].'元/月';
+    // 	}elseif ($comjobs['wtype']==2){
+    // 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/日';
+    // 	}elseif ($comjobs['wtype']==3){
+    // 		$wagall = '薪资待遇:'.  $comjobs['bwagall'].'元/时';
+    // 	}elseif ($comjobs['wtype']==4){
+    // 		$wagall = '薪资待遇:面议';
+    // 	}
+    // 	image_copy_text($dst_comjobspic, $wagall, $font, 24, 750, 710, 0x03, 0x32, 0xa4);
+
+    // 	image_copy_text($dst_comjobspic, config('wxconfig.appName'), $font, 36, 750, 90, 0xff, 0xff, 0xff);
+
+    // 	page_result(0, "", array(
+    // 		'comjobspic'	=> $url_comjobspic
+    // 		));
+    // }
+
+
+    // 招聘海报
+    public function getComjobsCode()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::where('status', 'in', '3,4')->where('id', '=', $comjobsid)->findOrEmpty()->toArray();
+        if (empty($comjobs)) {
+            page_result(1, "招聘信息不存在。");
+        }
+        $userid = input('userid/d', 0);
+        $user   = UserModel::findOrEmpty($userid);
+
+        $filename       = $comjobsid . "_" . $userid . "_" . md5(time()) . ".jpg";
+        $dst_comjobspic = root_path("public/attachment/comjobspic") . $filename;
+        $url_comjobspic = request()->domain() . "/attachment/comjobspic/" . $filename;
+
+        $bg_image = request()->domain() . "/static/images/comjobs_bg.jpg";
+        image_copy_image($bg_image, $user->avatar, 55, 170, 640, 320, $dst_comjobspic);
+
+        $scene       = $comjobsid . "&" . $userid;
+        $wxprogram   = new WxProgram();
+        $comjobscode = $wxprogram->wxacode_get_unlimited($scene, "pages/comjobs/detail", 430, "attachment/comjobspic/" . md5(time()) . ".jpg");
+        image_copy_image($url_comjobspic, $comjobscode, 285, 940, 180, 180, $dst_comjobspic);
+
+        $font  = root_path("public/static/images") . "msyh.ttf";
+        $title = subtext($comjobs['title'], 12);
+        image_copy_text($dst_comjobspic, $title, $font, 32, 750, 580, 0x2c, 0xac, 0x3f, 0x00);
+
+        $tags = @implode(" ", $comjobs['tags']);
+        $tags = subtext($tags, 12);
+        image_copy_text($dst_comjobspic, $tags, $font, 24, 740, 650, 0x03, 0x32, 0xa4, 0x00);
+
+        if ($comjobs['wtype'] == 1) {
+            $wagall = '薪资待遇:' . $comjobs['bwagall'] . '-' . $comjobs['zwagall'] . '元/月';
+        } elseif ($comjobs['wtype'] == 2) {
+            $wagall = '薪资待遇:' . $comjobs['bwagall'] . '元/日';
+        } elseif ($comjobs['wtype'] == 3) {
+            $wagall = '薪资待遇:' . $comjobs['bwagall'] . '元/时';
+        } elseif ($comjobs['wtype'] == 4) {
+            $wagall = '薪资待遇:面议';
+        }
+        image_copy_text($dst_comjobspic, $wagall, $font, 24, 750, 710, 0x03, 0x32, 0xa4, 0x00);
+
+        image_copy_text($dst_comjobspic, config('wxconfig.appName'), $font, 36, 750, 90, 0xff, 0xff, 0xff, 0x00);
+
+        page_result(0, "", [
+            'comjobspic' => $url_comjobspic,
+        ]);
+    }
+
+
+    // 关注招聘信息
+    public function delStar()
+    {
+        $starid = input('starid/d', 0);
+        $userid = input('userid/d', 0);
+        $star   = ComjobsStarModel::where(['id' => $starid, 'userid' => $userid])->findOrEmpty();
+        if ($star->isEmpty()) {
+            page_result(1, "关注信息不存在或已被删除。");
+        }
+        $star->delete();
+        page_result(0, "", []);
+    }
+
+    public function setComjobsStar()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::findOrEmpty($comjobsid);
+        if ($comjobs->isEmpty()) {
+            page_result(1, "招聘信息不存在");
+        }
+        $userid = input('userid/d', 0);
+        $user   = UserModel::findOrEmpty($userid);
+        if ($user->isEmpty()) {
+            page_result(1, "用户信息不存在");
+        }
+        $star = ComjobsStarModel::where(['userid' => $userid, 'comjobsid' => $comjobsid])->findOrEmpty();
+        if ($star->isEmpty()) {
+            $star->save([
+                'comjobsid'  => $comjobsid,
+                'userid'     => $userid,
+                'createtime' => time(),
+            ]);
+            page_result(0, "", ['comjobsstar' => 1]);
+        } else {
+            $star->delete();
+            page_result(0, "", ['comjobsstar' => 0]);
+        }
+    }
+
+    public function listStar()
+    {
+        $ppage  = input('ppage/d', 1);
+        $psize  = input('psize/d', 20);
+        $userid = input('userid/d', 0);
+        $map[]  = ['userid', '=', $userid];
+        $plist  = ComjobsStarModel::with(['comjobs.worker'])->where($map)->order(['createtime' => 'desc', 'id' => 'desc'])->page($ppage)->limit($psize)->select();
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
+    }
+
+    // 报名招聘信息
+    public function delLog()
+    {
+        $logid  = input('logid/d', 0);
+        $userid = input('userid/d', 0);
+        $log    = ComjobsLogModel::where(['id' => $logid, 'userid' => $userid])->findOrEmpty();
+        if ($log->isEmpty()) {
+            page_result(1, "报名记录信息不存在或已被删除。");
+        }
+        $log->delete();
+        page_result(0, "", []);
+    }
+
+    public function listLog()
+    {
+        $ppage  = input('ppage/d', 1);
+        $psize  = input('psize/d', 20);
+        $userid = input('userid/d', 0);
+        $map[]  = ['userid', '=', $userid];
+        $plist  = ComjobsLogModel::with(['comjobs.worker'])->where($map)->order(['createtime' => 'desc', 'id' => 'desc'])->page($ppage)->limit($psize)->append(['status_text'])->select();
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
+    }
+
+    public function setComjobsLog()
+    {
+        $comjobsid = input('comjobsid/d', 0);
+        $comjobs   = ComjobsModel::findOrEmpty($comjobsid);
+        if ($comjobs->isEmpty()) {
+            page_result(1, "招聘信息不存在");
+        }
+        if (strtotime($comjobs->enddate) + 86400 < time()) {
+            page_result(1, "该招聘信息报名已截止,不能再报名了。");
+        }
+        $userid = input('userid/d', 0);
+        $user   = UserModel::findOrEmpty($userid);
+        if ($user->isEmpty()) {
+            page_result(1, "用户信息不存在");
+        }
+        $log = ComjobsLogModel::where(['comjobsid' => $comjobsid, 'userid' => $userid])->findOrEmpty();
+        if ($log->isEmpty()) {
+            $log->save([
+                'workerid'   => $comjobs->workerid,
+                'comjobsid'  => $comjobsid,
+                'userid'     => $userid,
+                'status'     => 1,
+                'remark'     => "",
+                'createtime' => time(),
+            ]);
+            UserFollowModel::create([
+                'userid'     => $userid,
+                'ftype'      => "招聘报名",
+                'fstatus'    => 1,
+                'remark'     => $comjobs->title,
+                'createtime' => time(),
+            ]);
+            page_result(0, "", []);
+        } else {
+            page_result(1, "你已报名过了,无需重复报名。");
+        }
+    }
+
 
 }

+ 366 - 368
app/mainapp/controller/Login.php

@@ -1,5 +1,7 @@
 <?php
+
 namespace app\mainapp\controller;
+
 use think\facade\Session;
 use app\common\model\Alisms as AlismsModel;
 use app\common\model\User as UserModel;
@@ -19,380 +21,376 @@ use think\exception\ValidateException;
 
 class Login
 {
-	
-	
-	// 自填手机号登录注册
-	public function setEditMobile()
-	{
-		$openid = input('openid/s', "");
-		$nickname = input('nickname/s', "");
-		$avatar = input('avatar/s', "");
-		$mobile = input('editmobile/s', "");
-		$editcode = input('editcode/s', "");
-		if (empty($mobile) || empty($editcode)){
-			page_result(1, "手机号及验证码不能为空");
-		}
-		$smscodepass = input('smscodepass');
-		if ($smscodepass!==md5($mobile.$editcode)){
-			page_result(1, "验证码不正确");
-		}
-		$user = UserModel::where(['mobile'=>$mobile])->findOrEmpty();
-		if ($user->isEmpty()){
-			$userdata = array(
-				'nickname'			=> $nickname,
-				'avatar'			=> $avatar,
-				'realname'			=> $nickname,
-				'mobile'			=> $mobile
-			);
-			try {
-				validate(UserValidate::class)->check($userdata);
-			} catch (ValidateException $e) {
-				page_result(1, $e->getError());
-			}
-			$authsarr = array(
-				'mobile' => $mobile,
-				'weixin' => $openid 
-			);
-			$user = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
-		} else {
-			$password = md5(time().mt_rand(100000, 999999));
-			$this->authsRegister($user->id, "mobile", $mobile, $password);
-			$this->authsRegister($user->id, "weixin", $openid, $password);
-		}
-		page_result(0, "", array('userinfo'=>$user));
-		
-	}
-	
-	// 微信授权手机号登录注册
-	public function setWxMobile()
-	{
-		$openid = input('openid/s', "");
-		$nickname = input('nickname/s', "");
-		$avatar = input('avatar/s', "");
-		$session_key = base64_decode(input('session_key/s', ""));
-		$iv = base64_decode(str_replace(' ','+',input('iv/s', "")));
-		$encryptedData = base64_decode(urldecode(input('encryptedData/s', "")));
-		$result = openssl_decrypt($encryptedData,"AES-128-CBC",$session_key,1,$iv);
-		$result = json_decode($result, true);
-		$mobile = $result['purePhoneNumber'];
-		$user = UserModel::where(['mobile'=>$mobile])->findOrEmpty();
-		if ($user->isEmpty()){
-			$userdata = array(
-				'nickname'			=> $nickname,
-				'avatar'			=> $avatar,
-				'realname'			=> $nickname,
-				'mobile'			=> $mobile
-			);
-			try {
-				validate(UserValidate::class)->check($userdata);
-			} catch (ValidateException $e) {
-				page_result(1, $e->getError());
-			}
-			$authsarr = array(
-				'mobile' => $mobile,
-				'weixin' => $openid
-			);
-			$user = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
-		} else {
-			$password = md5(time().mt_rand(100000, 999999));
-			$this->authsRegister($user->id, "mobile", $mobile, $password);
-			$this->authsRegister($user->id, "weixin", $openid, $password);
-		}
-		page_result(0, "", array('userinfo'=>$user));
-	}
-	
-	// 获取OpenId
-	public function getWxOpenid()
-	{ 
-		$code = input('code/s', "");
-		$wxprogram = new WxProgram();
-		$resdata = $wxprogram->auth_code2_session($code); 
-		$userauths = UserAuthsModel::with('user')->where(['identifier'=>$resdata['openid'],'identitytype'=>"weixin"])->findOrEmpty();
-		if ($userauths->isEmpty()){
-			$user = null;
-		}else{
-			$user = UserModel::where(['id'=>$userauths->userid])->find();
-		}
-		page_result(0, "", array(
-			'openid'		=> $resdata['openid'],
-			'session_key'	=> $resdata['session_key'],
-			'userinfo'		=> $user,
-			'userauths'		=> $userauths
-		));
-	}
-	
-	// 注册
-	public function userRegister($userdata, $parentid=0, $authsarr)
-	{
-		$groups = UserGroupsModel::order(['isdefault'=>'desc','id'=>'asc'])->findOrEmpty();
-		$groupsid = $groups->isEmpty() ? 0 : $groups->id ;
-		$data = array(
-			'groupsid'			=> $groupsid,
-			'brokerid'			=> 0,
-			'nickname'			=> "昵称",
-			'avatar'			=> "",
-			'realname'			=> "姓名",
-			'mobile'			=> "",
-			'integral'			=> 0,
-			'inttotal'			=> 0,
-			'status'			=> 2,
-			'isvip'				=> 1,
-			'authstatus'		=> 1,
-			'authremark'		=> "",
-			'idcardzpic'		=> "",
-			'idcardfpic'		=> "",
-			'idcard'			=> "",
-			'gender'			=> 1,
-			'birthday'			=> "",
-			'address'			=> "",
-			'education'			=> "",
-			'createtime'		=> time(),
-			'jobintention'		=> "",
-			'workexperience'	=> "",
-			'eduexperience'		=> "",
-			'followstatus'		=> 1,
-			'wxampcode'			=> "",
-			'bankcard'			=> array('openbank'=>"",'account'=>"",'number'=>"")
-		);
-		$resdata = array_merge($data, $userdata);
-		$user = new UserModel;
-		$user->save($resdata);
-		
-		$password = md5(time().mt_rand(100000, 999999));
-		if (!empty($authsarr['mobile'])){
-			$this->authsRegister($user->id, "mobile", $authsarr['mobile'], $password);
-		}
-		if (!empty($authsarr['weixin'])){
-			$this->authsRegister($user->id, "weixin", $authsarr['weixin'], $password);
-		}
-		
-		if ($parentid!=0){
-			$param = UserParamModel::where(1)->findOrEmpty();
-			$part = new UserPartModel;
-			$part->save([
-				'puserid'		=> $parentid,
-				'userid'		=> $user->id,
-				'redmoney'		=> intval($param->redmoney),
-				'status'		=> 1,
-				'createtime'	=> time()
-			]);
-			$partCount = UserPartModel::where('puserid', '=', $parentid)->count();
-			$puser = UserModel::findOrEmpty($parentid);
-			if ( intval($puser->isvip)==1 && $partCount>=intval($param->usernumber) ){
-				$puser->save(['isvip'=>2]);
-			}
-			if ($param->shareintegral>0){
-				$integral = new UserIntegralModel;
-				$integral->save([
-					'userid'		=> $puser->id,
-					'title'			=> "邀请新用户注册奖励",
-					'intvalue'		=> $param->shareintegral,
-					'intmoney'		=> 0.00,
-					'onlycontent'	=> "",
-					'remark'		=> "邀请新用户注册奖励积分",
-					'itype'			=> 1,
-					'createtime'	=> time(),
-					'yeartime'		=> date("Y"),
-					'monthtime'		=> date("Ym")
-				]);
-				$updata = array(
-					'integral'		=> $puser->integral + $param->shareintegral,
-					'inttotal'		=> $puser->inttotal + $param->shareintegral
-				);
-				$puser->save($updata);
-			}
-			$user->save([
-				'brokerid'		=> intval($puser->brokerid)
-			]);
-		}
-		return $user;
-	}
-	
-	public function authsRegister($userid, $identitytype, $identifier, $password)
-	{
-		$userauths = UserAuthsModel::where(['userid'=>$userid, 'identitytype'=>$identitytype])->findOrEmpty();
-		if ( !empty($identifier) && $userauths->isEmpty() ){
-			$userauths = new UserAuthsModel();
-			$userauths->save([
-				'userid'		=> $userid,
-				'identitytype'	=> $identitytype,
-				'identifier'	=> $identifier,
-				'password'		=> $password,
-				'logintime'		=> time(),
-				'loginip'		=> $_SERVER['SERVER_ADDR']
-			]);
-		}elseif ( !empty($identifier) && $identifier!==$userauths->identifier){
-			$userauths->identifier = $identifier;
-			$userauths->password = $password;
-			$userauths->save();
-		}
-		return true;
-	}
-	
-	
-	
-	// 账号密码登录
-	public function passLogin()
-	{
-		$identifier = input('identifier');
-		$password = input('password');
-		$userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		if ($userauths->isEmpty()){
-			page_result(1, "该手机号不存在");
-		}
-		if ($userauths['password']!==md5($password)){
-			page_result(1, "登录密码不正确");
-		}
-		$user = UserModel::find($userauths['userid']);
-		if ($user->isEmpty()){
-			page_result(1, "用户信息不存在");
-		}
-		if ($user['status']==2){
-			page_result(1, "该用户已被禁用,如有疑问请联系管理员。");
-		}
-		page_result(0, "", array('userinfo'=>$user));
-	}
-	
-	// 密码重置
-	public function newPassword()
-	{
-		$identifier = input('identifier');
-		$newpassword = input('newpassword');
-		$userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		if ($userauths->isEmpty()){
-			page_result(1, "该手机号不存在");
-		}
-		$user = UserModel::find($userauths['userid']);
-		if ($user->isEmpty()){
-			page_result(1, "用户信息不存在");
-		}
-		if ($user['status']==2){
-			page_result(1, "该用户已被禁用,如有疑问请联系管理员。");
-		}
-		UserAuthsModel::update(['password' => md5($newpassword)], ['id' => $userauths->id]);
-		page_result(0, "", array('userinfo'=>$user));
-	}
-	
-	// 手机号注册登录
-	public function mobileLogin()
-	{
-		$identifier = input('editmobile');
-		$smscode = input('editcode');
-		$smscodepass = input('smscodepass');
-		if ($smscodepass!==md5($identifier.$smscode) && $identifier!="18903869820"){
-			page_result(1, "验证码不正确");
-		}
-		$userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		if (!$userauths->isEmpty()){
-			$user = UserModel::find($userauths['userid']);
-			page_result(0, "", array('userinfo'=>$user));
-		}
-		$userdata = array(
-			'mobile'			=> $identifier
-		);
-		try {
-			validate(UserValidate::class)->check($userdata);
-		} catch (ValidateException $e) {
-			page_result(1, $e->getError());
-		}
-		$authsarr = array(
-			'mobile' => $identifier
-		);
-		$user = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
 
-        $user = UserModel::where('id',250)->find();
-		page_result(0, "", array('userinfo'=>$user));
-	}
-	
 
-	/**
-	 * 阿里短信验证码
-	 */
-	protected function aliSendSms($mobile,$temp,$dataarr,$alisms) 
-	{
-	    $params = array();
-	    $security = false;
-	    $params["PhoneNumbers"] = $mobile;
-	    $params["SignName"] = $alisms['signname'];
-	    $params["TemplateCode"] = $temp;
-	    $params['TemplateParam'] = $dataarr;
-	    if(!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
-	        $params["TemplateParam"] = json_encode($params["TemplateParam"], JSON_UNESCAPED_UNICODE);
-	    }
-	    $helper = new SignatureHelper();
-	    $content = $helper->request(
-	        $alisms['accesskeyid'],
-	        $alisms['accesskeysecret'],
-	        "dysmsapi.aliyuncs.com",
-	        array_merge($params, array(
-	            "RegionId" => "cn-hangzhou",
-	            "Action" => "SendSms",
-	            "Version" => "2017-05-25",
-	        )),
-	        $security
-	    );
-	    return $content;
-	}
-	
-	
-	public function smsRegister()
-	{
-		$identifier = input('identifier');
+    // 自填手机号登录注册
+    public function setEditMobile()
+    {
+        $openid   = input('openid/s', "");
+        $nickname = input('nickname/s', "");
+        $avatar   = input('avatar/s', "");
+        $mobile   = input('editmobile/s', "");
+        $editcode = input('editcode/s', "");
+        if (empty($mobile) || empty($editcode)) {
+            page_result(1, "手机号及验证码不能为空");
+        }
+        $smscodepass = input('smscodepass');
+        if ($smscodepass !== md5($mobile . $editcode)) {
+            page_result(1, "验证码不正确");
+        }
+        $user = UserModel::where(['mobile' => $mobile])->findOrEmpty();
+        if ($user->isEmpty()) {
+            $userdata = [
+                'nickname' => $nickname,
+                'avatar'   => $avatar,
+                'realname' => $nickname,
+                'mobile'   => $mobile,
+            ];
+            try {
+                validate(UserValidate::class)->check($userdata);
+            } catch (ValidateException $e) {
+                page_result(1, $e->getError());
+            }
+            $authsarr = [
+                'mobile' => $mobile,
+                'weixin' => $openid,
+            ];
+            $user     = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
+        } else {
+            $password = md5(time() . mt_rand(100000, 999999));
+            $this->authsRegister($user->id, "mobile", $mobile, $password);
+            $this->authsRegister($user->id, "weixin", $openid, $password);
+        }
+        page_result(0, "", ['userinfo' => $user]);
+
+    }
+
+    // 微信授权手机号登录注册
+    public function setWxMobile()
+    {
+        $openid        = input('openid/s', "");
+        $nickname      = input('nickname/s', "");
+        $avatar        = input('avatar/s', "");
+        $session_key   = base64_decode(input('session_key/s', ""));
+        $iv            = base64_decode(str_replace(' ', '+', input('iv/s', "")));
+        $encryptedData = base64_decode(urldecode(input('encryptedData/s', "")));
+        $result        = openssl_decrypt($encryptedData, "AES-128-CBC", $session_key, 1, $iv);
+        $result        = json_decode($result, true);
+        $mobile        = $result['purePhoneNumber'];
+        $user          = UserModel::where(['mobile' => $mobile])->findOrEmpty();
+        if ($user->isEmpty()) {
+            $userdata = [
+                'nickname' => $nickname,
+                'avatar'   => $avatar,
+                'realname' => $nickname,
+                'mobile'   => $mobile,
+            ];
+            try {
+                validate(UserValidate::class)->check($userdata);
+            } catch (ValidateException $e) {
+                page_result(1, $e->getError());
+            }
+            $authsarr = [
+                'mobile' => $mobile,
+                'weixin' => $openid,
+            ];
+            $user     = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
+        } else {
+            $password = md5(time() . mt_rand(100000, 999999));
+            $this->authsRegister($user->id, "mobile", $mobile, $password);
+            $this->authsRegister($user->id, "weixin", $openid, $password);
+        }
+        page_result(0, "", ['userinfo' => $user]);
+    }
+
+    // 获取OpenId
+    public function getWxOpenid()
+    {
+        $code      = input('code/s', "");
+        $wxprogram = new WxProgram();
+        $resdata   = $wxprogram->auth_code2_session($code);
+        $userauths = UserAuthsModel::with('user')->where(['identifier' => $resdata['openid'], 'identitytype' => "weixin"])->findOrEmpty();
+        if ($userauths->isEmpty()) {
+            $user = null;
+        } else {
+            $user = UserModel::where(['id' => $userauths->userid])->find();
+        }
+        page_result(0, "", [
+            'openid'      => $resdata['openid'],
+            'session_key' => $resdata['session_key'],
+            'userinfo'    => $user,
+            'userauths'   => $userauths,
+        ]);
+    }
+
+    // 注册
+    public function userRegister($userdata, $parentid = 0, $authsarr)
+    {
+        $groups   = UserGroupsModel::order(['isdefault' => 'desc', 'id' => 'asc'])->findOrEmpty();
+        $groupsid = $groups->isEmpty() ? 0 : $groups->id;
+        $data     = [
+            'groupsid'       => $groupsid,
+            'brokerid'       => 0,
+            'nickname'       => "昵称",
+            'avatar'         => "",
+            'realname'       => "姓名",
+            'mobile'         => "",
+            'integral'       => 0,
+            'inttotal'       => 0,
+            'status'         => 2,
+            'isvip'          => 1,
+            'authstatus'     => 1,
+            'authremark'     => "",
+            'idcardzpic'     => "",
+            'idcardfpic'     => "",
+            'idcard'         => "",
+            'gender'         => 1,
+            'birthday'       => "",
+            'address'        => "",
+            'education'      => "",
+            'createtime'     => time(),
+            'jobintention'   => "",
+            'workexperience' => "",
+            'eduexperience'  => "",
+            'followstatus'   => 1,
+            'wxampcode'      => "",
+            'bankcard'       => ['openbank' => "", 'account' => "", 'number' => ""],
+            'emp_time'       => [],
+            'com_cate'       => [],
+        ];
+        $resdata  = array_merge($data, $userdata);
+        $user     = new UserModel;
+        $user->save($resdata);
+
+        $password = md5(time() . mt_rand(100000, 999999));
+        if (!empty($authsarr['mobile'])) {
+            $this->authsRegister($user->id, "mobile", $authsarr['mobile'], $password);
+        }
+        if (!empty($authsarr['weixin'])) {
+            $this->authsRegister($user->id, "weixin", $authsarr['weixin'], $password);
+        }
+
+        if ($parentid != 0) {
+            $param = UserParamModel::where(1)->findOrEmpty();
+            $part  = new UserPartModel;
+            $part->save([
+                'puserid'    => $parentid,
+                'userid'     => $user->id,
+                'redmoney'   => intval($param->redmoney),
+                'status'     => 1,
+                'createtime' => time(),
+            ]);
+            $partCount = UserPartModel::where('puserid', '=', $parentid)->count();
+            $puser     = UserModel::findOrEmpty($parentid);
+            if (intval($puser->isvip) == 1 && $partCount >= intval($param->usernumber)) {
+                $puser->save(['isvip' => 2]);
+            }
+            if ($param->shareintegral > 0) {
+                $integral = new UserIntegralModel;
+                $integral->save([
+                    'userid'      => $puser->id,
+                    'title'       => "邀请新用户注册奖励",
+                    'intvalue'    => $param->shareintegral,
+                    'intmoney'    => 0.00,
+                    'onlycontent' => "",
+                    'remark'      => "邀请新用户注册奖励积分",
+                    'itype'       => 1,
+                    'createtime'  => time(),
+                    'yeartime'    => date("Y"),
+                    'monthtime'   => date("Ym"),
+                ]);
+                $updata = [
+                    'integral' => $puser->integral + $param->shareintegral,
+                    'inttotal' => $puser->inttotal + $param->shareintegral,
+                ];
+                $puser->save($updata);
+            }
+            $user->save([
+                'brokerid' => intval($puser->brokerid),
+            ]);
+        }
+        return $user;
+    }
+
+    public function authsRegister($userid, $identitytype, $identifier, $password)
+    {
+        $userauths = UserAuthsModel::where(['userid' => $userid, 'identitytype' => $identitytype])->findOrEmpty();
+        if (!empty($identifier) && $userauths->isEmpty()) {
+            $userauths = new UserAuthsModel();
+            $userauths->save([
+                'userid'       => $userid,
+                'identitytype' => $identitytype,
+                'identifier'   => $identifier,
+                'password'     => $password,
+                'logintime'    => time(),
+                'loginip'      => $_SERVER['SERVER_ADDR'],
+            ]);
+        } elseif (!empty($identifier) && $identifier !== $userauths->identifier) {
+            $userauths->identifier = $identifier;
+            $userauths->password   = $password;
+            $userauths->save();
+        }
+        return true;
+    }
+
+
+    // 账号密码登录
+    public function passLogin()
+    {
+        $identifier = input('identifier');
+        $password   = input('password');
+        $userauths  = UserAuthsModel::where(['identifier' => $identifier, 'identitytype' => "mobile"])->findOrEmpty();
+        if ($userauths->isEmpty()) {
+            page_result(1, "该手机号不存在");
+        }
+        if ($userauths['password'] !== md5($password)) {
+            page_result(1, "登录密码不正确");
+        }
+        $user = UserModel::find($userauths['userid']);
+        if ($user->isEmpty()) {
+            page_result(1, "用户信息不存在");
+        }
+        if ($user['status'] == 2) {
+            page_result(1, "该用户已被禁用,如有疑问请联系管理员。");
+        }
+        page_result(0, "", ['userinfo' => $user]);
+    }
+
+    // 密码重置
+    public function newPassword()
+    {
+        $identifier  = input('identifier');
+        $newpassword = input('newpassword');
+        $userauths   = UserAuthsModel::where(['identifier' => $identifier, 'identitytype' => "mobile"])->findOrEmpty();
+        if ($userauths->isEmpty()) {
+            page_result(1, "该手机号不存在");
+        }
+        $user = UserModel::find($userauths['userid']);
+        if ($user->isEmpty()) {
+            page_result(1, "用户信息不存在");
+        }
+        if ($user['status'] == 2) {
+            page_result(1, "该用户已被禁用,如有疑问请联系管理员。");
+        }
+        UserAuthsModel::update(['password' => md5($newpassword)], ['id' => $userauths->id]);
+        page_result(0, "", ['userinfo' => $user]);
+    }
+
+    // 手机号注册登录
+    public function mobileLogin()
+    {
+        $identifier  = input('editmobile');
+        $smscode     = input('editcode');
+        $smscodepass = input('smscodepass');
+        if ($smscodepass !== md5($identifier . $smscode) && $identifier != "18903869820") {
+            page_result(1, "验证码不正确");
+        }
+        $userauths = UserAuthsModel::where(['identifier' => $identifier, 'identitytype' => "mobile"])->findOrEmpty();
+        if (!$userauths->isEmpty()) {
+            $user = UserModel::find($userauths['userid']);
+            page_result(0, "", ['userinfo' => $user]);
+        }
+        $userdata = [
+            'mobile' => $identifier,
+        ];
+        try {
+            validate(UserValidate::class)->check($userdata);
+        } catch (ValidateException $e) {
+            page_result(1, $e->getError());
+        }
+        $authsarr = [
+            'mobile' => $identifier,
+        ];
+        $user     = $this->userRegister($userdata, input('parentid/d', 0), $authsarr);
+
+        $user = UserModel::where('id', 250)->find();
+        page_result(0, "", ['userinfo' => $user]);
+    }
+
+
+    /**
+     * 阿里短信验证码
+     */
+    protected function aliSendSms($mobile, $temp, $dataarr, $alisms)
+    {
+        $params                  = [];
+        $security                = false;
+        $params["PhoneNumbers"]  = $mobile;
+        $params["SignName"]      = $alisms['signname'];
+        $params["TemplateCode"]  = $temp;
+        $params['TemplateParam'] = $dataarr;
+        if (!empty($params["TemplateParam"]) && is_array($params["TemplateParam"])) {
+            $params["TemplateParam"] = json_encode($params["TemplateParam"], JSON_UNESCAPED_UNICODE);
+        }
+        $helper  = new SignatureHelper();
+        $content = $helper->request(
+            $alisms['accesskeyid'],
+            $alisms['accesskeysecret'],
+            "dysmsapi.aliyuncs.com",
+            array_merge($params, [
+                "RegionId" => "cn-hangzhou",
+                "Action"   => "SendSms",
+                "Version"  => "2017-05-25",
+            ]),
+            $security
+        );
+        return $content;
+    }
+
+
+    public function smsRegister()
+    {
+        $identifier = input('identifier');
 // 		$ismobile = preg_match('#^13[\d]{9}$|^14[5,7]{1}\d{8}$|^15[^4]{1}\d{8}$|^17[0,6,7,8]{1}\d{8}$|^18[\d]{9}$#', $identifier);
         $ismobile = preg_match('/^1[3456789]{1}[0-9]{9}$/', $identifier);
-		if (!$ismobile){
-			page_result(1, "请填入正确的手机号");
-		}
-		$userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		if (!$userauths->isEmpty()){
-			page_result(1, "该手机号已注册");
-		}
-		$smscode = mt_rand(100000, 999999);
-		$alisms = AlismsModel::where(1)->find(); 
-		$this->aliSendSms($identifier, $alisms['register'], array('code'=>$smscode), $alisms);
-		page_result(0, "", array('smscodepass'=>md5($identifier.$smscode)));
-	}
-	
-	public function smsGetPassword()
-	{
-		$identifier = input('identifier');
+        if (!$ismobile) {
+            page_result(1, "请填入正确的手机号");
+        }
+        $userauths = UserAuthsModel::where(['identifier' => $identifier, 'identitytype' => "mobile"])->findOrEmpty();
+        if (!$userauths->isEmpty()) {
+            page_result(1, "该手机号已注册");
+        }
+        $smscode = mt_rand(100000, 999999);
+        $alisms  = AlismsModel::where(1)->find();
+        $this->aliSendSms($identifier, $alisms['register'], ['code' => $smscode], $alisms);
+        page_result(0, "", ['smscodepass' => md5($identifier . $smscode)]);
+    }
+
+    public function smsGetPassword()
+    {
+        $identifier = input('identifier');
 // 		$ismobile = preg_match('#^13[\d]{9}$|^14[5,7]{1}\d{8}$|^15[^4]{1}\d{8}$|^17[0,6,7,8]{1}\d{8}$|^18[\d]{9}$#', $identifier);
-		$ismobile = preg_match('/^1[3456789]{1}[0-9]{9}$/', $identifier);
-		if (!$ismobile){
-			page_result(1, "请填入正确的手机号");
-		}
-		$userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		if ($userauths->isEmpty()){
-			page_result(1, "用户记录不存在");
-		}
-		$smscode = mt_rand(100000, 999999);
-		$alisms = AlismsModel::where(1)->find();
-		$this->aliSendSms($identifier, $alisms['getpassword'], array('code'=>$smscode), $alisms);
-		page_result(0, "", array('smscodepass'=>md5($identifier.$smscode)));
-	}
-	
-	public function smsMobileLogin()
+        $ismobile = preg_match('/^1[3456789]{1}[0-9]{9}$/', $identifier);
+        if (!$ismobile) {
+            page_result(1, "请填入正确的手机号");
+        }
+        $userauths = UserAuthsModel::where(['identifier' => $identifier, 'identitytype' => "mobile"])->findOrEmpty();
+        if ($userauths->isEmpty()) {
+            page_result(1, "用户记录不存在");
+        }
+        $smscode = mt_rand(100000, 999999);
+        $alisms  = AlismsModel::where(1)->find();
+        $this->aliSendSms($identifier, $alisms['getpassword'], ['code' => $smscode], $alisms);
+        page_result(0, "", ['smscodepass' => md5($identifier . $smscode)]);
+    }
+
+    public function smsMobileLogin()
     {
-		$identifier = input('identifier');
+        $identifier = input('identifier');
 // 		$ismobile = preg_match('#^13[\d]{9}$|^14[5,7]{1}\d{8}$|^15[^4]{1}\d{8}$|^17[0,6,7,8]{1}\d{8}$|^18[\d]{9}$#', $identifier);
         $ismobile = preg_match('/^1[3456789]{1}[0-9]{9}$/', $identifier);
-		if (!$ismobile){
-			page_result(1, "请填入正确的手机号");
-		}
-		// $userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
-		// if ($userauths->isEmpty()){
-		// 	page_result(1, "用户记录不存在");
-		// }
-		$smscode = mt_rand(100000, 999999);
-		$alisms = AlismsModel::where(1)->find();
-		$this->aliSendSms($identifier, $alisms['mobilelogin'], array('code'=>$smscode), $alisms);
-		page_result(0, "", array('smscodepass'=>md5($identifier.$smscode)));
-	}
-	
-	
-	
-	
-	
-	
-	
+        if (!$ismobile) {
+            page_result(1, "请填入正确的手机号");
+        }
+        // $userauths = UserAuthsModel::where(['identifier'=>$identifier,'identitytype'=>"mobile"])->findOrEmpty();
+        // if ($userauths->isEmpty()){
+        // 	page_result(1, "用户记录不存在");
+        // }
+        $smscode = mt_rand(100000, 999999);
+        $alisms  = AlismsModel::where(1)->find();
+        $this->aliSendSms($identifier, $alisms['mobilelogin'], ['code' => $smscode], $alisms);
+        page_result(0, "", ['smscodepass' => md5($identifier . $smscode)]);
+    }
+
+
 }

+ 116 - 0
app/mainapp/controller/Resume.php

@@ -0,0 +1,116 @@
+<?php
+
+namespace app\mainapp\controller;
+
+use app\common\model\ComjobsCate as ComjobsCateModel;
+use app\common\model\ResumeInvite as ResumeInviteModel;
+use app\common\model\User as UserModel;
+use app\common\model\UserWill as UserWillModel;
+use app\mainapp\BaseController;
+
+class Resume extends BaseController
+{
+
+    /**
+     * 简历列表
+     */
+    public function listResume()
+    {
+        $ppage = input('ppage/d', 1);
+        $psize = input('psize/d', 20);
+
+        $model = new UserModel();
+        $model = $model->where('status', 2)->where('authstatus', '=', 3);
+
+        $jobintention = input('jobintention/d', 0);
+        if (!empty($jobintention)) {
+            $model = $model->where('jobintention', $jobintention);
+        }
+        $cateid = input('cateid/d', 0);
+        if (!empty($cateid)) {
+            $cate_name = ComjobsCateModel::where('id', $cateid)->value('title');
+            if (!empty($cate_name)) {
+                $model->whereRaw("json_contains(com_cate,CONCAT('\"',:name,'\"'))", ['name' => $cate_name]);
+            }
+        }
+
+        $plist = $model->page($ppage)->limit($psize)->append(['jobintention_text'])->select();
+
+        page_result(0, "", [
+            'plist'   => $plist,
+            'pstatus' => $psize > count($plist) ? 'noMore' : 'more',
+        ]);
+    }
+
+    /**
+     * 简历搜索条件
+     */
+    public function searchItem()
+    {
+        $catelist = ComjobsCateModel::field('id as value, title, priority')->order(['priority' => 'desc', 'id' => 'desc'])
+            ->select()->toArray();
+        array_unshift($catelist, ['value' => 0, 'title' => '全部']);
+        $jobintentionlist = UserWillModel::field('id as value, title')->select()->toArray();
+        array_unshift($jobintentionlist, ['value' => 0, 'title' => '全部']);
+        page_result(0, "", [
+            'catelist'         => $catelist,
+            'jobintentionlist' => $jobintentionlist,
+        ]);
+    }
+
+    /**
+     * 简历详情
+     */
+    public function detail()
+    {
+        //简历信息
+        $id = input('id/d', 0);
+        if (empty($id)) {
+            page_result(1, "简历不存在。");
+        }
+
+        $info = UserModel::where('id', $id)->find();
+        if ($info->isEmpty()) {
+            page_result(1, "简历不存在。");
+        }
+
+        if ($info->status != 2 || $info->authstatus != 3) {
+            page_result(1, "简历未通过系统验证。");
+        }
+
+        $info->append(['jobintention_text', 'education_text', 'worker_text']);
+        $info->volume = 2;
+        $info->save();
+
+        //邀请记录
+        $workerid = input('workerid/d', 0);
+        $invite   = ResumeInviteModel::where('userid', $id)->where('workerid', $workerid)->find();
+
+        page_result(0, "", [
+            'info'   => $info,
+            'invite' => $invite,
+        ]);
+    }
+
+    /**
+     * 邀请面试
+     */
+    public function invite()
+    {
+        $userid   = input('userid/d', 0);
+        $workerid = input('workerid/d', 0);
+
+        $check = ResumeInviteModel::where('workerid', $workerid)->where('userid', $userid)->find();
+        if (!empty($check)) {
+            page_result(1, "请勿重复邀请", $check);
+        }
+
+        $info = ResumeInviteModel::create([
+            'workerid'   => $workerid,
+            'userid'     => $userid,
+            'createtime' => time(),
+        ]);
+
+        page_result(0, "邀请成功", $info);
+    }
+}