| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Http\Controllers\Admin;
- use App\Http\helper\NumConfig;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\DB;
- // 签到
- class SignInController
- {
- public function index(Request $request)
- {
- $start_time = $request->start_time ?: date('Y-m-d').' 00:00:00';
- $end_time = $request->end_time ?: date('Y-m-d').' 23:59:59';
- $GameID = $request->GameID ?: '';
- $NickName = $request->NickName ?: '';
- $Channel = $request->Channel ?: '';
- $where[] = ['Reason', 44];
- !empty($start_time) && $where[] = ['UpdateTime', '>=', date('Y-m-d H:i:s', strtotime($start_time))];
- !empty($end_time) && $where[] = ['UpdateTime', '<=', date('Y-m-d H:i:s', strtotime($end_time))];
- !empty($GameID) && $where[] = ['GameID', $GameID];
- !empty($NickName) && $where[] = ['NickName', 'like', $NickName . '%'];
- !empty($Channel) && $where[] = ['Channel', $Channel];
- $ChannelList = DB::connection('write')->table('QPPlatformDB.dbo.ChannelPackageName')->pluck('Channel', 'ID');
- ////////////////////////
- // 查询范围需要在同一个月份,暂时不支持跨月份查询
- $from_mm = intval(date('Ym',strtotime($start_time)));
- $to_mm = intval(date('Ym',strtotime($end_time)));
- if( $from_mm != $to_mm ){
- throw new Exception('暂不支持跨月查询,开始时间和结束时间请选择相同月份');
- }
- //确定有效表范围,从202104月开始到当前月
- if($from_mm < 202104 || $from_mm > intval(date('Ym'))){
- $from_mm = date('Ym');
- }
- $table = 'QPTreasureDB.dbo.YN_RecordScoreInfo_'.$from_mm;
- //////////////////////
- $list = DB::connection('write')->table($table.' as ri')
- ->join('QPAccountsDB.dbo.AccountsInfo as ai', 'ri.UserID', 'ai.UserID')
- ->where($where)
- ->selectRaw('ri.*,ai.GameID,ai.NickName,Channel')
- ->orderByDesc('UpdateTime')
- ->paginate(50);
- foreach ($list as $value) {
- $value->ChangeScore = number_float($value->ChangeScore / NumConfig::NUM_VALUE);
- }
- $data = compact('list', 'ChannelList', 'start_time', 'end_time', 'GameID', 'NickName', 'Channel');
- return view('admin.sign_in.index', $data);
- }
- }
|