Authored by Rock Zhang

格式化元宵抽签活动中生日以便接口接收和前端显示

Code Review By Rock Zhang
@@ -30,9 +30,6 @@ class YuanxiaoController extends HuodongAction @@ -30,9 +30,6 @@ class YuanxiaoController extends HuodongAction
30 */ 30 */
31 public function indexAction() 31 public function indexAction()
32 { 32 {
33 - // 该变量用来控制和显示页面的弹出提示  
34 - $showPopupFlag = '0';  
35 -  
36 $this->_view->display('index', array( 33 $this->_view->display('index', array(
37 'staticTitle' => '元宵抽签', 34 'staticTitle' => '元宵抽签',
38 'staticFile' => self::STATIC_FILE, 35 'staticFile' => self::STATIC_FILE,
@@ -58,6 +55,9 @@ class YuanxiaoController extends HuodongAction @@ -58,6 +55,9 @@ class YuanxiaoController extends HuodongAction
58 $birthday = $this->post('birthday', ''); 55 $birthday = $this->post('birthday', '');
59 $gender = $this->post('gender', 1); 56 $gender = $this->post('gender', 1);
60 57
  58 + // 格式化日期以便接口接收
  59 + $birthday = date_format(date_create_from_format('Y年m月d日', $birthday), 'Y-m-d');
  60 +
61 // 调用接口 61 // 调用接口
62 $result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $birthday, $gender); 62 $result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $birthday, $gender);
63 if ($result['code'] === 200) { // 处理成功就跳转到等待页 63 if ($result['code'] === 200) { // 处理成功就跳转到等待页
@@ -90,7 +90,7 @@ class YuanxiaoController extends HuodongAction @@ -90,7 +90,7 @@ class YuanxiaoController extends HuodongAction
90 'staticJS' => array( 90 'staticJS' => array(
91 'info.js' 91 'info.js'
92 ), 92 ),
93 - 'birthday' => $userData['birthday'], 93 + 'birthday' => date_format(date_create($userData['birthday']), 'Y年m月d日'),
94 'gender' => $userData['gender'], 94 'gender' => $userData['gender'],
95 'isBoy' => $userData['gender'] == 1 // 性别是否是女标志位 95 'isBoy' => $userData['gender'] == 1 // 性别是否是女标志位
96 )); 96 ));