|
@@ -0,0 +1,1163 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\admin\controller;
|
|
|
+
|
|
|
+use app\common\model\RensheCode;
|
|
|
+use app\common\model\UserTags;
|
|
|
+use app\common\model\UserWill;
|
|
|
+use app\admin\BaseController;
|
|
|
+use app\common\model\User as UserModel;
|
|
|
+use app\common\model\UserAuths as UserAuthsModel;
|
|
|
+use app\common\model\UserFollow as UserFollowModel;
|
|
|
+use app\common\model\UserGroups as UserGroupsModel;
|
|
|
+use app\common\model\UserPart as UserPartModel;
|
|
|
+use app\common\model\UserIntegral as UserIntegralModel;
|
|
|
+use app\common\model\UserRank as UserRankModel;
|
|
|
+use app\common\model\UserParam as UserParamModel;
|
|
|
+use app\common\model\ComjobsCate as ComjobsCateModel;
|
|
|
+
|
|
|
+use app\common\model\Agent as AgentModel;
|
|
|
+use app\common\model\Broker as BrokerModel;
|
|
|
+
|
|
|
+use app\common\service\IntegralService;
|
|
|
+use app\common\service\UserService;
|
|
|
+use app\common\validate\User as UserValidate;
|
|
|
+use think\exception\ValidateException;
|
|
|
+
|
|
|
+class User extends BaseController
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+ // 用户跟进记录
|
|
|
+ public function follow()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d');
|
|
|
+ $user = UserModel::findOrEmpty($userid);
|
|
|
+ $followlist = UserFollowModel::where('userid', $userid)->order('id', 'desc')->limit(100)->select();
|
|
|
+ return view('user/follow', [
|
|
|
+ 'user' => $user,
|
|
|
+ 'followlist' => $followlist,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editFollow()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d', 0);
|
|
|
+ $user = UserModel::findOrEmpty($userid);
|
|
|
+ if ($user->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "用户信息不存在。",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ UserFollowModel::create([
|
|
|
+ 'userid' => $userid,
|
|
|
+ 'ftype' => input('ftype/s', ""),
|
|
|
+ 'remark' => input('remark/s', ""),
|
|
|
+ 'createtime' => time(),
|
|
|
+ ]);
|
|
|
+ $followstatus = input('followstatus/d', 1);
|
|
|
+ $user->save([
|
|
|
+ 'followstatus' => $followstatus,
|
|
|
+ ]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 邀请排行榜
|
|
|
+ public function rankList()
|
|
|
+ {
|
|
|
+ return view('user/ranklist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function rankForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $rank = UserRankModel::findOrEmpty($id);
|
|
|
+ return view('user/rankform', [
|
|
|
+ 'rank' => $rank,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editRank()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $rank = UserRankModel::findOrEmpty($id);
|
|
|
+ $rank->save([
|
|
|
+ 'realname' => input('realname/s'),
|
|
|
+ 'mobile' => input('mobile/s'),
|
|
|
+ 'partnumber' => input('partnumber/d', 0),
|
|
|
+ ]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function fieldRank()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $rank = UserRankModel::findOrEmpty($id);
|
|
|
+ if ($rank->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "信息不存在",
|
|
|
+ ]));
|
|
|
+ } else {
|
|
|
+ $rank->save([
|
|
|
+ input('field/s') => input('value'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listRank()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $map = [];
|
|
|
+ $list = UserRankModel::where($map)->order('partnumber', 'desc')->limit($limit)->page($page)->select();
|
|
|
+ $count = UserRankModel::where($map)->count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delRank()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserRankModel::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 邀请记录
|
|
|
+ public function partList()
|
|
|
+ {
|
|
|
+ return view('user/partlist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listPart()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s', "");
|
|
|
+ $status = input('status/d', 0);
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['UserPart.status', '=', $status];
|
|
|
+ }
|
|
|
+ $list = UserPartModel::hasWhere('puser', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->with(['puser', 'user'])->where($map)->order('id', 'desc')->limit($limit)->page($page)->append(['status_text'])->select();
|
|
|
+ $count = UserPartModel::hasWhere('puser', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->where($map)->count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function exportPart()
|
|
|
+ {
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s', "");
|
|
|
+ $status = input('status/d', 0);
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['UserPart.status', '=', $status];
|
|
|
+ }
|
|
|
+ $xlsData = UserPartModel::hasWhere('puser', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->with(['puser', 'user'])->where($map)->order('id', 'desc')->select()->toArray();
|
|
|
+ $xlsCell = [
|
|
|
+ ['id', '表ID'],
|
|
|
+ ['puser.nickname', '邀请人昵称'],
|
|
|
+ ['puser.realname', '邀请人姓名'],
|
|
|
+ ['puser.mobile', '邀请人手机号'],
|
|
|
+ ['puser.bankcard.openbank', '邀请人开户行'],
|
|
|
+ ['puser.bankcard.account', '邀请人帐户名'],
|
|
|
+ ['puser.bankcard.number', '邀请人账户号'],
|
|
|
+ ['user.nickname', '被邀请人昵称'],
|
|
|
+ ['user.realname', '被邀请人姓名'],
|
|
|
+ ['user.mobile', '被邀请人手机号'],
|
|
|
+ ['status', '状态', [1 => '未入职', 2 => '已入职', 3 => '已发放']],
|
|
|
+ ['redmoney', '奖金金额'],
|
|
|
+ ['createtime', '推荐时间'],
|
|
|
+ ];
|
|
|
+ export_excel("系统用户", $xlsCell, $xlsData);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function fieldPart()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $part = UserPartModel::findOrEmpty($id);
|
|
|
+ if ($part->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "信息不存在",
|
|
|
+ ]));
|
|
|
+ } else {
|
|
|
+ $part->save([
|
|
|
+ input('field/s') => input('value'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function partForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $part = UserPartModel::with(['puser', 'user'])->findOrEmpty($id);
|
|
|
+ return view('user/partform', [
|
|
|
+ 'part' => $part,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editPart()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $part = UserPartModel::findOrEmpty($id);
|
|
|
+ $part->save([
|
|
|
+ 'status' => input('status/d', 1),
|
|
|
+ 'redmoney' => input('redmoney/d', 0),
|
|
|
+ ]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delPart()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserPartModel::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户积分
|
|
|
+ public function integralList()
|
|
|
+ {
|
|
|
+ return view('user/integrallist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listIntegral()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s', "");
|
|
|
+ $itype = input('itype/d', 0);
|
|
|
+ if (!empty($itype)) {
|
|
|
+ $map[] = ['itype', '=', $itype];
|
|
|
+ }
|
|
|
+ $status = input('status/d', 0);
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['status', '=', $status];
|
|
|
+ }
|
|
|
+ $list = UserIntegralModel::hasWhere('user', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->with(['user'])->where($map)->order('id', 'desc')->limit($limit)->page($page)->select()->append(['itype_text', 'status_text']);
|
|
|
+ $count = UserIntegralModel::hasWhere('user', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->where($map)->count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function exportIntegral()
|
|
|
+ {
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s', "");
|
|
|
+ $itype = input('itype/d', 0);
|
|
|
+ if (!empty($itype)) {
|
|
|
+ $map[] = ['itype', '=', $itype];
|
|
|
+ }
|
|
|
+ $xlsData = UserIntegralModel::hasWhere('user', [['realname|mobile', 'like', '%' . $keywords . '%', 'or']])->with(['user'])->where($map)->order('id', 'desc')->select()->append(['itype_text', 'status_text'])->toArray();
|
|
|
+ $xlsCell = [
|
|
|
+ ['id', '表ID'],
|
|
|
+ ['user.nickname', '昵称'],
|
|
|
+ ['user.realname', '姓名'],
|
|
|
+ ['user.mobile', '手机号'],
|
|
|
+ ['user.bankcard.openbank', '开户行'],
|
|
|
+ ['user.bankcard.account', '帐户名'],
|
|
|
+ ['user.bankcard.number', '账户号'],
|
|
|
+ ['title', '积分标题'],
|
|
|
+ ['itype_text', '类型'],
|
|
|
+ ['status_text', '状态'],
|
|
|
+ ['intvalue', '积分变更值'],
|
|
|
+ ['intmoney', '积分金额'],
|
|
|
+ ['remark', '备注'],
|
|
|
+ ['createtime', '注册时间'],
|
|
|
+ ];
|
|
|
+ export_excel("用户积分", $xlsCell, $xlsData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public function fieldIntegral()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $integral = UserIntegralModel::findOrEmpty($id);
|
|
|
+ if ($integral->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "信息不存在",
|
|
|
+ ]));
|
|
|
+ } else {
|
|
|
+ $integral->save([
|
|
|
+ input('field/s') => input('value'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function integralUpdate()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $integral = UserIntegralModel::with('user')->findOrEmpty($id);
|
|
|
+ return view('user/integralupdate', [
|
|
|
+ 'integral' => $integral,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function updateIntegral()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $integral = UserIntegralModel::findOrEmpty($id);
|
|
|
+ if ($integral->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "用户积分记录不存在",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ $createtime = input('createtime/s', date("Y-m-d H:i:s"));
|
|
|
+ $integral->save([
|
|
|
+ 'title' => input('title/s', ""),
|
|
|
+ 'intvalue' => input('intvalue/d', 0),
|
|
|
+ 'intmoney' => input('intmoney/f', 0.00),
|
|
|
+ 'remark' => input('remark/s', ""),
|
|
|
+ 'itype' => input('itype/d', 1),
|
|
|
+ 'status' => input('status/d', 1),
|
|
|
+ 'createtime' => $createtime,
|
|
|
+ 'yeartime' => date("Y", strtotime($createtime)),
|
|
|
+ 'monthtime' => date("Ym", strtotime($createtime)),
|
|
|
+ ]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function statusIntegral()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $integral = UserIntegralModel::where(['itype' => 3])->find($id);
|
|
|
+ if ($integral == null) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "该记录非兑现类型",
|
|
|
+ ]));
|
|
|
+ } elseif ($integral->status == 1) {
|
|
|
+ $integral->save([
|
|
|
+ 'status' => 2,
|
|
|
+ ]);
|
|
|
+ } elseif ($integral->status == 2) {
|
|
|
+ $integral->save([
|
|
|
+ 'status' => 1,
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "该记录非兑现类型。",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function statusIntegralAll()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserIntegralModel::update(['status' => 2], ['status' => 1, 'itype' => 3, 'id' => $idarr]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delIntegral()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserIntegralModel::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function integralForm()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d');
|
|
|
+ $user = UserModel::findOrEmpty($userid);
|
|
|
+ return view('user/integralform', [
|
|
|
+ 'user' => $user,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editIntegral()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d');
|
|
|
+ $user = UserModel::findOrEmpty($userid);
|
|
|
+ $intvalue = input('intvalue/d', 0);
|
|
|
+ if ($intvalue == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "积分变更值不能为0",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ $data = [
|
|
|
+ 'userid' => $userid,
|
|
|
+ 'title' => input('title/s'),
|
|
|
+ 'intvalue' => $intvalue,
|
|
|
+ 'intmoney' => input('intmoney/s', 0.00),
|
|
|
+ 'onlycontent' => "",
|
|
|
+ 'remark' => input('remark/s'),
|
|
|
+ 'itype' => input('itype/d'),
|
|
|
+ 'status' => 2,
|
|
|
+ 'createtime' => input('createtime/s'),
|
|
|
+ 'yeartime' => date("Y"),
|
|
|
+ 'monthtime' => date("Ym"),
|
|
|
+ ];
|
|
|
+ UserIntegralModel::create($data);
|
|
|
+ $udata = [];
|
|
|
+ $udata['integral'] = intval($user->integral) + $intvalue;
|
|
|
+ $isinttotal = input('isinttotal/d', 0);
|
|
|
+ if ($isinttotal == 1) {
|
|
|
+ $udata['inttotal'] = intval($user->inttotal) + $intvalue;
|
|
|
+ }
|
|
|
+ $user->save($udata);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户授权
|
|
|
+ public function authsList()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d');
|
|
|
+ return view('user/authslist', [
|
|
|
+ 'userid' => $userid,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listAuths()
|
|
|
+ {
|
|
|
+ $userid = input('userid/d');
|
|
|
+ $list = UserAuthsModel::where('userid', $userid)->order('id', 'asc')->append(['identitytype_text'])->select();
|
|
|
+ $count = UserAuthsModel::where('userid', $userid)->count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delAuths()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $auths = UserAuthsModel::find($id);
|
|
|
+ if ($auths->identitytype == 'mobile') {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "手机号授权方式不允许删除",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ $result = $auths->delete();
|
|
|
+ if ($result) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "删除失败,请稍后重试",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户
|
|
|
+ public function userPublic()
|
|
|
+ {
|
|
|
+ $groupslist = UserGroupsModel::order(['isdefault' => 'desc', 'id' => 'asc'])->select();
|
|
|
+ $agentlist = AgentModel::with('broker')->order(['id' => 'desc'])->select();
|
|
|
+ return view('user/userpublic', [
|
|
|
+ 'groupslist' => $groupslist,
|
|
|
+ 'agentlist' => $agentlist,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function userList()
|
|
|
+ {
|
|
|
+ $groupslist = UserGroupsModel::order(['isdefault' => 'desc', 'id' => 'asc'])->select();
|
|
|
+ $agentlist = AgentModel::with('broker')->order(['id' => 'desc'])->select();
|
|
|
+ return view('user/userlist', [
|
|
|
+ 'groupslist' => $groupslist,
|
|
|
+ 'agentlist' => $agentlist,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function userForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $user = UserModel::with(['broker'])->findOrEmpty($id);
|
|
|
+ $agentlist = AgentModel::with('broker')->order(['id' => 'asc'])->select();
|
|
|
+ $groupslist = UserGroupsModel::order(['isdefault' => 'desc', 'id' => 'asc'])->select();
|
|
|
+ $willlist = UserWill::select();
|
|
|
+ $usertags = UserTags::select();
|
|
|
+ $emptimelist = RensheCode::getList('emp_time');
|
|
|
+ $communitylist = RensheCode::getList('community')->toArray();
|
|
|
+ array_push($communitylist, ['code' => 0, 'id' => 0, 'name' => "不限"]);
|
|
|
+ $comlist = ComjobsCateModel::select();
|
|
|
+ return view('user/userform', [
|
|
|
+ 'groupslist' => $groupslist,
|
|
|
+ 'willlist' => $willlist,
|
|
|
+ 'usertags' => $usertags,
|
|
|
+ 'agentlist' => $agentlist,
|
|
|
+ 'user' => $user,
|
|
|
+ 'emptimelist' => $emptimelist,
|
|
|
+ 'communitylist' => $communitylist,
|
|
|
+ 'comlist' => $comlist,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function fieldUser()
|
|
|
+ {
|
|
|
+ $id = input('id/d', 0);
|
|
|
+ $user = UserModel::findOrEmpty($id);
|
|
|
+ if ($user->isEmpty()) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "信息不存在",
|
|
|
+ ]));
|
|
|
+ } else {
|
|
|
+ $user->save([
|
|
|
+ input('field/s') => input('value'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listUser()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s');
|
|
|
+ if (!empty($keywords)) {
|
|
|
+ $map[] = ['nickname|realname|mobile', 'like', '%' . $keywords . '%', 'or'];
|
|
|
+ }
|
|
|
+ $groupsid = input('groupsid/d');
|
|
|
+ if (!empty($groupsid)) {
|
|
|
+ $map[] = ['groupsid', '=', $groupsid];
|
|
|
+ }
|
|
|
+ $ispublic = input('ispublic/d', 0);
|
|
|
+ if ($ispublic == 0) {
|
|
|
+ $agentbrokerarr = explode(",", input('agentbroker/s'));
|
|
|
+ $agentid = isset($agentbrokerarr[0]) ? $agentbrokerarr[0] : 0;
|
|
|
+ if (!empty($agentid)) {
|
|
|
+ $brokeridarr = BrokerModel::where('agentid', '=', $agentid)->column('id');
|
|
|
+ $map[] = ['brokerid', 'in', $brokeridarr];
|
|
|
+ $map[] = ['brokerid', '<>', 0];
|
|
|
+ }
|
|
|
+ $brokerid = isset($agentbrokerarr[1]) ? $agentbrokerarr[1] : 0;
|
|
|
+ if (!empty($brokerid)) {
|
|
|
+ $map[] = ['brokerid', '=', $brokerid];
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $map[] = ['brokerid', '=', 0];
|
|
|
+ }
|
|
|
+ $status = input('status/d');
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['status', '=', $status];
|
|
|
+ }
|
|
|
+ $authstatus = input('authstatus/d');
|
|
|
+ if (!empty($authstatus)) {
|
|
|
+ $map[] = ['authstatus', '=', $authstatus];
|
|
|
+ }
|
|
|
+ $followstatus = input('followstatus/d');
|
|
|
+ if (!empty($followstatus)) {
|
|
|
+ $map[] = ['followstatus', '=', $followstatus];
|
|
|
+ }
|
|
|
+ $list = UserModel::with(['userGroups', 'broker' => ['agent', 'worker']])->withCount('userPart')->where($map)->order('id', 'desc')->limit($limit)->page($page)->append(['status_text', 'isvip_text', 'authstatus_text', 'followstatus_text', 'education_text', 'worker_text', 'jobintention_text'])->select();
|
|
|
+ $count = UserModel::where($map)->count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function exportUser()
|
|
|
+ {
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s');
|
|
|
+ if (!empty($keywords)) {
|
|
|
+ $map[] = ['nickname|realname|mobile', 'like', '%' . $keywords . '%', 'or'];
|
|
|
+ }
|
|
|
+ $groupsid = input('groupsid/d');
|
|
|
+ if (!empty($groupsid)) {
|
|
|
+ $map[] = ['groupsid', '=', $groupsid];
|
|
|
+ }
|
|
|
+ $agentbrokerarr = explode(",", input('agentbroker/s'));
|
|
|
+ $agentid = isset($agentbrokerarr[0]) ? $agentbrokerarr[0] : 0;
|
|
|
+ if (!empty($agentid)) {
|
|
|
+ $brokeridarr = BrokerModel::where('agentid', '=', $agentid)->column('id');
|
|
|
+ $map[] = ['brokerid', 'in', $brokeridarr];
|
|
|
+ $map[] = ['brokerid', '<>', 0];
|
|
|
+ }
|
|
|
+ $brokerid = isset($agentbrokerarr[1]) ? $agentbrokerarr[1] : 0;
|
|
|
+ if (!empty($brokerid)) {
|
|
|
+ $map[] = ['brokerid', '=', $brokerid];
|
|
|
+ }
|
|
|
+ $status = input('status/d');
|
|
|
+ if (!empty($status)) {
|
|
|
+ $map[] = ['status', '=', $status];
|
|
|
+ }
|
|
|
+ $authstatus = input('authstatus/d');
|
|
|
+ if (!empty($authstatus)) {
|
|
|
+ $map[] = ['authstatus', '=', $authstatus];
|
|
|
+ }
|
|
|
+ $followstatus = input('followstatus/d');
|
|
|
+ if (!empty($followstatus)) {
|
|
|
+ $map[] = ['followstatus', '=', $followstatus];
|
|
|
+ }
|
|
|
+ $xlsData = UserModel::with(['userGroups', 'broker' => ['agent', 'worker']])->withCount('userPart')->where($map)->order('id', 'desc')->append(['status_text', 'isvip_text', 'authstatus_text', 'followstatus_text'])->select()->toArray();
|
|
|
+ $xlsCell = [
|
|
|
+ ['id', '表ID'],
|
|
|
+ ['nickname', '昵称'],
|
|
|
+ ['realname', '姓名'],
|
|
|
+ ['mobile', '手机号'],
|
|
|
+ ['integral', '可用积分'],
|
|
|
+ ['inttotal', '累计积分'],
|
|
|
+ ['status_text', '状态'],
|
|
|
+ ['isvip_text', '是否VIP'],
|
|
|
+ ['authstatus_text', '是否实名认证'],
|
|
|
+ ['idcard', '身份证号'],
|
|
|
+ ['gender', '性别', [1 => '男', 2 => '女']],
|
|
|
+ ['birthday', '出生日期'],
|
|
|
+ ['address', '现居住地'],
|
|
|
+ ['education', '学历'],
|
|
|
+ ['bankcard.openbank', '开户行'],
|
|
|
+ ['bankcard.account', '账户名'],
|
|
|
+ ['bankcard.number', '账户号'],
|
|
|
+ ['followstatus_text', '跟进状态'],
|
|
|
+ ['userGroups.title', '用户组'],
|
|
|
+ ['broker.worker.title', '劳务公司'],
|
|
|
+ ['broker.agent.title', '代理门店'],
|
|
|
+ ['broker.title', '经纪人'],
|
|
|
+ ['user_part_count', '推广人数'],
|
|
|
+ ['createtime', '注册时间'],
|
|
|
+ ];
|
|
|
+ export_excel("系统用户", $xlsCell, $xlsData);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function setBroker()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ $setagentbroker = explode(",", input('setagentbroker/s'));
|
|
|
+ $brokerid = isset($setagentbroker[1]) ? $setagentbroker[1] : 0;
|
|
|
+ if (empty($brokerid)) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "请选择经纪人。",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ UserModel::whereIn('id', $idarr)->update(['brokerid' => $brokerid]);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delUser()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserModel::destroy($idarr);
|
|
|
+ event('userDel', $idarr);
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editUser()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ $mobile = input('mobile/s');
|
|
|
+ $vdata = [
|
|
|
+ 'id' => $id,
|
|
|
+ 'mobile' => $mobile,
|
|
|
+ ];
|
|
|
+ try {
|
|
|
+ validate(UserValidate::class)->check($vdata);
|
|
|
+ } catch (ValidateException $e) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => $e->getError(),
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ //手机号
|
|
|
+ $check_user_where = [['mobile', '=', $mobile]];
|
|
|
+ if (!empty($id)) {
|
|
|
+ $check_user_where[] = ['id', '<>', $id];
|
|
|
+ }
|
|
|
+ $check_user = UserModel::where($check_user_where)->find();
|
|
|
+ if (!empty($check_user)) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => '手机号已存在',
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ $address = input('address/s', "");
|
|
|
+ $jobintention = input('jobintention/s', "");
|
|
|
+ $agentbrokerarr = explode(",", input('agentbroker/s'));
|
|
|
+ $brokerid = isset($agentbrokerarr[1]) ? $agentbrokerarr[1] : 0;
|
|
|
+ $data = [
|
|
|
+ 'groupsid' => input('groupsid/d', 0),
|
|
|
+ 'brokerid' => $brokerid,
|
|
|
+ 'nickname' => input('nickname/s', ""),
|
|
|
+ 'avatar' => input('avatar/s', ""),
|
|
|
+ 'realname' => input('realname/s', ""),
|
|
|
+ 'mobile' => $mobile,
|
|
|
+ 'inttotal' => input('inttotal/d', 0),
|
|
|
+ 'status' => input('status/d', 1),
|
|
|
+ 'isvip' => input('isvip/d', 1),
|
|
|
+ 'authstatus' => input('authstatus/d', 1),
|
|
|
+ 'authremark' => input('authremark/s', ""),
|
|
|
+ 'idcardzpic' => input('idcardzpic/s', ""),
|
|
|
+ 'idcardfpic' => input('idcardfpic/s', ""),
|
|
|
+ 'idcard' => input('idcard/s', ""),
|
|
|
+ 'gender' => input('gender/d', 1),
|
|
|
+ 'birthday' => input('birthday/s', ""),
|
|
|
+ 'address' => $address,
|
|
|
+ 'education' => input('education/s', ""),
|
|
|
+ 'createtime' => input('createtime/s', ""),
|
|
|
+ 'jobintention' => $jobintention,
|
|
|
+ 'workexperience' => input('workexperience/s', ""),
|
|
|
+ 'eduexperience' => input('eduexperience/s', ""),
|
|
|
+ 'followstatus' => input('followstatus/d', 1),
|
|
|
+ 'bankcard' => input('bankcard/a', []),
|
|
|
+ 'emp_time' => array_values(input('emp_time/a', [])),
|
|
|
+ 'user_tags' => array_values(input('user_tags/a', [])),
|
|
|
+ 'work_place' => array_values(input('work_place/a', [])),
|
|
|
+ 'com_cate_type' => input('com_cate_type/d', 1),
|
|
|
+ 'com_cate' => array_values(input('com_cate/a', [])),
|
|
|
+ 'com_cate_other' => input('com_cate_other/s', ""),
|
|
|
+ ];
|
|
|
+ $password = input('password/s');
|
|
|
+ if (empty($id)) {
|
|
|
+ $data['integral'] = 0;
|
|
|
+ $data['wxampcode'] = '';
|
|
|
+ $user = UserModel::create($data);
|
|
|
+ UserAuthsModel::create([
|
|
|
+ 'userid' => $user->id,
|
|
|
+ 'identitytype' => "mobile",
|
|
|
+ 'identifier' => $mobile,
|
|
|
+ 'password' => empty($password) ? md5("123456789") : md5($password),
|
|
|
+ 'logintime' => time(),
|
|
|
+ 'loginip' => $_SERVER['SERVER_ADDR'],
|
|
|
+ 'wxampcode' => "",
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ $data['id'] = $id;
|
|
|
+ UserModel::update($data);
|
|
|
+ $adata = ['identifier' => $mobile];
|
|
|
+ if (!empty($password)) {
|
|
|
+ $adata['password'] = md5($password);
|
|
|
+ }
|
|
|
+ UserAuthsModel::update($adata, ['userid' => $id, 'identitytype' => 'mobile']);
|
|
|
+
|
|
|
+ //实名认证积分
|
|
|
+ $user = UserModel::where('id', $id)->find();
|
|
|
+ if ($user['authstatus'] == 3 && $user['is_auth'] == 2) {
|
|
|
+ $user->is_auth = 1;
|
|
|
+ $user->save();
|
|
|
+ $integralService = new IntegralService();
|
|
|
+ $integralService->add($id, IntegralService::CERTIFICATION);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ // 用户组
|
|
|
+ public function groupsList()
|
|
|
+ {
|
|
|
+ return view('user/groupslist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function groupsForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d, 0');
|
|
|
+ $groups = UserGroupsModel::findOrEmpty($id);
|
|
|
+ return view('user/groupsform', [
|
|
|
+ 'groups' => $groups,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listGroups()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $list = UserGroupsModel::order(['isdefault' => 'desc', 'id' => 'asc'])->limit($limit)->page($page)->append(['isdefault_text'])->select();
|
|
|
+ $count = UserGroupsModel::count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editGroups()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ if (empty($id)) {
|
|
|
+ $groups = UserGroupsModel::create([
|
|
|
+ 'title' => input('title/s'),
|
|
|
+ 'isdefault' => input('isdefault/d') == 2 ? 2 : 1,
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ $administer = UserGroupsModel::find($id);
|
|
|
+ $administer->save([
|
|
|
+ 'title' => input('title/s'),
|
|
|
+ 'isdefault' => input('isdefault/d') == 2 ? 2 : 1,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delGroups()
|
|
|
+ {
|
|
|
+ $access_admin = session('access_admin');
|
|
|
+ $password = input('password');
|
|
|
+ if ($access_admin['password'] !== md5($password)) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "操作密码验证失败",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserGroupsModel::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 参数设置
|
|
|
+ public function param()
|
|
|
+ {
|
|
|
+ $param = UserParamModel::where(1)->findOrEmpty();
|
|
|
+ return view('user/param', [
|
|
|
+ 'param' => $param,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editParam()
|
|
|
+ {
|
|
|
+ $param = UserParamModel::where(1)->findOrEmpty();
|
|
|
+ $data = [
|
|
|
+ 'redmoney' => input('redmoney/d', 0),
|
|
|
+ 'usernumber' => input('usernumber/d', 0),
|
|
|
+ 'shareintegral' => input('shareintegral/d', 0),
|
|
|
+ 'postintegral' => input('postintegral/d', 0),
|
|
|
+ 'inttomoney' => input('inttomoney/d', 0),
|
|
|
+ 'minintegral' => input('minintegral/d', 0),
|
|
|
+ 'intrecharge' => input('intrecharge/d', 0),
|
|
|
+ 'picregworker' => input('picregworker/s', ""),
|
|
|
+ 'intregworker' => input('intregworker/d', 0),
|
|
|
+ 'register' => input('register/d', 0),
|
|
|
+ 'improveresume' => input('improveresume/d', 0),
|
|
|
+ 'certification' => input('certification/d', 0),
|
|
|
+ 'entry' => input('entry/d', 0),
|
|
|
+ 'signin' => input('signin/d', 0),
|
|
|
+ 'sharejob' => input('sharejob/d', 0),
|
|
|
+ 'sharejobnum' => input('sharejobnum/d', 0),
|
|
|
+ 'taskimage' => input('taskimage/s', ''),
|
|
|
+ ];
|
|
|
+ if ($param->isEmpty()) {
|
|
|
+ UserParamModel::create($data);
|
|
|
+ } else {
|
|
|
+ $data['id'] = $param->id;
|
|
|
+ UserParamModel::update($data);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 提现设置
|
|
|
+ public function getmoney()
|
|
|
+ {
|
|
|
+ $param = UserParamModel::field('getmoney')->where(1)->findOrEmpty();
|
|
|
+ return view('user/getmoney', [
|
|
|
+ 'getmoney' => $param['getmoney'],
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editGetmoney()
|
|
|
+ {
|
|
|
+ $param = UserParamModel::where(1)->findOrEmpty();
|
|
|
+ $data = [
|
|
|
+ 'getmoney' => input('getmoney/a', []),
|
|
|
+ ];
|
|
|
+ foreach ($data['getmoney'] as $v) {
|
|
|
+ if ($v['money'] <= 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "金额必须大于0",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ if ($v['num'] <= 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "次数必须大于0",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($param->isEmpty()) {
|
|
|
+ UserParamModel::create($data);
|
|
|
+ } else {
|
|
|
+ $param->getmoney = $data['getmoney'];
|
|
|
+ $param->save();
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用户组
|
|
|
+ public function willList()
|
|
|
+ {
|
|
|
+ return view('user/willlist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function willForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d, 0');
|
|
|
+ $will = UserWill::findOrEmpty($id);
|
|
|
+ return view('user/willform', [
|
|
|
+ 'will' => $will,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listwill()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $list = UserWill::order(['isdefault' => 'desc', 'id' => 'asc'])->limit($limit)->page($page)->append(['isdefault_text'])->select();
|
|
|
+ $count = UserWill::count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function editwill()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ if (empty($id)) {
|
|
|
+ UserWill::create([
|
|
|
+ 'title' => input('title/s'),
|
|
|
+ 'isdefault' => input('isdefault/d') == 2 ? 2 : 1,
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ $administer = UserWill::find($id);
|
|
|
+ $administer->save([
|
|
|
+ 'title' => input('title/s'),
|
|
|
+ 'isdefault' => input('isdefault/d') == 2 ? 2 : 1,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function delwill()
|
|
|
+ {
|
|
|
+ $access_admin = session('access_admin');
|
|
|
+ $password = input('password');
|
|
|
+ if ($access_admin['password'] !== md5($password)) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "操作密码验证失败",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserWill::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function importView()
|
|
|
+ {
|
|
|
+ return view('user/importview');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function import()
|
|
|
+ {
|
|
|
+ $file_url = input('file_url/s', "");
|
|
|
+ if (!file_exists($file_url)) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "文件不存在",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ $service = new UserService();
|
|
|
+ $res = $service->importComjobs($file_url);
|
|
|
+ if (empty($res['code'])) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => $res['msg'],
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ exit(json_encode(['code' => 0]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function tags()
|
|
|
+ {
|
|
|
+ return view('user/tagslist');
|
|
|
+ }
|
|
|
+
|
|
|
+ public function listtags()
|
|
|
+ {
|
|
|
+ $limit = input('limit');
|
|
|
+ $page = input('page');
|
|
|
+ $map = [];
|
|
|
+ $keywords = input('keywords/s');
|
|
|
+ if (!empty($keywords)) {
|
|
|
+ $map[] = ['name', 'like', '%' . $keywords . '%'];
|
|
|
+ }
|
|
|
+ $list = UserTags::where($map)->limit($limit)->page($page)->select();
|
|
|
+ $count = UserTags::count();
|
|
|
+ if ($count == 0) {
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 1,
|
|
|
+ 'msg' => "未查询到数据",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ 'count' => $count,
|
|
|
+ 'data' => $list,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function deltags()
|
|
|
+ {
|
|
|
+ $idarr = input('idarr/a');
|
|
|
+ UserTags::whereIn('id', $idarr)->delete();
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ 'msg' => "",
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+
|
|
|
+ public function tagsForm()
|
|
|
+ {
|
|
|
+ $id = input('id/d, 0');
|
|
|
+ $tags = UserTags::findOrEmpty($id);
|
|
|
+ return view('user/tagsform', [
|
|
|
+ 'tags' => $tags,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function edittags()
|
|
|
+ {
|
|
|
+ $id = input('id/d');
|
|
|
+ if (empty($id)) {
|
|
|
+ UserTags::create([
|
|
|
+ 'name' => input('name/s'),
|
|
|
+ ]);
|
|
|
+ } else {
|
|
|
+ $administer = UserTags::find($id);
|
|
|
+ $administer->save([
|
|
|
+ 'name' => input('name/s'),
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ exit(json_encode([
|
|
|
+ 'code' => 0,
|
|
|
+ ]));
|
|
|
+ }
|
|
|
+}
|