123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <?php
- namespace app\web\controller;
- use app\common\model\WorkerThird;
- use app\common\model\Comjobs as ComjobsModel;
- use app\common\model\Worker as WorkerModel;
- use echowx\WxProgram;
- class Active
- {
- public function aiRecruit()
- {
- $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 = ['status' => 'asc', 'updatetime' => 'desc', 'id' => 'desc'];
- $plist = ComjobsModel::with(['worker', 'comjobsCate'])->where($map)->where(function ($q) use ($whereor) {
- $q->whereOr($whereor);
- })->order($orderby)->select();
- //数据处理
- //第三方id
- $third_ids = [];
- $third_lists = [];
- foreach ($plist as $l) {
- if (!empty($l['third_id'])) {
- $third_ids[] = $l['third_id'];
- }
- }
- if (!empty($third_ids)) {
- $third_lists = WorkerThird::where('id', 'in', $third_ids)->column('*', 'id');
- }
- $plist = $plist->toArray();
- foreach ($plist as $k => $v) {
- if (!empty($v['third_id'])) {
- $plist[$k]['worker']['title'] = $third_lists[$v['third_id']]['name'];
- }
- }
- $res = $this->_split_arr($plist, 4);
- return view('active/ai_recruit', ['res' => $res]);
- }
- private function _split_arr($arr, $num)
- {
- $res = [];
- $item = [];
- foreach ($arr as $k => $v) {
- if ($k % $num == 0 && $k != 0) {
- $res[] = $item;
- $item = [];
- }
- $item[] = $v;
- }
- if (!empty($item)) {
- $res[] = $item;
- }
- return $res;
- }
- public function qrcode()
- {
- $id = input('id');
- $userid = 0;
- $info = ComjobsModel::where('id', $id)->find();
- if (empty($info)) {
- return '';
- }
- $filename = $id . "_" . $userid . ".jpg";
- $dst_comjobspic = root_path("public/attachment/comjobspic") . $filename;
- if (!file_exists($dst_comjobspic)) {
- $wxprogram = new WxProgram();
- $wxprogram->wxacode_get_unlimited($id . "&" . $userid, "pages/comjobs/detail", 430, "attachment/comjobspic/" . $id . "_" . $userid . ".jpg");
- }
- header("Content-type: image/jpeg");
- $im = @imagecreatefromjpeg($dst_comjobspic);
- imagejpeg($im);
- }
- }
-
|