Files
2024-09-27 01:32:49 +08:00

98 lines
2.8 KiB
PHP
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* Created by PhpStorm && wx_lql
* Welfares.php in Project yifu => 文件描述
* 2019/8/7 11:05
*
*  ┏┓  ┏┓+ +
* ┏┛┻━━━┛┻┓ + +
* ┃       ┃  
* ┃   ━   ┃ ++ + + +
*
* ████━████ ┃+
* ┃       ┃ +
* ┃   ┻   ┃
* ┃       ┃ + +
* ┗━┓   ┏━┛
*   ┃   ┃           
*   ┃   ┃ + + + +
*   ┃   ┃
*   ┃   ┃ + 神兽保佑
*   ┃   ┃ 代码无bug  
*   ┃   ┃  +         
*   ┃    ┗━━━┓ + +
*   ┃      ┣┓
*   ┃      ┏┛
*   ┗┓┓┏━┳┓┏┛ + + + +
*    ┃┫┫ ┃┫┫
*   ┗┻┛ ┗┻┛+ + + +
*/
namespace app\api\controller;
class VersionController extends ApiController
{
/**
* @apiDefine Version 版本管理
*/
/**
* 不需要鉴权方法
* index、save不需要鉴权
* ['index','save']
* 所有方法都不需要鉴权
* [*]
*/
protected $noAuth = ['index'];
/**
* @apiVersion 1.0.0
* @api {get} /version/index 版本更新检测(朱晓伟)
* @apiName index
* @apiGroup Version
* @apiParam {String} [version] 当前版本号用于版本对比例如1.0.0,只允许使用"."分割,不支持下划线
* @apiSuccessExample Success-Response:
* {
* "code": 200,
* "message": "成功",
* "data": {
* "version": 1.0.1,
* "url": "http://www.baidu.com",
* "describe": "有重大更新啦!!",
* "update_method": 0,// 更新方式0:普通更新1、强制更新
* }
* }
* @apiErrorExample Error-Response:
* {
* "code": 200,
* "message": "无更新",
* "data": {}
* }
*/
public function index()
{
$new_version = '1.4.0';
$version =input('param.version');
$ret['isUpdate'] = false;
$ret['update_method'] = false;
if(version_compare($new_version,$version) > 0){
$data['version'] = $new_version;
$data['url'] = 'itms-apps://apps.apple.com/cn/app/qq-2011/id444934666';
$data['describe'] = '1.修复已知bug;
2.细节优化;';
$ret['iOS'] = $data;
$data['version'] = $new_version;
$data['url'] = 'http://d.firim.info/aw7u';
$data['describe'] = '1.修复已知bug;
2.细节优化;';
$ret['Android'] = $data;
$ret['isUpdate'] = true;
$ret['update_method'] = true;
return self::returnMsg(self::SUCCESS, self::getMessage('SUCCESS'), $ret);
}
return self::returnMsg(self::SUCCESS, '无更新',$ret);
}
}