Authored by 毕凯

Merge branch 'feature/wap/yuanxiao' of git.dev.yoho.cn:web/yohobuy into feature/wap/yuanxiao

... ... @@ -2,6 +2,7 @@
namespace LibModels\Wap\Cuxiao;
use Api\Sign;
use Api\Yohobuy;
/**
... ... @@ -69,9 +70,35 @@ class ActivityData
}
/**
* @param int $uid 用户UID
* @param string $nickName 用户昵称
* @param string $birthday 用户生日
* @param int $gender 用户性别
* @return mixed 抽签的结果
*/
public static function getYuanxiaoInfo($uid, $nickName, $birthday, $gender)
{
$param = Yohobuy::param();
$param['method'] = 'wap.activity.draw';
$param['uid'] = $uid;
$param['nick_name'] = $nickName;
$param['birthday'] = $birthday;
$param['gender'] = $gender;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 发送站内信
*
* @param int $activityId 活动ID
*
* @param int $uid
* @param string $title
* @param int $content
* @param int $type
* @param string $verify_key
* @param int $send_uid
* @param string $call_back
* @return array
*/
public static function message($uid, $title, $content, $type = 1, $verify_key = '', $send_uid = 0, $call_back = '')
... ...
... ... @@ -28,7 +28,7 @@
<span class="check {{#if gender}}checked{{/if}}" data-gender="{{#if gender}}1{{/if}}"></span>
</div>
<div class="icon girl">
<span class="check {{#unless gender}}checked{{/if}}" data-gender="{{#if gender}}0{{/if}}"></span>
<span class="check {{#unless gender}}checked{{/if}}" data-gender="{{#if gender}}2{{/if}}"></span>
</div>
<input type="hidden" name="gender" id="gender" value="{{gender}}">
</div>
... ...
<?php
namespace Cuxiao;
use LibModels\Wap\Cuxiao\ActivityData;
use LibModels\Wap\Home\UserData;
/**
... ... @@ -25,7 +26,7 @@ class YuanxiaoModel
{
$result = array(
'birthday' => '2000-01-01',
'gender' => 0
'gender' => 2
);
// 调用接口获取个人详情
... ... @@ -39,4 +40,44 @@ class YuanxiaoModel
return $result;
}
/**
* @param int $uid 用户UID
* @param sring $nickName 用户昵称
* @param string $birthday 用户生日
* @param int $gender 用户性别
* @return array 处理之后抽签的结果
*/
public static function getChouqianInfo($uid, $nickName, $birthday, $gender)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($uid)) {
break;
}
if (empty($nickName)) {
$result['message'] = '昵称不能为空';
break;
}
if (empty($birthday)) {
$result['message'] = '生日不能为空';
break;
}
if (empty($gender)) {
$result['message'] = '性别不能为空';
break;
}
$chouqian = ActivityData::getYuanxiaoInfo($uid, $nickName, $birthday, $gender);
if ($chouqian) {
$result = $chouqian;
}
} while (false);
return $result;
}
}
\ No newline at end of file
... ...
... ... @@ -11,7 +11,7 @@ use LibModels\Wap\Cuxiao\ActivityData;
class ChristmasController extends HuodongAction
{
private $_isApp = false;
// private $_isApp = false;
/**
* 备注:2015年12月11号上线
... ...
... ... @@ -56,20 +56,18 @@ class YuanxiaoController extends HuodongAction
// 审判跳转登录页
$this->auditJumpLogin();
$uid = $this->getUid();
// POST提交请求
if (!empty($this->post())) {
$posts = $this->post();
if (!empty($posts)) {
$nickName = $this->post('nick', '');
$birthday = $this->post('birthday', '');
$gender = $this->post('gender', 0);
// 调用接口
$result = array(
'code' => 200,
'data' => array(
'name' => '李四',
'type' => 'P1',
'count' => 8888
)
);
$result = YuanxiaoModel::getChouqianInfo($uid, $nickName, $birthday, $gender);
$result['code'] = 200;
$result['data'] = array('name' => $nickName, 'type' => 'M2');
if ($result['code'] === 200) { // 处理成功就跳转到等待页
// 将返回的结果存入cookeie中15分钟
$this->setCookie('yuanxiaochouqian', json_encode($result['data']), time() + 15*60);
... ... @@ -87,7 +85,6 @@ class YuanxiaoController extends HuodongAction
));
}
} else {
$uid = $this->getUid();
$userData = YuanxiaoModel::getUserProfileData($uid);
$this->_view->display('info', array(
... ... @@ -137,15 +134,12 @@ class YuanxiaoController extends HuodongAction
'name' => $this->encrypt($result['name']),
'hash' => $this->encrypt($this->getUid())
));
$result['type'] = $this->get('type', 'M2');
$this->_view->display('result', array(
'staticTitle' => '元宵抽签',
'staticFile' => self::STATIC_FILE,
'result' => $result,
'result' => array(
'name' => '张大龙',
'type' => 'M1'
),
'shareUrl' => $shareUrl,
'staticJS' => array(
'result.js'
... ...