ActiveController.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Models\Activity;
  4. use App\Models\ActivityLimit;
  5. use App\Models\BigGiftApply;
  6. use App\Models\Goodtest;
  7. use App\Models\Order;
  8. use App\Models\OrderDetail;
  9. use App\Models\Ordertest;
  10. use App\Models\System;
  11. use Carbon\Carbon;
  12. use http\Env\Request;
  13. use Illuminate\Database\Eloquent\Model;
  14. use Illuminate\Support\Facades\Auth;
  15. use Illuminate\Support\Facades\Storage;
  16. class ActiveController extends Controller{
  17. public function active(){
  18. $user=Auth::user();
  19. $data=System::get();
  20. $now=(Carbon::now()->timestamp)*1000;
  21. foreach ($data as $k=>$v){
  22. $re[$v->keys]=$v->values;
  23. }
  24. $ups=$this->explode($re['upgrade_standard']);
  25. $time=$this->explode($re['activity_time']);
  26. if ($user->level_change==0){
  27. $data['status']=0;
  28. }elseif ($user->level_change==1){
  29. $data['status']=1;
  30. }
  31. $data['start']=strtotime($time['first'])*1000;
  32. $data['end']=strtotime($time['two'])*1000;
  33. if ($now<$data['start']||$now>$data['end']){
  34. $data['isActive']=false;
  35. }else{
  36. $data['isActive']=true;
  37. }
  38. $data['top_money']=$ups['first'];
  39. $data['crown_money']=$ups['two'];
  40. return $this->success($data);
  41. }
  42. public function explode($data){
  43. $re=explode('/',$data);
  44. return ['first'=>$re[0],'two'=>$re[1]];
  45. }
  46. }