DownloadController.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Http\Home\Ocr;
  3. use App\Http\Home\HttpBaseController;
  4. use Illuminate\Support\Facades\DB;
  5. use Illuminate\Support\Facades\Request;
  6. class DownloadController extends HttpBaseController
  7. {
  8. private $softInfo = [
  9. 'id' => 7,
  10. 'mid' => "79b9a46daa57",
  11. 'weight' => "0.00",
  12. 'is_delete' => 0,
  13. 'title' => "助友音频处理器",
  14. ];
  15. public function __construct()
  16. {
  17. parent::__construct();
  18. }
  19. /**
  20. * 首页
  21. */
  22. public function index()
  23. {
  24. $deviceType = Request::input('type'); // '操作系统类型 windows linux android ios
  25. if (!in_array($deviceType, ['windows', 'linux', 'android', 'ios'])) {
  26. $deviceType = 'windows';
  27. }
  28. // 获取下载地址,然后跳转
  29. $info = DB::table('product_version')
  30. ->where('os_type', $deviceType)
  31. ->where('id', $this->softInfo['id'])
  32. ->where('status', 1)
  33. ->orderBy('id', 'desc')
  34. ->first();
  35. if (empty($info)) {
  36. $url = '/';
  37. } else {
  38. $url = $info->download_url;
  39. }
  40. return responseMessage(1001, '', $url);
  41. }
  42. }