ShareController.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace App\Http\Controllers\Share;
  3. use App\Managers\SharePairManager;
  4. use App\Services\Share\GteamService;
  5. use App\Http\Controllers\Controller;
  6. use App\Http\Controllers\Core\Auth;
  7. use App\Services\Share\FlowerService;
  8. use App\Services\Share\LockService;
  9. class ShareController extends Controller
  10. {
  11. public function ing()
  12. {
  13. $uid = Auth::auth();
  14. // 72小时
  15. $ps = new SharePairManager();
  16. $pairdata = $ps->inglist($uid);
  17. // 解锁卡片任务
  18. $ls = new LockService();
  19. $lockdata = $ls->inglist($uid);
  20. // 小fa分享
  21. $fs = new FlowerService();
  22. $flowerdata = $fs->ing($uid);
  23. // 开黑任务
  24. $gs = new GteamService();
  25. $gteamdata = $gs->inglist($uid);
  26. $data = array();
  27. foreach ($pairdata as $tmp) {
  28. $data[] = $tmp;
  29. }
  30. foreach ($lockdata as $tmp) {
  31. $data[] = $tmp;
  32. }
  33. foreach ($flowerdata as $tmp) {
  34. $data[] = $tmp;
  35. }
  36. foreach ($gteamdata as $tmp) {
  37. $data[] = $tmp;
  38. }
  39. usort($data, function ($a, $b) {
  40. if ($a['expired_at'] > $b['expired_at']) {
  41. return false;
  42. } else {
  43. return true;
  44. }
  45. });
  46. return array(
  47. 'code' => 200,
  48. 'message' => 'success',
  49. 'data' => $data
  50. );
  51. }
  52. }