正在显示
4 个修改的文件
包含
82 行增加
和
2 行删除
@@ -3,7 +3,9 @@ | @@ -3,7 +3,9 @@ | ||
3 | namespace app\admin\controller\mobile; | 3 | namespace app\admin\controller\mobile; |
4 | 4 | ||
5 | use app\common\controller\Backend; | 5 | use app\common\controller\Backend; |
6 | +use Exception; | ||
6 | use think\Db; | 7 | use think\Db; |
8 | +use think\exception\PDOException; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * 企业招聘管理 | 11 | * 企业招聘管理 |
@@ -120,4 +122,42 @@ class CompanyJob extends Backend | @@ -120,4 +122,42 @@ class CompanyJob extends Backend | ||
120 | $this->success('审核成功'); | 122 | $this->success('审核成功'); |
121 | } | 123 | } |
122 | } | 124 | } |
125 | + | ||
126 | + /** | ||
127 | + * 删除 | ||
128 | + */ | ||
129 | + public function del($ids = "") | ||
130 | + { | ||
131 | + if ($ids) { | ||
132 | + $pk = $this->model->getPk(); | ||
133 | + $adminIds = $this->getDataLimitAdminIds(); | ||
134 | + if (is_array($adminIds)) { | ||
135 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
136 | + } | ||
137 | + $list = $this->model->where($pk, 'in', $ids)->select(); | ||
138 | + | ||
139 | + $count = 0; | ||
140 | + Db::startTrans(); | ||
141 | + try { | ||
142 | + foreach ($list as $k => $v) { | ||
143 | + // 删除投递简历 | ||
144 | + Db::name('mobile_company_job_resume')->where('company_job_id',$v['id'])->delete(); | ||
145 | + $count += $v->delete(); | ||
146 | + } | ||
147 | + Db::commit(); | ||
148 | + } catch (PDOException $e) { | ||
149 | + Db::rollback(); | ||
150 | + $this->error($e->getMessage()); | ||
151 | + } catch (Exception $e) { | ||
152 | + Db::rollback(); | ||
153 | + $this->error($e->getMessage()); | ||
154 | + } | ||
155 | + if ($count) { | ||
156 | + $this->success(); | ||
157 | + } else { | ||
158 | + $this->error(__('No rows were deleted')); | ||
159 | + } | ||
160 | + } | ||
161 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
162 | + } | ||
123 | } | 163 | } |
@@ -3,7 +3,9 @@ | @@ -3,7 +3,9 @@ | ||
3 | namespace app\admin\controller\mobile\userjob; | 3 | namespace app\admin\controller\mobile\userjob; |
4 | 4 | ||
5 | use app\common\controller\Backend; | 5 | use app\common\controller\Backend; |
6 | +use Exception; | ||
6 | use think\Db; | 7 | use think\Db; |
8 | +use think\exception\PDOException; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * 求职管理 | 11 | * 求职管理 |
@@ -120,4 +122,42 @@ class UserJob extends Backend | @@ -120,4 +122,42 @@ class UserJob extends Backend | ||
120 | $this->success('审核成功'); | 122 | $this->success('审核成功'); |
121 | } | 123 | } |
122 | } | 124 | } |
125 | + | ||
126 | + /** | ||
127 | + * 删除 | ||
128 | + */ | ||
129 | + public function del($ids = "") | ||
130 | + { | ||
131 | + if ($ids) { | ||
132 | + $pk = $this->model->getPk(); | ||
133 | + $adminIds = $this->getDataLimitAdminIds(); | ||
134 | + if (is_array($adminIds)) { | ||
135 | + $this->model->where($this->dataLimitField, 'in', $adminIds); | ||
136 | + } | ||
137 | + $list = $this->model->where($pk, 'in', $ids)->select(); | ||
138 | + | ||
139 | + $count = 0; | ||
140 | + Db::startTrans(); | ||
141 | + try { | ||
142 | + foreach ($list as $k => $v) { | ||
143 | + // 删除求职下载 | ||
144 | + Db::name('mobile_user_job_download')->where('user_job_id',$v['id'])->delete(); | ||
145 | + $count += $v->delete(); | ||
146 | + } | ||
147 | + Db::commit(); | ||
148 | + } catch (PDOException $e) { | ||
149 | + Db::rollback(); | ||
150 | + $this->error($e->getMessage()); | ||
151 | + } catch (Exception $e) { | ||
152 | + Db::rollback(); | ||
153 | + $this->error($e->getMessage()); | ||
154 | + } | ||
155 | + if ($count) { | ||
156 | + $this->success(); | ||
157 | + } else { | ||
158 | + $this->error(__('No rows were deleted')); | ||
159 | + } | ||
160 | + } | ||
161 | + $this->error(__('Parameter %s can not be empty', 'ids')); | ||
162 | + } | ||
123 | } | 163 | } |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | </div> | 22 | </div> |
23 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | 23 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" |
24 | data-operate-edit="false" | 24 | data-operate-edit="false" |
25 | - data-operate-del="false" | 25 | + data-operate-del="{:$auth->check('mobile/company_job/del')}" |
26 | width="100%"> | 26 | width="100%"> |
27 | </table> | 27 | </table> |
28 | </div> | 28 | </div> |
@@ -22,7 +22,7 @@ | @@ -22,7 +22,7 @@ | ||
22 | </div> | 22 | </div> |
23 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" | 23 | <table id="table" class="table table-striped table-bordered table-hover table-nowrap" |
24 | data-operate-edit="false" | 24 | data-operate-edit="false" |
25 | - data-operate-del="false" | 25 | + data-operate-del="{:$auth->check('mobile/userjob/user_job/del')}" |
26 | width="100%"> | 26 | width="100%"> |
27 | </table> | 27 | </table> |
28 | </div> | 28 | </div> |
-
请 注册 或 登录 后发表评论