rn.js 1.31 KB
'use strict';
const md5 = require('md5');
const PRIVATE_KEY = 'fd4ad5fcsa0de589af23234ks1923ks';

const v1 = (req, res) => {
    let result = {
        code: 400,
        message: 'Config Success',
        data: {}
    };

    let version = req.body.app_version || '';

    switch (version) {
        case '4.0.1':
            result.data.url = 'http://cdn.yoho.cn/app-reactnative/4.0.1/main.zip';
            result.data.rnv = '101';
            result.data.minv = '4.0.1';
            result.data.filecode = md5('dffb998e43a33215b4c47a4ccd3cf619yohorn2016');
            result.md5 = md5(PRIVATE_KEY + ':' + JSON.stringify(result.data));
            break;
        case '4.1.0':
            result.data.url = 'http://cdn.yoho.cn/app-downfiles/index.android.bundle.zip';
            result.data.rnv = '101';
            result.data.minv = '4.1.0';
            result.data.filecode = md5('47c47db1eec6159f940e2018d3a83676yohorn2016');
            result.md5 = md5(PRIVATE_KEY + ':' + JSON.stringify(result.data));
            break;
        default:
            result.data.url = '';
            result.data.rnv = '';
            result.data.minv = '';
            result.data.filecode = '';
            result.md5 = md5(PRIVATE_KEY + ':' + JSON.stringify(result.data));
    }

    return res.json(result);
};

module.exports = {
    v1
};