Committed by
Niall
新增rn接口
Showing
1 changed file
with
76 additions
and
0 deletions
1 | +<?php | ||
2 | +use Action\AbstractAction; | ||
3 | +/** | ||
4 | + * Created by PhpStorm. | ||
5 | + * User: Leo | ||
6 | + * Date: 16/2/17 | ||
7 | + * Time: 上午11:48 | ||
8 | + */ | ||
9 | + | ||
10 | + | ||
11 | +class RnController extends AbstractAction | ||
12 | +{ | ||
13 | + const PRIVATE_KEY = 'fd4ad5fcsa0de589af23234ks1923ks'; | ||
14 | + | ||
15 | + | ||
16 | + | ||
17 | + | ||
18 | + /** | ||
19 | + * V1版本 | ||
20 | + * | ||
21 | + * 参数列表 | ||
22 | + * ------------------------------------------------------------------------- | ||
23 | + * 字段 描述 类型 示例 | ||
24 | + * app_version 当前版本号 string 3.8.0 | ||
25 | + * uid 用户ID string 13423331 | ||
26 | + * client_type 用户手机系统:Android,IOS string Android | ||
27 | + * screen_size 屏幕尺寸 string 1080x1920 | ||
28 | + * udid 设备唯一码 string 1d123sadao3 | ||
29 | + * os_version 设备版本号 string 1d123sadao3 | ||
30 | + * rnv bundle版本号,如果本地没有补丁,传空 string 100 | ||
31 | + * minv 最低支持的版本号 | ||
32 | + * | ||
33 | + * 返回列表 | ||
34 | + * ------------------------------------------------------------------------- | ||
35 | + * 字段 描述 类型 示例 | ||
36 | + * code 返回的code,200,304等,具体的服务器定义 int 200 | ||
37 | + * message 信息 string "Config Success" | ||
38 | + * md5 当前请求的唯一码 string "1234567890123456" | ||
39 | + * data 配置参数数据,参考data列表 object | ||
40 | + * [ | ||
41 | + * url 补丁url地址,没有传空 string http://yohocdn.com/fpath/fpkk.js | ||
42 | + * rnv 当前bundle的版本号,没有就传空 string "100" | ||
43 | + * filecode md5(md5(文件内容) + "yohorn2016") string "1233321121212332" | ||
44 | + * ] | ||
45 | + * echo md5(file_get_contents('http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.0/main2.js')); | ||
46 | + */ | ||
47 | + public function v1Action() | ||
48 | + { | ||
49 | + | ||
50 | + $result = array('code' => 200, 'message' => 'Config Success', 'md5' => '', 'data' => array()); | ||
51 | +s | ||
52 | + // 根据版本号返回补丁文件信息 | ||
53 | + $version = $this->post('app_version'); | ||
54 | + switch ($version) { | ||
55 | + case '4.0.0': // 版本号 | ||
56 | + $result['data']['url'] = ''; | ||
57 | + $result['data']['rnv'] = ''; | ||
58 | + $result['data']['minv'] = ''; | ||
59 | +// $result['data']['filecode'] = md5('b3e54e59cb41453623360a55e9588361' . 'yohorn2016'); | ||
60 | + $result['data']['filecode'] = ''; | ||
61 | + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data'])); | ||
62 | + break; | ||
63 | + default: // 默认 | ||
64 | + $result['data']['url'] = ''; | ||
65 | + $result['data']['rnv'] = ''; | ||
66 | + $result['data']['filecode'] = ''; | ||
67 | + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data'])); | ||
68 | + } | ||
69 | + | ||
70 | + $this->echoJson($result); | ||
71 | + | ||
72 | + } | ||
73 | + | ||
74 | +} | ||
75 | + | ||
76 | + |
-
Please register or login to post a comment