common.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. # return array(video, journal_buy) 1为可以、2为不可以
  3. function checkVersion()
  4. {
  5. $video = 1;
  6. $journal_buy = 1;
  7. $mobile = 1;
  8. $config = Dever::db('main/config')->one();
  9. $source_type = Dever::input('source_type');
  10. #小程序去掉视频
  11. $app = false;
  12. if ($source_type == 'ios' || $source_type == 'android') {
  13. $app = true;
  14. }
  15. $app = true;
  16. if ((isset($config['video']) && $config['video'] == 2) || !$app) {
  17. $video = 2;
  18. } elseif (isset($config['version']) && Dever::input('version') && $config['version'] == Dever::input('version')) {
  19. $video = 2;
  20. $journal_buy = 2;
  21. $mobile = 2;
  22. }
  23. return (object) array('video' => $video, 'journal_buy' => $journal_buy, 'mobile' => $mobile);
  24. }
  25. /**
  26. * 音视频转换
  27. */
  28. function convert($url, $ext = 'mp4', $table = false, $id = false, $col = '')
  29. {
  30. if ($url && !strstr($url, '_c.' . $ext)) {
  31. $file = $url . '_c.' . $ext;
  32. if (Dever::is_file($file)) {
  33. $url = $file;
  34. if ($table) {
  35. Dever::db($table)->update(array('where_id' => $id, $col => $file));
  36. }
  37. }
  38. }
  39. return $url;
  40. }