| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 | 
							- <?php
 
- /**
 
-  * Created by PhpStorm.
 
-  * User: wuzhenke
 
-  * Date: 2019/1/24
 
-  * Time: 17:29
 
-  */
 
- namespace App\Repositories\Jobfair;
 
- use App\Models\Jobfair\JobfairCompany;
 
- use function foo\func;
 
- use Illuminate\Support\Facades\DB;
 
- use Prettus\Repository\Eloquent\BaseRepository;
 
- class JobfairCompanyRepository extends BaseRepository
 
- {
 
-     public function model()
 
-     {
 
-         return JobfairCompany::class;
 
-     }
 
-     public function findPositionCount($positionArr)
 
-     {
 
-         return $this->model->whereIn('position_id', $positionArr)->get();
 
-     }
 
-     public function getJobfair($com_id)
 
-     {
 
-         return $this->model->with(['jobfair'=>function ($query) {
 
-             $query->where([['holddate_end', '>', time()]]);
 
-         }])->whereHas('jobfair',function ($query){
 
-             $query->where([['holddate_end', '>', time()]]);
 
-         })->where(['company_id'=>$com_id])->where('audit','<>',3)->get();
 
-     }
 
-     public function findList($com_id)
 
-     {
 
-         return $this->model->whereHas('jobfair')->where(['company_id'=>$com_id])->orderby('created_at', 'desc')->paginate(10);
 
-     }
 
-     public function findCompany($where, $offset = 0, $limit = 10)
 
-     {
 
-         return $this->model->webJoinFloorplanStand()->whereHas('companys')->with(['jobfair'=>function ($query) {
 
-             $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);
 
-         },'companys','jobfairPutJob'])
 
-             ->selectRaw('jobfair_companys.*')
 
-             ->where($where)
 
-             ->offset($limit*$offset)
 
-             ->limit($limit)
 
- //            ->groupBy('company_id')
 
-             ->orderByRaw('jobfair_floorplan_stands.sortindex')
 
-             ->get();
 
-     }
 
-     public function findCompany2($where)
 
-     {
 
-         return $this->model->webJoinFloorplanStand()->with(['jobfair'=>function ($query) {
 
-             $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);
 
-         },'companys'])
 
-             ->selectRaw('jobfair_companys.*')
 
-             ->where($where)
 
- //            ->groupBy('company_id')
 
-             ->orderByRaw('jobfair_floorplan_stands.sortindex')
 
-             ->paginate(20);
 
-     }
 
-     public function aioFindCompany($where, $page)
 
-     {
 
-         return $this->model->with(['jobfair'=>function ($query) {
 
-             $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);
 
-         }])->whereHas('companys')->selectRaw('*,group_concat(position) as position_arr,group_concat(id) as id_arr')->where($where)->groupBy('company_id')->paginate($page);
 
-     }
 
-     public function findCom($where)
 
-     {
 
-         return $this->model->with(['companys','jobfairPutJob'=>function($query){
 
-             $query->with('jobs');
 
-         }])->where($where)->first();
 
-     }
 
-     public function findComApi($where)
 
-     {
 
-         return $this->model->with(['companys'=>function($query){
 
-             $query->select('id','companyname','short_name','address');
 
-         },'jobfairPutJob'=>function($query){
 
-             $query->with('jobs');
 
-         }])->where($where)->first();
 
-     }
 
-     public function findOneCom($where)
 
-     {
 
-         return $this->model->with(['companys','jobfairPutJob'=>function($query){
 
-             $query->with('jobs');
 
-         }])->where($where)->selectRaw('*,group_concat(position) as position_arr,group_concat(id) as id_arr')->groupBy('company_id')->first();
 
-     }
 
-     public function getComList($where)
 
-     {
 
-         return $this->model->where($where)->select(['company_id'])->groupBy('company_id')->get();
 
-     }
 
-     /**
 
-      * @param $where
 
-      * @param $keyinput
 
-      * @return mixed
 
-      */
 
-     public function findJob($where)
 
-     {
 
-         return $this->model->with(['jobfair'=>function ($query) {
 
-             $query->where('showendtime', '>=', time())->orWhere('showendtime', 0);
 
-         }])->with('companys')->where($where)->get();
 
-     }
 
-     public function getManyBlackCompany()
 
