/** * * 用户收藏优惠券 */ public function favoriteCoupon_post() { $uid = $this->post('uid'); $couponId = $this->post('couponId'); if (empty($uid) || empty($couponId)) { return output_response(-1, '没有用户信息或优惠券信息'); } if ($this->isCouponFavorited($uid, $couponId)) { return output_success_response('1'); } $url = HOST . "/classes/FavoritedCoupon"; $data = array('people' => avosPointer('_User', $uid), 'coupon' => avosPointer('Coupon', $couponId)); $data = json_encode($data); $json = $this->kq->post($url, $data); // echo $json; $error = checkResponseError($json); if (!empty($error)) { return $error; } return output_success_response('1'); }
/** * * 用户取消收藏快券 * * @return * 正常: status:1 * 异常: status: -1, input 不全 */ public function myFavoritedCoupon_delete() { $uid = $this->get('uid'); $couponId = $this->get('couponId'); $sessionToken = $this->get('sessionToken'); if (empty($uid) || empty($couponId) || empty($sessionToken)) { return output_response(-1, '没有用户信息或优惠券信息'); } $result = $this->my_m->remove_my_favorited_coupon($uid, $sessionToken, $couponId); return $this->output_results($results); }