作者 何书鹏
1 个管道 的构建 通过 耗费 37 秒

求职招聘删除

... ... @@ -3,7 +3,9 @@
namespace app\admin\controller\mobile;
use app\common\controller\Backend;
use Exception;
use think\Db;
use think\exception\PDOException;
/**
* 企业招聘管理
... ... @@ -120,4 +122,42 @@ class CompanyJob extends Backend
$this->success('审核成功');
}
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
// 删除投递简历
Db::name('mobile_company_job_resume')->where('company_job_id',$v['id'])->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}
... ...
... ... @@ -3,7 +3,9 @@
namespace app\admin\controller\mobile\userjob;
use app\common\controller\Backend;
use Exception;
use think\Db;
use think\exception\PDOException;
/**
* 求职管理
... ... @@ -120,4 +122,42 @@ class UserJob extends Backend
$this->success('审核成功');
}
}
/**
* 删除
*/
public function del($ids = "")
{
if ($ids) {
$pk = $this->model->getPk();
$adminIds = $this->getDataLimitAdminIds();
if (is_array($adminIds)) {
$this->model->where($this->dataLimitField, 'in', $adminIds);
}
$list = $this->model->where($pk, 'in', $ids)->select();
$count = 0;
Db::startTrans();
try {
foreach ($list as $k => $v) {
// 删除求职下载
Db::name('mobile_user_job_download')->where('user_job_id',$v['id'])->delete();
$count += $v->delete();
}
Db::commit();
} catch (PDOException $e) {
Db::rollback();
$this->error($e->getMessage());
} catch (Exception $e) {
Db::rollback();
$this->error($e->getMessage());
}
if ($count) {
$this->success();
} else {
$this->error(__('No rows were deleted'));
}
}
$this->error(__('Parameter %s can not be empty', 'ids'));
}
}
... ...
... ... @@ -22,7 +22,7 @@
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="false"
data-operate-del="false"
data-operate-del="{:$auth->check('mobile/company_job/del')}"
width="100%">
</table>
</div>
... ...
... ... @@ -22,7 +22,7 @@
</div>
<table id="table" class="table table-striped table-bordered table-hover table-nowrap"
data-operate-edit="false"
data-operate-del="false"
data-operate-del="{:$auth->check('mobile/userjob/user_job/del')}"
width="100%">
</table>
</div>
... ...