Authored by 曹镏
Committed by Niall

调整app使用的hf接口

@@ -43,34 +43,69 @@ class HfController extends AbstractAction @@ -43,34 +43,69 @@ class HfController extends AbstractAction
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 }