Authored by Rock Zhang

添加我的消息中领券生日券的逻辑

Code Review By Rock Zhang
... ... @@ -340,6 +340,28 @@ class HomeController extends AbstractAction
}
/**
* 我的消息详情中领取生日券
*/
public function pickCouponAction()
{
$result = array('code' => 400, 'message' => '', 'data' => '');
do {
/* 判断是不是AJAX请求 */
if (!$this->isAjax()) {
break;
}
$uid = $this->getUid(true);
$id = $this->get('id', 0);
$result = UserModel::pickBirthCoupon($uid, $id);
}
while (false);
$this->echoJson($result);
}
/**
* 优惠券
*/
public function couponsAction()
... ...
... ... @@ -892,6 +892,13 @@ class UserModel
return $result;
}
/*
* 删除消息
*
* @param int $uid 用户ID
* @param int $id 消息ID
* @return array
*/
public static function delMessage($uid, $id)
{
$result = array('code' => 400, 'message' => '出错啦~');
... ... @@ -901,8 +908,8 @@ class UserModel
break;
}
$messages = UserData::delMessageData($uid, $id);
if (isset($messages['code']) && $messages['code'] == 200) {
$message = UserData::delMessageData($uid, $id);
if (isset($message['code']) && $message['code'] == 200) {
$result['code'] = 200;
}
... ... @@ -911,6 +918,32 @@ class UserModel
return $result;
}
/*
* 我的消息中领取生日券
*
* @param int $uid 用户ID
* @param int $id 消息ID
* @return array
*/
public static function pickBirthCoupon($uid, $id)
{
$result = array('code' => 400, 'message' => '出错啦~');
do {
if (empty($uid) || empty($id)) {
break;
}
$coupon = UserData::getBirthCouponById($uid, $id);
if (!isset($coupon['code'])) {
break;
}
} while (false);
return $result;
}
/**
* 处理我的消息详情信息
*
... ...