Authored by biao

Merge branch 'develop/wap' of http://git.dev.yoho.cn/web/yohobuy into develop/wap

AnyPicker @ 6206acd1
  1 +Subproject commit 6206acd137894609015041be1d59d9684690f8fe
@@ -24,6 +24,15 @@ server @@ -24,6 +24,15 @@ server
24 proxy_set_header Accept-Encoding "gzip"; 24 proxy_set_header Accept-Encoding "gzip";
25 } 25 }
26 26
  27 + location = /rn/v1 {
  28 + proxy_redirect off;
  29 + proxy_pass http://yohobuy;
  30 + proxy_set_header Host $host;
  31 + proxy_set_header X-Real-IP $remote_addr;
  32 + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  33 + proxy_set_header Accept-Encoding "gzip";
  34 + }
  35 +
27 location = /appembed { 36 location = /appembed {
28 default_type application/json; 37 default_type application/json;
29 return 200 '{"code":200,"message":"app embed","data":{"open":"N","url":"http://m.yohobuy.com"}}'; 38 return 200 '{"code":200,"message":"app embed","data":{"open":"N","url":"http://m.yohobuy.com"}}';
@@ -12,23 +12,27 @@ @@ -12,23 +12,27 @@
12 <div class="title"> 12 <div class="title">
13 昵称 13 昵称
14 </div> 14 </div>
15 - <input type="text" name="nick" placeholder="请输入您帅气的名字!" value="" maxlength="5"> 15 + <input type="text" name="nick" placeholder="请输入您帅气的名字!" value="" maxlength="20">
16 </div> 16 </div>
17 <div class="user-info birthday"> 17 <div class="user-info birthday">
18 <div class="title"> 18 <div class="title">
19 生日 19 生日
20 </div> 20 </div>
21 - <input type="date" name="birthday" value="{{birthday}}" min="1900-01-01" max="2016-01-01"> 21 + <input class="birthday-picker" type="text" name="birthday" value="{{birthday}}" min="1900-01-01" max="2016-02-29" readonly>
  22 + <!-- <div class="birthday-div">
  23 + <span>{{birthday}}</span>
  24 + <input class="birthday-input" type="date" name="birthday" value="{{birthday}}" min="1900-01-01" max="2016-02-29">
  25 + </div> -->
22 </div> 26 </div>
23 <div class="gender"> 27 <div class="gender">
24 <div class="title"> 28 <div class="title">
25 性<br>别 29 性<br>别
26 </div> 30 </div>
27 <div class="icon boy"> 31 <div class="icon boy">
28 - <span class="check {{#if gender}}checked{{/if}}" data-gender="{{#if gender}}1{{/if}}"></span> 32 + <span class="check {{#if isBoy}}checked{{/if}}" data-gender="1"></span>
29 </div> 33 </div>
30 <div class="icon girl"> 34 <div class="icon girl">
31 - <span class="check {{#unless gender}}checked{{/if}}" data-gender="{{#if gender}}2{{/if}}"></span> 35 + <span class="check {{#unless isBoy}}checked{{/if}}" data-gender="2"></span>
32 </div> 36 </div>
33 <input type="hidden" name="gender" id="gender" value="{{gender}}"> 37 <input type="hidden" name="gender" id="gender" value="{{gender}}">
34 </div> 38 </div>
@@ -44,7 +48,9 @@ @@ -44,7 +48,9 @@
44 <div class="modal"> 48 <div class="modal">
45 <div class="icon close"></div> 49 <div class="icon close"></div>
46 <div class="text"> 50 <div class="text">
47 - 你还没有<br>完善信息哦 51 + 请输入您
  52 + <br>
  53 + 帅气的名字!
48 </div> 54 </div>
49 <div class="btn close"> 55 <div class="btn close">
50 现在就完善 56 现在就完善
@@ -52,4 +58,5 @@ @@ -52,4 +58,5 @@
52 </div> 58 </div>
53 </div> 59 </div>
54 </div> 60 </div>
  61 +<link rel="stylesheet" type="text/css" href="http://cdn.yoho.cn/huodong/2016yuanxiao/AnyPicker/dist/anypicker-all.min.css" />
55 {{> cuxiao/yuanxiao/footer}} 62 {{> cuxiao/yuanxiao/footer}}
@@ -18,10 +18,21 @@ @@ -18,10 +18,21 @@
18 </div> 18 </div>
19 19
20 <div class="footer"> 20 <div class="footer">
  21 + {{#if needShare}}
21 <div class="share"> 22 <div class="share">
22 分享2016年潮流运势 23 分享2016年潮流运势
23 </div> 24 </div>
  25 + {{/if}}
  26 + </div>
  27 +
  28 + <div class="mask hide">
  29 + <div class="share-icon">
  30 + </div>
24 </div> 31 </div>
25 </div> 32 </div>
  33 +<input type="hidden" id="shareTitle" value="{{shareTitle}}">
  34 +<input type="hidden" id="shareDesc" value="{{shareDesc}}">
  35 +<input type="hidden" id="shareImg" value="{{shareImg}}">
  36 +<input type="hidden" id="shareLink" value="{{shareUrl}}">
26 {{> cuxiao/yuanxiao/type}} 37 {{> cuxiao/yuanxiao/type}}
27 {{> cuxiao/yuanxiao/footer}} 38 {{> cuxiao/yuanxiao/footer}}
@@ -2,4 +2,5 @@ @@ -2,4 +2,5 @@
2 {{#staticJS}} 2 {{#staticJS}}
3 <script type="text/javascript" src="{{../staticFile}}/js/{{.}}"></script> 3 <script type="text/javascript" src="{{../staticFile}}/js/{{.}}"></script>
4 {{/staticJS}} 4 {{/staticJS}}
  5 +<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
5 </body> 6 </body>
@@ -9,8 +9,8 @@ use Plugin\Helpers; @@ -9,8 +9,8 @@ use Plugin\Helpers;
9 */ 9 */
10 class YuanxiaoController extends HuodongAction 10 class YuanxiaoController extends HuodongAction
11 { 11 {
12 - // const STATIC_FILE = 'http://localhost:2222/assets/1.0.2';  
13 - const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016yuanxiao/1.0.2'; 12 + // const STATIC_FILE = 'http://localhost:2222/assets/1.0.6';
  13 + const STATIC_FILE = 'http://cdn.yoho.cn/huodong/2016yuanxiao/1.0.6';
14 const ENCRYPT_KEY = 'iamgtskkwhoareyou'; 14 const ENCRYPT_KEY = 'iamgtskkwhoareyou';
15 15
16 /** 16 /**
@@ -66,7 +66,7 @@ class YuanxiaoController extends HuodongAction @@ -66,7 +66,7 @@ class YuanxiaoController extends HuodongAction
66 'name' => $nickName, 66 'name' => $nickName,
67 'type' => $result['data']['randomCode'] 67 'type' => $result['data']['randomCode']
68 ); 68 );
69 - $this->setCookie('yuanxiaochouqian', json_encode($cookieData), time() + 15*60); 69 + $this->setCookie('yuanxiaochouqian', json_encode($cookieData), time() + 15 * 60);
70 $this->go(Helpers::url('/cuxiao/yuanxiao/wait')); 70 $this->go(Helpers::url('/cuxiao/yuanxiao/wait'));
71 } else { // 不成功就显示返回的错误信息 71 } else { // 不成功就显示返回的错误信息
72 $this->_view->display('info', array( 72 $this->_view->display('info', array(
@@ -77,6 +77,7 @@ class YuanxiaoController extends HuodongAction @@ -77,6 +77,7 @@ class YuanxiaoController extends HuodongAction
77 ), 77 ),
78 'birthday' => $birthday, 78 'birthday' => $birthday,
79 'gender' => $gender, 79 'gender' => $gender,
  80 + 'isBoy' => $gender == 1, // 性别是否是女标志位
80 'message' => $result['message'] 81 'message' => $result['message']
81 )); 82 ));
82 } 83 }
@@ -91,6 +92,7 @@ class YuanxiaoController extends HuodongAction @@ -91,6 +92,7 @@ class YuanxiaoController extends HuodongAction
91 ), 92 ),
92 'birthday' => $userData['birthday'], 93 'birthday' => $userData['birthday'],
93 'gender' => $userData['gender'], 94 'gender' => $userData['gender'],
  95 + 'isBoy' => $userData['gender'] == 1 // 性别是否是女标志位
94 )); 96 ));
95 } 97 }
96 } 98 }
@@ -121,9 +123,9 @@ class YuanxiaoController extends HuodongAction @@ -121,9 +123,9 @@ class YuanxiaoController extends HuodongAction
121 $this->auditJumpLogin(); 123 $this->auditJumpLogin();
122 124
123 $result = $this->getCookie('yuanxiaochouqian', null); 125 $result = $this->getCookie('yuanxiaochouqian', null);
124 - // if (empty($result)) { // 未取到信息就重新测试  
125 - // $this->go(Helpers::url('/cuxiao/yuanxiao/info'));  
126 - // } 126 + if (empty($result)) { // 未取到信息就重新测试
  127 + $this->go(Helpers::url('/cuxiao/yuanxiao/info')); }
  128 +
127 // cookie中存的结果 129 // cookie中存的结果
128 $result = json_decode($result, true); 130 $result = json_decode($result, true);
129 $shareUrl = Helpers::url('/cuxiao/yuanxiao/share', array( 131 $shareUrl = Helpers::url('/cuxiao/yuanxiao/share', array(
@@ -132,9 +134,12 @@ class YuanxiaoController extends HuodongAction @@ -132,9 +134,12 @@ class YuanxiaoController extends HuodongAction
132 134
133 $this->_view->display('result', array( 135 $this->_view->display('result', array(
134 'staticTitle' => '元宵抽签', 136 'staticTitle' => '元宵抽签',
135 - 'weixinShare' => $this->_isApp ? false : true, // 是否需要微信分享 137 + 'needShare' => $this->checkNeedShare(), // 是否需要微信分享
136 'staticFile' => self::STATIC_FILE, 138 'staticFile' => self::STATIC_FILE,
137 'result' => $result, 139 'result' => $result,
  140 + 'shareTitle' => $result['name'] . '的2016年潮流运势是' . $this->getChouqianTitle($result['type']),
  141 + 'shareDesc' => '元宵快乐!一起来YOHO!BUY有货玩2016年潮流开运测试!',
  142 + 'shareImg' => 'http://img02.yohoboys.com/staticimg/2016/02/19/16/02dbd38c84eccf1097b7e240452f0de856.png',
138 'shareUrl' => $shareUrl, 143 'shareUrl' => $shareUrl,
139 'staticJS' => array( 144 'staticJS' => array(
140 'result.js' 145 'result.js'
@@ -170,6 +175,33 @@ class YuanxiaoController extends HuodongAction @@ -170,6 +175,33 @@ class YuanxiaoController extends HuodongAction
170 )); 175 ));
171 } 176 }
172 177
  178 +
  179 + /**
  180 + * 根据结果类型获取抽签结果标题
  181 + * @param $type
  182 + */
  183 + private function getChouqianTitle($type)
  184 + {
  185 + $data = array(
  186 + 'P1' => '成为一个大写加粗的潮人!',
  187 + 'P2' => '逼格满载盐值爆表!',
  188 + 'P3' => '运气爆棚,拥有Yeezy不是梦!',
  189 + 'P4' => '街拍不断,成为网红不是梦!',
  190 + 'M1' => '穿着MA-1飞行夹克一飞冲天!',
  191 + 'M2' => '把妹不花钱!买鞋不排队!',
  192 + 'M3' => '穿着跑鞋到达人生巅峰!',
  193 + 'M4' => '帅气多金颜值高!',
  194 + 'F1' => '拥有拆不完的快递和礼物!
  195 +',
  196 + 'F2' => '被男神强势壁咚!',
  197 + 'F3' => '腿细胸大屁股翘!',
  198 + 'F4' => '任何style都轻松驾驭!
  199 +'
  200 + );
  201 +
  202 + return $data[$type];
  203 + }
  204 +
173 /** 205 /**
174 * 检测登录状态 206 * 检测登录状态
175 * 207 *
@@ -187,6 +219,19 @@ class YuanxiaoController extends HuodongAction @@ -187,6 +219,19 @@ class YuanxiaoController extends HuodongAction
187 } 219 }
188 220
189 /** 221 /**
  222 + * 判断是否需要微信分享
  223 + * @return bool
  224 + */
  225 + private function checkNeedShare()
  226 + {
  227 + if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger') !== false || $this->_isApp) {
  228 + return true;
  229 + }
  230 +
  231 + return false;
  232 + }
  233 +
  234 + /**
190 * 加密字符串 235 * 加密字符串
191 * 236 *
192 * @param string $data 需要加密的字符串 237 * @param string $data 需要加密的字符串
  1 +<?php
  2 +
  3 +use Action\AbstractAction;
  4 +
  5 +/**
  6 + * Created by PhpStorm.
  7 + * User: Leo
  8 + * Date: 16/2/17
  9 + * Time: 上午11:48
  10 + */
  11 +class RnController extends AbstractAction
  12 +{
  13 +
  14 + const PRIVATE_KEY = 'fd4ad5fcsa0de589af23234ks1923ks';
  15 +
  16 + /**
  17 + * V1版本
  18 + *
  19 + * 参数列表
  20 + * -------------------------------------------------------------------------
  21 + * 字段 描述 类型 示例
  22 + * app_version 当前版本号 string 3.8.0
  23 + * uid 用户ID string 13423331
  24 + * client_type 用户手机系统:Android,IOS string Android
  25 + * screen_size 屏幕尺寸 string 1080x1920
  26 + * udid 设备唯一码 string 1d123sadao3
  27 + * os_version 设备版本号 string 1d123sadao3
  28 + * rnv bundle版本号,如果本地没有补丁,传空 string 100
  29 + * minv 最低支持的版本号
  30 + *
  31 + * 返回列表
  32 + * -------------------------------------------------------------------------
  33 + * 字段 描述 类型 示例
  34 + * code 返回的code,200,304等,具体的服务器定义 int 200
  35 + * message 信息 string "Config Success"
  36 + * md5 当前请求的唯一码 string "1234567890123456"
  37 + * data 配置参数数据,参考data列表 object
  38 + * [
  39 + * url 补丁url地址,没有传空 string http://yohocdn.com/fpath/fpkk.js
  40 + * rnv 当前bundle的版本号,没有就传空 string "100"
  41 + * filecode md5(md5(文件内容) + "yohorn2016") string "1233321121212332"
  42 + * ]
  43 + * echo md5(file_get_contents('http://cdn.yoho.cn/app-hotfix/yohobuy/4.0.0/main2.js'));
  44 + */
  45 + public function v1Action()
  46 + {
  47 + $result = array('code' => 200, 'message' => 'Config Success', 'md5' => '', 'data' => array());
  48 +
  49 + // 根据版本号返回补丁文件信息
  50 + $version = $this->post('app_version');
  51 + switch ($version) {
  52 + case '4.0.0': // 版本号
  53 + $result['data']['url'] = '';
  54 + $result['data']['rnv'] = '';
  55 + $result['data']['minv'] = '';
  56 +// $result['data']['filecode'] = md5('b3e54e59cb41453623360a55e9588361' . 'yohorn2016');
  57 + $result['data']['filecode'] = '';
  58 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  59 + break;
  60 + default: // 默认
  61 + $result['data']['url'] = '';
  62 + $result['data']['rnv'] = '';
  63 + $result['data']['filecode'] = '';
  64 + $result['md5'] = md5(self::PRIVATE_KEY . ':' . json_encode($result['data']));
  65 + }
  66 +
  67 + $this->echoJson($result);
  68 + }
  69 +
  70 +}