-     {
 
-         return $this->model->whereHas('jobfair', function ($query) {
 
-             $query->where('holddate_end', '<', time());
 
-         })->where('audit', 1)->whereIn('type', [1,2,3])->where('black_status', 0)
 
-             ->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-30 days')))
 
-             ->selectRaw('count(*) as count,company_id')->groupBy('company_id')->get();
 
-     }
 
-     public function getBlacklistCompany()
 
-     {
 
-         return $this->model->whereHas('jobfair', function ($query) {
 
-             $query->where('holddate_end', '<', time());
 
-         })->where('type', 0)->where('black_status', 0)->where('audit', 1)
 
-             ->where('created_at', '>', date('Y-m-d H:i:s', strtotime('-30 days')))->get();
 
-     }
 
-     public function getComCount($jobfair_id)
 
-     {
 
-         return $this->model->with('jobfair')->where(['jobfair_id'=>$jobfair_id,'audit'=>1])->groupBy('company_id')->get();
 
-     }
 
-     public function getCounts($jobfair_id)
 
-     {
 
-         return $this->model->where(['jobfair_id'=>$jobfair_id,'audit'=>1])->count();
 
-     }
 
-     public function getOne($where)
 
-     {
 
-         return $this->model->with('jobfair')->where($where)->first();
 
-     }
 
-     public function updateInfo($where,$data)
 
-     {
 
-         return $this->model->where($where)->update($data);
 
-     }
 
-     //手机端下滑分页
 
-     public function getComPage($where,$limit,$page){
 
-         return $this->model->with('companys')->where($where)
 
-             ->selectRaw('*,group_concat(position) as position_arr')
 
-             ->where($where)
 
-             ->groupBy('company_id')
 
-             ->paginate($limit,['*'],'page',$page);
 
-     }
 
-     public function getCount($where, $subsite_id)
 
-     {
 
-         return $this->model->when($subsite_id,function ($query) use($subsite_id) {
 
-             $query->whereHas('jobfair', function ($query) use($subsite_id) {
 
-                 $query->where($subsite_id);
 
-             });
 
-         })->where($where)->count();
 
-     }
 
-     /**
 
-      * 根据条件删除
 
-      * @param $where
 
-      * @return mixed
 
-      */
 
-     public function delJobs($column, $ids)
 
-     {
 
-         return $this->model->whereIn($column, $ids)->delete();
 
-     }
 
-     public function getStatisticsCompanyCount($where, $whereIn = array())
 
-     {
 
-         $res = $this->model->where($where);
 
-         if ($whereIn) {
 
-             foreach ($whereIn as $k => $v) {
 
-                 $res->whereIn($k, $v);
 
-             }
 
-         }
 
-         return $res->count();
 
-     }
 
-     public function findListOption($com_id)
 
-     {
 
-         return $this->model->whereHas('jobfair')->where(['company_id'=>$com_id])->groupBy('jobfair_id')->orderby('created_at', 'desc')->get();
 
-     }
 
-     public function getCrmJobfairExhibitors($where, $whereIn = [], $order_by = '', $offset = '', $limit = '')
 
-     {
 
-         $rst = $this->model->with(['jobfair','jobfairPutJob','jobfairFloorPlanStands', 'companys'])->where($where);
 
-         if ($whereIn) {
 
-             foreach ($whereIn as $k => $v) {
 
-                 $rst->whereIn($k, $v);
 
-             }
 
-         }
 
-         if ($order_by) {
 
-             $rst->orderByRaw($order_by);
 
-         }
 
-         if ($offset !='' && $limit!='') {
 
-             $rst->offset($offset)->limit($limit);
 
-         };
 
-         return $rst->get();
 
-     }
 
-     public function getCrmExhibitorNum($where, $whereIn)
 
-     {
 
-         $rst = $this->model->where($where);
 
-         if ($whereIn) {
 
-             foreach ($whereIn as $k => $v) {
 
-                 $rst->whereIn($k, $v);
 
-             }
 
-         }
 
-         return $rst->count();
 
-     }
 
-     public function getValue($where,$column)
 
-     {
 
-         return $this->model->where($where)->value($column);
 
-     }
 
-     public function getPluck($where,$column)
 
-     {
 
-         return $this->model->where($where)->pluck($column);
 
-     }
 
-     public function getJobfaitCompany($where)
 
-     {
 
-         return $this->model->where($where)->get();
 
-     }
 
- }
 
 
  |