<?php
/*
 本代码由 焕岱科技 创建
 技术支持 WX：15285007200
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;

class App extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function version()
    {
        $a_bversion = $this->param("a_bversion/s");
        $bbfx = Db::name("bbfx")->find();
        $version = $bbfx['a_version'];
        $version_name = $bbfx['a_version_name'];


        $result = [
            'version'=>$version,
            'version_name'=>$version_name,
            'update_url'=>request()->domain()."/app/{$version_name}.wgt",
            'app_url'=>request()->domain()."/app/{$version_name}.apk"
        ];

        if($a_bversion != $bbfx['a_bversion']){
            $result['update_url'] = $result['app_url'];
        }

        addFileLog("bb111",json_encode($result));
          
        __success("操作成功",$result);
    }

    public function newVersionNumber(){
        $bbfx = Db::name("bbfx")->find();
        __success("操作成功",['version'=>$bbfx['version'],'version_name'=>$bbfx['version_name']]);
    }
}