|
|
<?php
|
|
|
namespace Sdk\Controller;
|
|
|
use Think\Controller;
|
|
|
use Common\Api\GameApi;
|
|
|
use Org\SwiftpassSDK\Swiftpass;
|
|
|
use Org\WeixinSDK\Weixin;
|
|
|
use Org\JtpaySDK\Jtpay;
|
|
|
use Org\GoldPig\GoldPig;
|
|
|
|
|
|
/**
|
|
|
* 信息控制器
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
class InfoController extends BaseController{
|
|
|
|
|
|
/**
|
|
|
* 版本信息
|
|
|
* [@param $version 版本(1:安卓,2:苹果)]
|
|
|
* @author 鹿文学
|
|
|
*/
|
|
|
public function version() {
|
|
|
|
|
|
$request = json_decode(base64_decode(file_get_contents("php://input")), true);
|
|
|
|
|
|
$data = [];
|
|
|
|
|
|
$data['version_name']=C('APP_NAME');
|
|
|
|
|
|
$return = array();
|
|
|
|
|
|
$app = M('app','tab_');
|
|
|
|
|
|
$field = 'id,name,file_url,file_size,remark,version';
|
|
|
|
|
|
$url = 'http://'.$_SERVER['HTTP_HOST'];
|
|
|
|
|
|
switch($request['sdk_version']) {
|
|
|
case 1:{
|
|
|
$data['and_version_code'] = C('APP_VERSION');
|
|
|
$result = $app->field($field)->where(['id'=>1])->find();
|
|
|
if(is_array($result)) {
|
|
|
$data['and_file_url'] = $url . substr($result['file_url'],1);
|
|
|
$data['and_file_size'] = $result['file_size'];
|
|
|
$data['and_remark'] = $result['remark']?json_decode($result['remark']):[];
|
|
|
}
|
|
|
|
|
|
};break;
|
|
|
case 2:{
|
|
|
$data['ios_version_code'] = C('IOS_VERSION');
|
|
|
$result = $app->field($field)->where(['id'=>4])->find();
|
|
|
if(is_array($result)) {
|
|
|
$data['ios_file_url'] = $url . substr($result['file_url'],1);
|
|
|
$data['ios_file_size'] = $result['file_size'];
|
|
|
$data['ios_remark'] = $result['remark']?json_decode($result['remark']):[];
|
|
|
|
|
|
}
|
|
|
};break;
|
|
|
default:
|
|
|
$data['and_version_code'] = C('APP_VERSION');
|
|
|
$data['ios_version_code'] = C('IOS_VERSION');
|
|
|
$result = $app->field($field)->where(['id'=>['in',[1,4]]])->select();
|
|
|
foreach($result as $k => $v) {
|
|
|
if($v['version']==1) {
|
|
|
$data['and_file_url'] = $url . substr($v['file_url'],1);
|
|
|
$data['and_file_size'] = $v['file_size'];
|
|
|
$data['and_remark'] = $v['remark']?json_decode($v['remark']):[];
|
|
|
} elseif($v['version']==2) {
|
|
|
$data['ios_file_url'] = $url . substr($v['file_url'],1);
|
|
|
$data['ios_file_size'] = $v['file_size'];
|
|
|
$data['ios_remark'] = $v['remark']?json_decode($v['remark']):[];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
$this->new_set_message(200, "success", $data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|