zoukankan      html  css  js  c++  java
  • php app版本升级的思路

    用户端传递当前app的版本号,再根据机型和app_type ,查找数据库里的版本号 ,去比较 。。。

    CREATE TABLE `common_versioninfo` (
    `id` int(11) NOT NULL COMMENT '数据的id',
    `client_type` tinyint(4) NOT NULL COMMENT '客户端类型(1 IOS 2 android)',
    `app_type` tinyint(4) NOT NULL COMMENT 'APP类型(1 会员版 2医生版 3助理版)',
    `client_version` varchar(255) NOT NULL DEFAULT '' COMMENT '客户端的版本号',
    `server_version` int(11) NOT NULL COMMENT '服务器的版本号',
    `update_note` text NOT NULL COMMENT '更新说明',
    `app_link` varchar(255) NOT NULL COMMENT 'app的下载地址',
    `is_required` tinyint(4) NOT NULL DEFAULT '0' COMMENT '是否强制更新(1强制更新 0选择更新)',
    PRIMARY KEY (`id`)
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='客户端版本信息';

    /**
    * 检测是否有最新的版本
    * @param int $type APP类型(1 会员版 2医生版 3助理版)
    * @param int $client_type 客户端类型(1 IOS 2 android)
    * @param string $version 当前的版本号
    * */
    public function check_version() {
    $current_version = $this->input->post('version');
    $client_type = $this->input->post('client_type');
    $type = $this->input->post('type');
    $this->load->model('Xh_client_model');
    $latest_version = $this->Xh_client_model->get_latest_version($type, $client_type);
    if ($current_version < $latest_version->server_version) {
    $data = array(
    'is_update' => TRUE, //是否需要更新
    'is_required' => $latest_version->is_required == 1 ? TRUE : FALSE, //是否必须更新
    'latest_version' => $latest_version->client_version, //最新的版本号
    'update_note' => $latest_version->update_note, //更新的说明
    'down_link' => $latest_version->app_link//安装包的下载地址
    );
    } else {
    $data = array(
    'is_update' => FALSE, //是否需要更新
    'is_required' => FALSE,
    'latest_version' => $current_version,
    'update_note' => '',
    'down_link' => ''
    );
    }
    format_json(SUCCESS_CODE, $data);
    }

  • 相关阅读:
    C#的ugui与XLua整合的案例
    关于C#调用XLua的函数抛出attempt to call a nil value (global 'print')
    关于文件上传的坑,tomcat一重启图片就消失
    linux服务器安装zookeeper本地项目远程连接
    使用eazyExcel读取数据结合mybatis批量保存到数据库(优化批量保存)
    jpa set值持久化解决办法
    cascade级联关系
    @JoinTable和@JoinColumn
    json操作容易出现的细微问题
    attr和prop的区别
  • 原文地址:https://www.cnblogs.com/lijiageng/p/6050151.html
Copyright © 2011-2022 走看看