|
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\admin;
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Controller;
|
|
|
use App\Models\Sport as SportModel;
|
|
use App\Models\Sport as SportModel;
|
|
|
use App\Models\SportEvent;
|
|
use App\Models\SportEvent;
|
|
|
|
|
+use App\Models\SportOdds;
|
|
|
use App\Models\SportTeam;
|
|
use App\Models\SportTeam;
|
|
|
use App\Models\SportLeague;
|
|
use App\Models\SportLeague;
|
|
|
use App\Models\SportStatistics;
|
|
use App\Models\SportStatistics;
|
|
@@ -15,6 +16,69 @@ use App\Services\SportClientService;
|
|
|
|
|
|
|
|
class Sport extends Controller
|
|
class Sport extends Controller
|
|
|
{
|
|
{
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 赛事玩法列表
|
|
|
|
|
+ */
|
|
|
|
|
+ public function oddsList()
|
|
|
|
|
+ {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $params = request()->validate([
|
|
|
|
|
+ 'page' => ['nullable', 'integer', 'min:1'],
|
|
|
|
|
+ 'limit' => ['nullable', 'integer', 'min:1'],
|
|
|
|
|
+ 'odd_name' => ['nullable'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $page = request()->input('page', 1);
|
|
|
|
|
+ $limit = request()->input('limit', 15);
|
|
|
|
|
+
|
|
|
|
|
+ $query = new SportOdds();
|
|
|
|
|
+ if (!empty($params['odd_name'])) {
|
|
|
|
|
+ $odd_name = $params['odd_name'];
|
|
|
|
|
+ $query = $query->where(function ($query) use ($odd_name) {
|
|
|
|
|
+ $query->where('odd_name', 'like', "%{$odd_name}%")
|
|
|
|
|
+ ->orWhere('odd_name_en', 'like', "%{$odd_name}%");
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $count = $query->count();
|
|
|
|
|
+ $list = $query
|
|
|
|
|
+ ->forPage($page, $limit)
|
|
|
|
|
+ ->get();
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return $this->success(['total' => $count, 'data' => $list]);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //设置赛事玩法的下注限额
|
|
|
|
|
+ public function setOdds()
|
|
|
|
|
+ {
|
|
|
|
|
+ try {
|
|
|
|
|
+ $params = request()->validate([
|
|
|
|
|
+ 'id' => ['required'],
|
|
|
|
|
+ 'maxinum' => ['required','numeric'],
|
|
|
|
|
+ 'mininum' => ['required','numeric'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ if ($params['maxinum'] <= $params['mininum']) throw new Exception('最高下注限额不能小于等于最低下注限额');
|
|
|
|
|
+ if ($params['mininum'] < 1) throw new Exception('最低下注限额不能小于1');
|
|
|
|
|
+ $id = $params['id'];
|
|
|
|
|
+ if (is_array($id)) {
|
|
|
|
|
+ $where = ['id', 'in', $id];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $where = ['id', '=', $id];
|
|
|
|
|
+ }
|
|
|
|
|
+ $count = SportOdds::where($where)->count();
|
|
|
|
|
+ if (!$count) throw new Exception('玩法不存在');
|
|
|
|
|
+
|
|
|
|
|
+ SportOdds::where($where)->update([
|
|
|
|
|
+ 'maxinum' => $params['maxinum'],
|
|
|
|
|
+ 'mininum' => $params['mininum'],
|
|
|
|
|
+ ]);
|
|
|
|
|
+ return $this->success();
|
|
|
|
|
+ } catch (Exception $e) {
|
|
|
|
|
+ return $this->error(HttpStatus::CUSTOM_ERROR,$e->getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 列表
|
|
* 列表
|