app_update.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * 更新
  4. */
  5. defined('InShopNC') or exit('Access Invalid!');
  6. class app_updateControl extends mobileHomeControl
  7. {
  8. public function __construct()
  9. {
  10. parent::__construct();
  11. }
  12. public function check_verOp()
  13. {
  14. return $this->checkVersionOp();
  15. }
  16. public function checkVersionOp()
  17. {
  18. $ver_code = $_GET['ver_code'];
  19. if($this->android() == false || !isset($ver_code) || empty($ver_code) || intval($ver_code) <= 0) {
  20. return self::outerr(errcode::ErrParamter,"需要带入手机及版本信息");
  21. }
  22. $verinfo = rkcache('android_version',true);
  23. $result = array();
  24. if ($ver_code == $verinfo['ver_code']) {
  25. $result['latest'] = 0; //设计协议设计反了,0 表示目前是最新版本,1 表示不是最新版本
  26. }
  27. else
  28. {
  29. $result['latest'] = 1;
  30. $lowest_compatible_version = intval($verinfo['lowest_compatible_version']);
  31. if ($lowest_compatible_version > intval($ver_code)) {
  32. $result['force_update'] = 1;
  33. } else {
  34. $result['force_update'] = 0;
  35. }
  36. $update_info = array();
  37. $update_info['ver_code'] = $verinfo['ver_code'];
  38. $update_info['app_path'] = $verinfo['app_path'];
  39. $update_info['release_note'] = $verinfo['release_note'];
  40. $update_info['remind_time'] = $verinfo['remind_time'];
  41. $update_info['md5_file'] = $verinfo['md5_file'];
  42. $update_info['app_path'] = BASE_SITE_URL . $verinfo['app_path'];
  43. $result['update_info'] = $update_info;
  44. }
  45. self::outsuccess($result);
  46. }
  47. }