|
@@ -13,6 +13,8 @@ namespace app\user\controller;
|
|
|
|
|
|
use api\user\model\UserLikeModel;
|
|
|
use app\common\Constant;
|
|
|
+use app\common\Excel;
|
|
|
+use app\common\Fun;
|
|
|
use app\love\model\ActiveApplyModel;
|
|
|
use app\love\model\UserFriendModel;
|
|
|
use app\love\model\UserGiftModel;
|
|
@@ -95,10 +97,6 @@ class AdminIndexController extends AdminBaseController
|
|
|
$query->where('sex', $data['sex']);
|
|
|
}
|
|
|
|
|
|
- if (!empty($data['is_complete'])) {
|
|
|
- $query->where('is_complete', $data['is_complete']);
|
|
|
- }
|
|
|
-
|
|
|
if (!empty($data['check_status'])) {
|
|
|
$query->where('check_status', $data['check_status']);
|
|
|
}
|
|
@@ -124,10 +122,6 @@ class AdminIndexController extends AdminBaseController
|
|
|
$query->where('sex', $data['sex']);
|
|
|
}
|
|
|
|
|
|
- if (!empty($data['is_complete'])) {
|
|
|
- $query->where('is_complete', $data['is_complete']);
|
|
|
- }
|
|
|
-
|
|
|
if (!empty($data['check_status'])) {
|
|
|
$query->where('check_status', $data['check_status']);
|
|
|
}
|
|
@@ -276,4 +270,65 @@ class AdminIndexController extends AdminBaseController
|
|
|
$this->error('数据传入失败!');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出
|
|
|
+ */
|
|
|
+ public function export()
|
|
|
+ {
|
|
|
+ $data = $this->request->param();
|
|
|
+
|
|
|
+ $where = [
|
|
|
+ ['user_type', '=', 2],
|
|
|
+ ['is_complete', '=', 1],
|
|
|
+ ];
|
|
|
+
|
|
|
+ if (!empty($data['uid'])) {
|
|
|
+ $where[] = ['id', '=', intval($data['uid'])];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($data['keyword'])) {
|
|
|
+ $where[] = ['realname', 'like', "%{$data['keyword']}%"];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($data['sex'])) {
|
|
|
+ $where[] = ['sex', '=', $data['sex']];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!empty($data['check_status'])) {
|
|
|
+ $where[] = ['check_status', '=', $data['check_status']];
|
|
|
+ }
|
|
|
+
|
|
|
+ $list = UserModel::where($where)->order("check_status asc,create_time DESC")->select();
|
|
|
+ $data = [];
|
|
|
+ foreach ($list as $v) {
|
|
|
+ $data[] = [
|
|
|
+ 'name' => $v['realname'],
|
|
|
+ 'sex' => $v['sex_text'],
|
|
|
+ 'age' => Fun::getAgeByBirth($v['birthday']),
|
|
|
+ 'mobile' => $v['mobile'],
|
|
|
+ 'company' => $v['company'],
|
|
|
+ 'id_type' => $v['id_type'],
|
|
|
+ 'native' => $v['native'],
|
|
|
+ 'marry' => $v['marry'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (empty($data)) {
|
|
|
+ return '暂无数据';
|
|
|
+ }
|
|
|
+
|
|
|
+ $excel = new Excel();
|
|
|
+ $title = [
|
|
|
+ ['name','姓名'],
|
|
|
+ ['sex','性别'],
|
|
|
+ ['age','年龄'],
|
|
|
+ ['mobile','电话'],
|
|
|
+ ['company','单位'],
|
|
|
+ ['id_type','身份类型'],
|
|
|
+ ['native','籍贯'],
|
|
|
+ ['marry','婚姻状况'],
|
|
|
+ ];
|
|
|
+ $excel->export('本站用户',$title,$data,['mobile']);
|
|
|
+ }
|
|
|
}
|