<?php
/**
 * Created by PhpStorm.
 * User: pcl
 * Date: 2023/8/14
 * Time: 11:14
 */

namespace app\api\controller;

use app\common\controller\Api;
use think\Db;
use think\Exception;
use think\exception\PDOException;

/**
 * APP下载接口
 */
class App extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 监管APP
     */
    public function jgApp()
    {
        $info = Db::name('appversion')
            ->where(['app_type' => 'jianguan', 'status' => '1'])
            ->field('version_code,apk_url,upgrade_point,images,content,updatetime')
            ->order('id desc')
            ->find();
        if ($info) {
            if (!empty($info['images'])) {
                $imgArr = explode(',', $info['images']);
                $info['images'] = full_image_kevin($imgArr);
            } else {
                $info['images'] = [];
            }
            $info['updatetime'] = date('Y-m-d', $info['updatetime']);
            $this->success('获取成功', $info);
        } else {
            $this->error('暂无下载信息');
        }
    }
}