<?php


namespace App\Http\Controllers\Admin;

// 彩金控制

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class LotteryController
{
    public function index(Request $request)
    {

        if ($request->method() == 'POST') {
            $val =abs($request->StatusValue) ?: 0;
            $val *= 100;
            $r = DB::table('QPAccountsDB.dbo.SystemStatusInfo')->where('StatusName','GrantScoreCountNew')->update(['StatusValue'=>$val]);
            if ($r) {
                return apiReturnSuc();
            }
            return apiReturnFail('彩金控制修改失败');
        }else{
            $value = DB::table('QPAccountsDB.dbo.SystemStatusInfo')->where('StatusName','GrantScoreCountNew')->value('StatusValue');
            $value = $value / 100;
            return view('admin.lottery.index',compact('value'));
        }



    }
}
