Merge branch 'feature/wap/yuanxiao' of git.dev.yoho.cn:web/yohobuy into feature/wap/yuanxiao
Showing
5 changed files
with
81 additions
and
19 deletions
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace LibModels\Wap\Cuxiao; | 3 | namespace LibModels\Wap\Cuxiao; |
4 | 4 | ||
5 | +use Api\Sign; | ||
5 | use Api\Yohobuy; | 6 | use Api\Yohobuy; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -69,9 +70,35 @@ class ActivityData | @@ -69,9 +70,35 @@ class ActivityData | ||
69 | } | 70 | } |
70 | 71 | ||
71 | /** | 72 | /** |
73 | + * @param int $uid 用户UID | ||
74 | + * @param string $nickName 用户昵称 | ||
75 | + * @param string $birthday 用户生日 | ||
76 | + * @param int $gender 用户性别 | ||
77 | + * @return mixed 抽签的结果 | ||
78 | + */ | ||
79 | + public static function getYuanxiaoInfo($uid, $nickName, $birthday, $gender) | ||
80 | + { | ||
81 | + $param = Yohobuy::param(); | ||
82 | + $param['method'] = 'wap.activity.draw'; | ||
83 | + $param['uid'] = $uid; | ||
84 | + $param['nick_name'] = $nickName; | ||
85 | + $param['birthday'] = $birthday; | ||
86 | + $param['gender'] = $gender; | ||
87 | + $param['client_secret'] = Sign::getSign($param); | ||
88 | + | ||
89 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
90 | + } | ||
91 | + | ||
92 | + /** | ||
72 | * 发送站内信 | 93 | * 发送站内信 |
73 | - * | ||
74 | - * @param int $activityId 活动ID | 94 | + * |
95 | + * @param int $uid | ||
96 | + * @param string $title | ||
97 | + * @param int $content | ||
98 | + * @param int $type | ||
99 | + * @param string $verify_key | ||
100 | + * @param int $send_uid | ||
101 | + * @param string $call_back | ||
75 | * @return array | 102 | * @return array |
76 | */ | 103 | */ |
77 | public static function message($uid, $title, $content, $type = 1, $verify_key = '', $send_uid = 0, $call_back = '') | 104 | public static function message($uid, $title, $content, $type = 1, $verify_key = '', $send_uid = 0, $call_back = '') |
@@ -28,7 +28,7 @@ | @@ -28,7 +28,7 @@ | ||
28 | <span class="check {{#if gender}}checked{{/if}}" data-gender="{{#if gender}}1{{/if}}"></span> | 28 | <span class="check {{#if gender}}checked{{/if}}" data-gender="{{#if gender}}1{{/if}}"></span> |
29 | </div> | 29 | </div> |
30 | <div class="icon girl"> | 30 | <div class="icon girl"> |
31 | - <span class="check {{#unless gender}}checked{{/if}}" data-gender="{{#if gender}}0{{/if}}"></span> | 31 | + <span class="check {{#unless gender}}checked{{/if}}" data-gender="{{#if gender}}2{{/if}}"></span> |
32 | </div> | 32 | </div> |
33 | <input type="hidden" name="gender" id="gender" value="{{gender}}"> | 33 | <input type="hidden" name="gender" id="gender" value="{{gender}}"> |
34 | </div> | 34 | </div> |
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | namespace Cuxiao; | 3 | namespace Cuxiao; |
4 | +use LibModels\Wap\Cuxiao\ActivityData; | ||
4 | use LibModels\Wap\Home\UserData; | 5 | use LibModels\Wap\Home\UserData; |
5 | 6 | ||
6 | /** | 7 | /** |
@@ -25,7 +26,7 @@ class YuanxiaoModel | @@ -25,7 +26,7 @@ class YuanxiaoModel | ||
25 | { | 26 | { |
26 | $result = array( | 27 | $result = array( |
27 | 'birthday' => '2000-01-01', | 28 | 'birthday' => '2000-01-01', |
28 | - 'gender' => 0 | 29 | + 'gender' => 2 |
29 | ); | 30 | ); |
30 | 31 | ||
31 | // 调用接口获取个人详情 | 32 | // 调用接口获取个人详情 |
@@ -39,4 +40,44 @@ class YuanxiaoModel | @@ -39,4 +40,44 @@ class YuanxiaoModel | ||
39 | 40 | ||
40 | return $result; | 41 | return $result; |
41 | } | 42 | } |
43 | + | ||
44 | + /** | ||
45 | + * @param int $uid 用户UID | ||
46 | + * @param sring $nickName 用户昵称 | ||
47 | + * @param string $birthday 用户生日 | ||
48 | + * @param int $gender 用户性别 | ||
49 | + * @return array 处理之后抽签的结果 | ||
50 | + */ | ||
51 | + public static function getChouqianInfo($uid, $nickName, $birthday, $gender) | ||
52 | + { | ||
53 | + $result = array('code' => 400, 'message' => '出错啦~'); | ||
54 | + | ||
55 | + do { | ||
56 | + if (empty($uid)) { | ||
57 | + break; | ||
58 | + } | ||
59 | + | ||
60 | + if (empty($nickName)) { | ||
61 | + $result['message'] = '昵称不能为空'; | ||
62 | + break; | ||
63 | + } | ||
64 | + | ||
65 | + if (empty($birthday)) { | ||
66 | + $result['message'] = '生日不能为空'; | ||
67 | + break; | ||
68 | + } | ||
69 | + | ||
70 | + if (empty($gender)) { | ||
71 | + $result['message'] = '性别不能为空'; | ||
72 | + break; | ||
73 | + } | ||
74 | + | ||
75 | + $chouqian = ActivityData::getYuanxiaoInfo($uid, $nickName, $birthday, $gender); | ||
76 | + if ($chouqian) { | ||
77 | + $result = $chouqian; | ||
78 | + } | ||
79 | + } while (false); | ||
80 | + | ||
81 | + return $result; | ||
82 | + } | ||
42 | } | 83 | } |
@@ -11,7 +11,7 @@ use LibModels\Wap\Cuxiao\ActivityData; | @@ -11,7 +11,7 @@ use LibModels\Wap\Cuxiao\ActivityData; | ||
11 | class ChristmasController extends HuodongAction | 11 | class ChristmasController extends HuodongAction |
12 | { | 12 | { |
13 | 13 | ||
14 | - private $_isApp = false; | 14 | +// private $_isApp = false; |
15 | 15 | ||
16 | /** | 16 | /** |
17 | * 备注:2015年12月11号上线 | 17 | * 备注:2015年12月11号上线 |
@@ -56,20 +56,18 @@ class YuanxiaoController extends HuodongAction | @@ -56,20 +56,18 @@ class YuanxiaoController extends HuodongAction | ||
56 | // 审判跳转登录页 | 56 | // 审判跳转登录页 |
57 | $this->auditJumpLogin(); | 57 | $this->auditJumpLogin(); |
58 | 58 | ||
59 | + $uid = $this->getUid(); | ||
59 | // POST提交请求 | 60 | // POST提交请求 |
60 | - if (!empty($this->post())) { | 61 | + $posts = $this->post(); |
62 | + if (!empty($posts)) { | ||
63 | + $nickName = $this->post('nick', ''); | ||
61 | $birthday = $this->post('birthday', ''); | 64 | $birthday = $this->post('birthday', ''); |
62 | $gender = $this->post('gender', 0); | 65 | $gender = $this->post('gender', 0); |
63 | 66 | ||
64 | // 调用接口 | 67 | // 调用接口 |
65 | - $result = array( | ||
66 | - 'code' => 200, | ||
67 | - 'data' => array( | ||
68 | - 'name' => '李四', | ||
69 | - 'type' => 'P1', | ||
70 | - 'count' => 8888 | ||
71 | - ) | ||
72 | - ); | 68 | + $result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $birthday, $gender); |
69 | + $result['code'] = 200; | ||
70 | + $result['data'] = array('name' => $nickName, 'type' => 'M2'); | ||
73 | if ($result['code'] === 200) { // 处理成功就跳转到等待页 | 71 | if ($result['code'] === 200) { // 处理成功就跳转到等待页 |
74 | // 将返回的结果存入cookeie中15分钟 | 72 | // 将返回的结果存入cookeie中15分钟 |
75 | $this->setCookie('yuanxiaochouqian', json_encode($result['data']), time() + 15*60); | 73 | $this->setCookie('yuanxiaochouqian', json_encode($result['data']), time() + 15*60); |
@@ -87,7 +85,6 @@ class YuanxiaoController extends HuodongAction | @@ -87,7 +85,6 @@ class YuanxiaoController extends HuodongAction | ||
87 | )); | 85 | )); |
88 | } | 86 | } |
89 | } else { | 87 | } else { |
90 | - $uid = $this->getUid(); | ||
91 | $userData = YuanxiaoModel::getUserProfileData($uid); | 88 | $userData = YuanxiaoModel::getUserProfileData($uid); |
92 | 89 | ||
93 | $this->_view->display('info', array( | 90 | $this->_view->display('info', array( |
@@ -137,15 +134,12 @@ class YuanxiaoController extends HuodongAction | @@ -137,15 +134,12 @@ class YuanxiaoController extends HuodongAction | ||
137 | 'name' => $this->encrypt($result['name']), | 134 | 'name' => $this->encrypt($result['name']), |
138 | 'hash' => $this->encrypt($this->getUid()) | 135 | 'hash' => $this->encrypt($this->getUid()) |
139 | )); | 136 | )); |
137 | + $result['type'] = $this->get('type', 'M2'); | ||
140 | 138 | ||
141 | $this->_view->display('result', array( | 139 | $this->_view->display('result', array( |
142 | 'staticTitle' => '元宵抽签', | 140 | 'staticTitle' => '元宵抽签', |
143 | 'staticFile' => self::STATIC_FILE, | 141 | 'staticFile' => self::STATIC_FILE, |
144 | 'result' => $result, | 142 | 'result' => $result, |
145 | - 'result' => array( | ||
146 | - 'name' => '张大龙', | ||
147 | - 'type' => 'M1' | ||
148 | - ), | ||
149 | 'shareUrl' => $shareUrl, | 143 | 'shareUrl' => $shareUrl, |
150 | 'staticJS' => array( | 144 | 'staticJS' => array( |
151 | 'result.js' | 145 | 'result.js' |
-
Please register or login to post a comment