fetch(); } /* * 获取列表 * @param int page * @param int limit * */ public function get_system_user_list() { $where = UtilService::getMore([ ['page', 1], ['limit', 20], ['is_auth', 0] ]); return JsonService::successlayui(UserModel::lists($where)); } //推荐企业 public static function isput($id, $type) { $res1 = UserModel::where(['id' => $id])->find(); $a = 1; if ($res1[$type] == 1) { $a = 0; } $res = UserModel::where(['id' => $id])->update([$type => $a]); if ($type == 'is_dle') { // 查找该企业下的文章进行删除 $wz = Article::where('mer_id', $id)->update(['status' => 0]); // 冻结后台登录权限 $st = SystemAdmin::where('mer_id', $id)->update(['status' => 0]); } if ($res) { return JsonService::successful('成功'); } else { return JsonService::fail('失败'); } return JsonService::fail('参数错误!'); } /** * 添加第三方企业 * */ public function create() { $cid = $this->request->param('cid'); $all = []; $select = 0; if ($cid && in_array($cid, \app\admin\model\article\ArticleCategory::getArticleCategoryInfo(0, 'id'))) { $all = ArticleCategoryModel::getArticleCategoryInfo($cid); $select = 1; } if (!$select) { $list = ArticleCategoryModel::getTierLists(); foreach ($list as $menu) { $all[$menu['id']] = $menu['html'] . $menu['title']; } } $a = []; $list = User::select(); foreach ($list as $menu) { $a[$menu['uid']] = $menu['nickname']; } $this->assign('all', $all); $this->assign('uid', $a); $this->assign('cid', $cid); $this->assign('select', $select); $this->assign('jobList', app('JobLogic')->getList([])); return $this->fetch(); } /** * 保存第三方企业 * */ public function add_mer() { $data = Util::postMore([ 'name', 'contacts', 'post', 'phone', 'password', 'introduce', 'contacts', ['uid', 0], 'headimg', ['type', 0], ['is_auth', 1], ['is_third', 1], ['is_put', 0], ['reason', "审核中"], ]); if (!empty($data['post'])) { $arr = explode(',', $data['post']); $data['post'] = $arr[1]; $data['post_id'] = $arr[0]; } $data['password'] = md5($data['password']); $data['user'] = $data['phone']; // $data['type'] = $data['cid']; // 查询该用户是否绑定其他企业 $mer = UserModel::where(['uid' => $data['uid']])->count(); $findUser = User::get($data['uid']); if (empty($findUser)) { return JsonService::fail('找不到用户'); } if ($mer > 0 || !empty($findUser['mer_id'])) { return JsonService::fail('该用户已绑定其他企业!请重新选择'); } $res = UserModel::insert($data); if ($res) { return Json::successful('添加成功!'); } return JsonService::fail('添加失败!'); } public function employeList($mer_id) { $this->assign('mer_id', $mer_id); return $this->fetch('employe'); } public function delEmploye($uid) { $updateUser = []; $updateUser['mer_id'] = ''; if (!User::edit($updateUser, $uid)) { return Json::fail('删除失败!'); } return Json::successful('删除成功!'); } public function employeData() { $where = UtilService::getMore([ ['page', 1], ['limit', 20], ['audit_status', -1], ['apply_user_name', ''], ['mer_id', ''], ]); return app('ApplyLogic')->getEmployeeList($where); } }