|
|
@@ -181,10 +181,50 @@ class User extends BaseModel
|
|
|
else if (time() > $levelinfo['valid_time']) $item['vip_name'] = SystemUserLevel::where('id', $levelinfo['level_id'])->value('name');
|
|
|
}
|
|
|
});//->toArray();
|
|
|
+ if (isset($where['excel']) && $where['excel'] == 1) {
|
|
|
+ $list = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid'])->alias('u')->join('WechatUser w', 'u.uid=w.uid')->select();
|
|
|
+ self::SaveExcel($list);
|
|
|
+ }
|
|
|
$count = self::setWherePage(self::setWhere($where), $where, ['w.sex', 'w.province', 'w.city', 'u.status', 'u.is_promoter'], ['u.nickname', 'u.uid'])->alias('u')->join('WechatUser w', 'u.uid=w.uid')->count();
|
|
|
return ['count' => $count, 'data' => $list];
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * excel
|
|
|
+ * @param $list
|
|
|
+ * @return void
|
|
|
+ * @throws \think\db\exception\DataNotFoundException
|
|
|
+ * @throws \think\db\exception\DbException
|
|
|
+ * @throws \think\db\exception\ModelNotFoundException
|
|
|
+ */
|
|
|
+ public static function SaveExcel($list)
|
|
|
+ {
|
|
|
+ $export = [];
|
|
|
+ $user = User::select();
|
|
|
+ foreach ($list as $index => $item) {
|
|
|
+ $nickname = \app\models\user\User::where('uid', $item['spread_uid'])->value('nickname');
|
|
|
+ $add_time = \app\models\user\User::where('uid', $item['uid'])->value('add_time');
|
|
|
+ $export[] = [
|
|
|
+ $item['uid'],
|
|
|
+ $item['account'],
|
|
|
+ empty($item['nickname']) ? self::where('uid', $item['uid'])->value('nickname') : $item['nickname'],
|
|
|
+ !empty($item['phone'])? $item['phone'] : '未绑定手机号',
|
|
|
+ $item['level'],
|
|
|
+ self::where('uid',$item['uid'])->value('now_money'),
|
|
|
+ $item['integral'],
|
|
|
+ $item['white_integral'],
|
|
|
+ $item['purple_integral'],
|
|
|
+ !empty($nickname)? $nickname : '没有上级',
|
|
|
+ date('Y-m-d H:i:s', $add_time),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ PHPExcelService::setExcelHeader(['ID', '账号', '昵称', '手机号','等级', '余额','商城积分','红积分','阳光积分', '推广人','首次登录时间'])
|
|
|
+ ->setExcelTile('用户导出' . date('YmdHis', time()), '订单信息' . time(), ' 生成时间:' . date('Y-m-d H:i:s', time()))
|
|
|
+ ->setExcelContent($export)
|
|
|
+ ->ExcelSave();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改用户状态
|
|
|
* @param $uids 用户uid
|