@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:sync {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group}'; |
|
17 | + protected $signature='babel:sync {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group}'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The console command description. |
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - protected $description = 'Crawl contests for a given Babel Extension to NOJ'; |
|
24 | + protected $description='Crawl contests for a given Babel Extension to NOJ'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Create a new command instance. |
@@ -40,16 +40,16 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function handle() |
42 | 42 | { |
43 | - $extension = $this->argument('extension'); |
|
44 | - $vcid = $this->option('vcid'); |
|
45 | - $gid = $this->option('gid'); |
|
46 | - $className = "App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
47 | - $all_data = [ |
|
43 | + $extension=$this->argument('extension'); |
|
44 | + $vcid=$this->option('vcid'); |
|
45 | + $gid=$this->option('gid'); |
|
46 | + $className="App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
47 | + $all_data=[ |
|
48 | 48 | 'oj'=>$extension, |
49 | 49 | 'vcid'=>$vcid, |
50 | 50 | 'gid'=>$gid, |
51 | 51 | ]; |
52 | - $Sync = new $className($all_data); |
|
52 | + $Sync=new $className($all_data); |
|
53 | 53 | $Sync->crawlContest(); |
54 | 54 | } |
55 | 55 | } |
@@ -14,14 +14,14 @@ discard block |
||
14 | 14 | * |
15 | 15 | * @var string |
16 | 16 | */ |
17 | - protected $signature = 'babel:rerank {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group} {--cid= : The NOJ contest}'; |
|
17 | + protected $signature='babel:rerank {extension : The package name of the extension} {--vcid= : The target contest of the Crawler} {--gid=1 : The holding group} {--cid= : The NOJ contest}'; |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * The console command description. |
21 | 21 | * |
22 | 22 | * @var string |
23 | 23 | */ |
24 | - protected $description = 'Refresh Rank from a remote contest'; |
|
24 | + protected $description='Refresh Rank from a remote contest'; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Create a new command instance. |
@@ -40,18 +40,18 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function handle() |
42 | 42 | { |
43 | - $extension = $this->argument('extension'); |
|
44 | - $vcid = $this->option('vcid'); |
|
45 | - $gid = $this->option('gid'); |
|
46 | - $cid = $this->option('cid'); |
|
47 | - $className = "App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
48 | - $all_data = [ |
|
43 | + $extension=$this->argument('extension'); |
|
44 | + $vcid=$this->option('vcid'); |
|
45 | + $gid=$this->option('gid'); |
|
46 | + $cid=$this->option('cid'); |
|
47 | + $className="App\\Babel\\Extension\\$extension\\Synchronizer"; |
|
48 | + $all_data=[ |
|
49 | 49 | 'oj'=>$extension, |
50 | 50 | 'vcid'=>$vcid, |
51 | 51 | 'gid'=>$gid, |
52 | 52 | 'cid'=>$cid, |
53 | 53 | ]; |
54 | - $Sync = new $className($all_data); |
|
54 | + $Sync=new $className($all_data); |
|
55 | 55 | $Sync->crawlRank(); |
56 | 56 | } |
57 | 57 | } |
@@ -23,34 +23,34 @@ |
||
23 | 23 | if (!$request->has('search_key')) { |
24 | 24 | return ResponseModel::err(1003); |
25 | 25 | } |
26 | - $key = $request->input('search_key'); |
|
27 | - $all_result = []; |
|
28 | - $search_from = [ |
|
26 | + $key=$request->input('search_key'); |
|
27 | + $all_result=[]; |
|
28 | + $search_from=[ |
|
29 | 29 | 'users' => \App\Models\Search\UserSearchModel::class, |
30 | 30 | 'problems' => \App\Models\Search\ProblemSearchModel::class, |
31 | 31 | 'contests' => \App\Models\Search\ContestSearchModel::class, |
32 | 32 | 'groups' => \App\Models\Search\GroupSearchModel::class, |
33 | 33 | ]; |
34 | 34 | foreach ($search_from as $name => $model_class) { |
35 | - if(class_exists($model_class)){ |
|
36 | - $model = new $model_class(); |
|
37 | - if(!method_exists($model,'search')){ |
|
38 | - $all_result[$name] = [ |
|
35 | + if (class_exists($model_class)) { |
|
36 | + $model=new $model_class(); |
|
37 | + if (!method_exists($model, 'search')) { |
|
38 | + $all_result[$name]=[ |
|
39 | 39 | 'code' => -1, |
40 | 40 | 'msg' => 'cannot find search method in '.$model_class |
41 | 41 | ]; |
42 | 42 | continue; |
43 | 43 | } |
44 | - $result = $model->search($key); |
|
45 | - $all_result[$name] = $result; |
|
46 | - }else{ |
|
47 | - $all_result[$name] = [ |
|
44 | + $result=$model->search($key); |
|
45 | + $all_result[$name]=$result; |
|
46 | + } else { |
|
47 | + $all_result[$name]=[ |
|
48 | 48 | 'code' => -1, |
49 | 49 | 'msg' => 'cannot find class named '.$model_class |
50 | - ];; |
|
50 | + ]; ; |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | } |
54 | - return ResponseModel::success(200,'Successful',$all_result); |
|
54 | + return ResponseModel::success(200, 'Successful', $all_result); |
|
55 | 55 | } |
56 | 56 | } |
@@ -43,7 +43,7 @@ |
||
43 | 43 | } |
44 | 44 | $result = $model->search($key); |
45 | 45 | $all_result[$name] = $result; |
46 | - }else{ |
|
46 | + } else{ |
|
47 | 47 | $all_result[$name] = [ |
48 | 48 | 'code' => -1, |
49 | 49 | 'msg' => 'cannot find class named '.$model_class |
@@ -12,19 +12,19 @@ |
||
12 | 12 | |
13 | 13 | public function search($key) |
14 | 14 | { |
15 | - $result = []; |
|
15 | + $result=[]; |
|
16 | 16 | //group name or gcode find |
17 | - if(strlen($key) >= 2){ |
|
18 | - $ret = self::where(function($query) use ($key){ |
|
19 | - $query->whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
|
17 | + if (strlen($key)>=2) { |
|
18 | + $ret=self::where(function($query) use ($key){ |
|
19 | + $query->whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)', [$key]) |
|
20 | 20 | ->orWhere('gcode', $key); |
21 | 21 | }) |
22 | - ->where('public',1) |
|
23 | - ->select('gid','gcode', 'img', 'name', 'description') |
|
22 | + ->where('public', 1) |
|
23 | + ->select('gid', 'gcode', 'img', 'name', 'description') |
|
24 | 24 | ->limit(120) |
25 | 25 | ->get()->all(); |
26 | - if(!empty($ret)){ |
|
27 | - $result += $ret; |
|
26 | + if (!empty($ret)) { |
|
27 | + $result+=$ret; |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 |
@@ -15,26 +15,26 @@ |
||
15 | 15 | |
16 | 16 | public function search($key) |
17 | 17 | { |
18 | - $result = []; |
|
18 | + $result=[]; |
|
19 | 19 | //contest name find |
20 | - if(strlen($key) >= 2){ |
|
21 | - $ret = self::whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
|
20 | + if (strlen($key)>=2) { |
|
21 | + $ret=self::whereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)', [$key]) |
|
22 | 22 | ->select('cid', 'gid', 'name', 'rule', 'public', 'verified', 'practice', 'rated', 'anticheated', 'begin_time', 'end_time') |
23 | - ->orderBy('end_time','DESC') |
|
23 | + ->orderBy('end_time', 'DESC') |
|
24 | 24 | ->limit(120) |
25 | 25 | ->get()->all(); |
26 | - $user_id = Auth::user()->id; |
|
27 | - $contestModel = new ContestModel(); |
|
28 | - foreach($ret as $c_index => $c){ |
|
29 | - if(!$contestModel->judgeClearance($c['cid'],$user_id)){ |
|
26 | + $user_id=Auth::user()->id; |
|
27 | + $contestModel=new ContestModel(); |
|
28 | + foreach ($ret as $c_index => $c) { |
|
29 | + if (!$contestModel->judgeClearance($c['cid'], $user_id)) { |
|
30 | 30 | unset($ret[$c_index]); |
31 | 31 | } |
32 | 32 | } |
33 | - if(!empty($ret)){ |
|
34 | - $result += $ret; |
|
33 | + if (!empty($ret)) { |
|
34 | + $result+=$ret; |
|
35 | 35 | } |
36 | 36 | } |
37 | - if(!empty($result)) { |
|
37 | + if (!empty($result)) { |
|
38 | 38 | foreach ($result as &$contest) { |
39 | 39 | $contest["rule_parsed"]=$this->rule[$contest["rule"]]; |
40 | 40 | $contest["date_parsed"]=[ |
@@ -10,16 +10,16 @@ |
||
10 | 10 | |
11 | 11 | public function search($key) |
12 | 12 | { |
13 | - $result = []; |
|
14 | - if(strlen($key) >= 2){ |
|
15 | - $ret = self::where('email',$key) |
|
16 | - ->orWhereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)',[$key]) |
|
17 | - ->select('id','avatar', 'name', 'describes', 'professional_rate') |
|
18 | - ->orderBy('professional_rate','DESC') |
|
13 | + $result=[]; |
|
14 | + if (strlen($key)>=2) { |
|
15 | + $ret=self::where('email', $key) |
|
16 | + ->orWhereRaw('MATCH(`name`) AGAINST (? IN BOOLEAN MODE)', [$key]) |
|
17 | + ->select('id', 'avatar', 'name', 'describes', 'professional_rate') |
|
18 | + ->orderBy('professional_rate', 'DESC') |
|
19 | 19 | ->limit(120) |
20 | 20 | ->get()->all(); |
21 | - if(!empty($ret)){ |
|
22 | - $result += $ret; |
|
21 | + if (!empty($ret)) { |
|
22 | + $result+=$ret; |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | return $result; |
@@ -24,7 +24,7 @@ |
||
24 | 24 | "name"=>$versionInfo[0]["name"], |
25 | 25 | "updatable"=>$updatable |
26 | 26 | ]; |
27 | - }catch(Throwable $e){ |
|
27 | + } catch (Throwable $e) { |
|
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | "name"=>$versionInfo[0]["name"], |
25 | 25 | "updatable"=>$updatable |
26 | 26 | ]; |
27 | - }catch(Throwable $e){ |
|
27 | + } catch(Throwable $e){ |
|
28 | 28 | return null; |
29 | 29 | } |
30 | 30 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | } catch (ErrorException $e) { |
24 | 24 | } catch (Exception $e) { |
25 | 25 | } |
26 | - $className = "App\\Babel\\Extension\\$oj\\$synchronizerProvider"; |
|
26 | + $className="App\\Babel\\Extension\\$oj\\$synchronizerProvider"; |
|
27 | 27 | if (class_exists($className)) { |
28 | 28 | return new $className($all_data); |
29 | 29 | } else { |
@@ -51,7 +51,7 @@ |
||
51 | 51 | } catch (ErrorException $e) { |
52 | 52 | } catch (Exception $e) { |
53 | 53 | } |
54 | - $className = "App\\Babel\\Extension\\$oj\\$submitterProvider"; |
|
54 | + $className="App\\Babel\\Extension\\$oj\\$submitterProvider"; |
|
55 | 55 | if (class_exists($className)) { |
56 | 56 | return new $className($sub, $all_data); |
57 | 57 | } else { |