Authored by 曹镏

调整hf接口

@@ -7,8 +7,8 @@ use Action\AbstractAction; @@ -7,8 +7,8 @@ use Action\AbstractAction;
7 * @name HfController 7 * @name HfController
8 * @package 8 * @package
9 * @copyright yoho.inc 9 * @copyright yoho.inc
10 - * @version 1.0 (2016-2-3 11:34:40)  
11 - * @author fei.hong <fei.hong@yoho.cn> 10 + * @version 1.1 (2016-5-23 9:57:40) 增加android接口
  11 + * @author CL
12 */ 12 */
13 class HfController extends AbstractAction 13 class HfController extends AbstractAction
14 { 14 {
@@ -20,57 +20,92 @@ class HfController extends AbstractAction @@ -20,57 +20,92 @@ class HfController extends AbstractAction
20 * 20 *
21 * 参数列表 21 * 参数列表
22 * ------------------------------------------------------------------------- 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 - * patchv 补丁版本号,如果本地没有补丁,传空 string 100 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 + * patchv 补丁版本号,如果本地没有补丁,传空 string 100
31 * 31 *
32 * 返回列表 32 * 返回列表
33 * ------------------------------------------------------------------------- 33 * -------------------------------------------------------------------------
34 - * 字段 描述 类型 示例  
35 - * code 返回的code,200,304等,具体的服务器定义 int 200  
36 - * message 信息 string "Config Success"  
37 - * md5 当前请求的唯一码 string "1234567890123456"  
38 - * data 配置参数数据,参考data列表 object 34 + * 字段 描述 类型 示例
  35 + * code 返回的code,200,304等,具体的服务器定义 int 200
  36 + * message 信息 string "Config Success"
  37 + * md5 当前请求的唯一码 string "1234567890123456"
  38 + * data 配置参数数据,参考data列表 object
39 * [ 39 * [
40 - * url 补丁url地址,没有传空 string http://yohocdn.com/fpath/fpkk.js  
41 - * patchv 当前补丁的版本号,没有就传空 string "100"  
42 - * filecode md5(md5(文件内容) + "yohopatch2016") string "1233321121212332" 40 + * url 补丁url地址,没有传空 string http://yohocdn.com/fpath/fpkk.js
  41 + * patchv 当前补丁的版本号,没有就传空 string "100"
  42 + * filecode md5(md5(文件内容) + "yohopatch2016") string "1233321121212332"
43 * ] 43 * ]
44 * echo md5(file_get_contents('http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.1/main-4.js')); exit; 44 * echo md5(file_get_contents('http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.1/main-4.js')); exit;
45 */ 45 */
46 - public function v1Action() 46 + public function v1Action()
47 { 47 {
48 $result = array('code' => 200, 'message' => 'Config Success', 'md5' => '', 'data' => array()); 48 $result = array('code' => 200, 'message' => 'Config Success', 'md5' => '', 'data' => array());
49 -  
50 - // 根据版本号返回补丁文件信息 49 + $clienttype = $this->post('client_type');
51 $version = $this->post('app_version'); 50 $version = $this->post('app_version');
52 - switch ($version) {  
53 -// case '4.0.1': // 版本  
54 -// $result['data']['url'] = 'http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.1/main-4.js';  
55 -// $result['data']['patchv'] = '103';  
56 -// $result['data']['filecode'] = md5('f9c03ec39cfb2686d2b778e444fb2306' . 'yohopatch2016');  
57 -// $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));  
58 -// break;  
59 - case '4.0.0': // 版本  
60 - $result['data']['url'] = 'http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.0/main2.js';  
61 - $result['data']['patchv'] = '102';  
62 - $result['data']['filecode'] = md5('dddd71eed2754a53ad843a78587dc1f5' . 'yohopatch2016');  
63 - $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));  
64 - break;  
65 - default: // 默认  
66 - $result['data']['url'] = '';  
67 - $result['data']['patchv'] = '';  
68 - $result['data']['filecode'] = '';  
69 - $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));  
70 - break;  
71 - } 51 +
  52 + $ios = 'ios';
  53 + $android = 'android';
  54 +
  55 + // 根据版本号返回补丁文件信息
  56 +
  57 + if (strcasecmp($clienttype, $ios) == 0){
  58 +
  59 + switch ($version) {
  60 + // case '4.0.1': // 版本
  61 + // $result['data']['url'] = 'http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.1/main-4.js';
  62 + // $result['data']['patchv'] = '103';
  63 + // $result['data']['filecode'] = md5('f9c03ec39cfb2686d2b778e444fb2306' . 'yohopatch2016');
  64 + // $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  65 + // break;
  66 + case '4.0.0': // 版本
  67 + $result['data']['url'] = '';
  68 + $result['data']['patchv'] = '';
  69 + $result['data']['filecode'] = md5('dddd71eed2754a53ad843a78587dc1f5' . 'yohopatch2016');
  70 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  71 + // var_dump('ios 4.0');
  72 + break;
  73 + default: // 默认
  74 + $result['data']['url'] = '';
  75 + $result['data']['patchv'] = '';
  76 + $result['data']['filecode'] = '';
  77 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  78 + // var_dump('ios 4.1');
  79 + break;
  80 + }
72 81
73 - $this->echoJson($result); 82 + }
  83 + else if (strcasecmp($clienttype, $android) == 0){
  84 +
  85 + switch ($version) {
  86 + case '4.4.0': // 版本
  87 + $result['data']['url'] = 'http://cdn.yoho.cn/app-hotfix/yohobuy/a/4.3.0/201605191600.apatch';
  88 + $result['data']['patchv'] = '103';
  89 + $result['data']['filecode'] = md5('c1edcb91fc0eb56a4699e0b31e942d06' . 'yohopatch2016');
  90 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  91 + // var_dump('android 4.3.0');
  92 + break;
  93 + default: // 默认
  94 + $result['data']['url'] = '';
  95 + $result['data']['patchv'] = '';
  96 + $result['data']['filecode'] = '';
  97 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  98 + // var_dump('android noversion');
  99 + break;
  100 + }
  101 +
  102 + }
  103 + else
  104 + {
  105 + // var_dump('no found app clienttype');
  106 +
  107 + }
  108 + $this->echoJson($result);
74 } 109 }
75 110
76 } 111 }