|
@@ -10,7 +10,7 @@ class ActivityController extends O2oBaseController {
|
|
|
//扫码获取代金券
|
|
|
|
|
|
public function actionIndex(){
|
|
|
-
|
|
|
+ $this->render('index');exit;
|
|
|
}
|
|
|
|
|
|
public function actionGetCoupon() {
|
|
@@ -21,6 +21,7 @@ class ActivityController extends O2oBaseController {
|
|
|
$home_page = Yii::app()->getRequest()->getParam("home_page",'');
|
|
|
$userId = '';
|
|
|
$appToken = '';
|
|
|
+ var_dump($code);
|
|
|
if($code && $state){
|
|
|
$accessInfo = CommonWeixin::getAccessInfo($code);
|
|
|
$userId = '';
|
|
@@ -72,32 +73,31 @@ class ActivityController extends O2oBaseController {
|
|
|
}
|
|
|
}
|
|
|
//用户注册后,发放代金券
|
|
|
+ $userId = $user->_id;
|
|
|
|
|
|
- $coupon_id =new MongoId($coupon_id);
|
|
|
- $start_time = time(); //发放优惠券可用开始时间
|
|
|
- $end_time = $start_time + 86400*30; //发放优惠券过期时间
|
|
|
- if (CommonFn::isMongoId($coupon_id)) {
|
|
|
- if (CommonFn::isMongoId($user->_id)) {
|
|
|
- Service::factory('CouponService')->giveCoupon($user->_id, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
- }
|
|
|
- }
|
|
|
}else{
|
|
|
echo $accessInfo['errcode'];
|
|
|
die();
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ $coupon_id =new MongoId($coupon_id);
|
|
|
+ $start_time = time(); //发放优惠券可用开始时间
|
|
|
+ $end_time = $start_time + 86400*30; //发放优惠券过期时间
|
|
|
+ if (CommonFn::isMongoId($coupon_id) && !$coupon_id) {
|
|
|
+ if (CommonFn::isMongoId($userId) && !$userId) {
|
|
|
+ Service::factory('CouponService')->giveCoupon($userId, $coupon_id, $start_time, $end_time);//发放代金券
|
|
|
+ $this->render('index');exit;
|
|
|
+ }
|
|
|
+ }
|
|
|
if($home_page){
|
|
|
- $this->renderpartial('//o2o/web/index', array(
|
|
|
- 'version' => '2015111601',
|
|
|
- 'debug' => 'false',
|
|
|
- 'signPackage' => $signPackage,
|
|
|
- 'userId' => $userId,
|
|
|
- 'appToken' => $appToken,
|
|
|
- ));
|
|
|
+ var_dump($user->_id);exit;
|
|
|
+ $this->renderpartial('index');
|
|
|
}else{
|
|
|
-
|
|
|
+ var_dump($coupon_id);
|
|
|
$this->renderpartial('getCoupon', array(
|
|
|
'version' => '2015111601',
|
|
|
'debug' => 'false',
|
|
@@ -121,17 +121,14 @@ class ActivityController extends O2oBaseController {
|
|
|
$redirectURI = 'http://' . $_SERVER['HTTP_HOST'] . Yii::app()->request->baseUrl . '/index.php?r=/common/activity/getCoupon&coupon_id='.$coupon_id;
|
|
|
|
|
|
if($home_page){
|
|
|
- $appURI = Yii::app()->request->baseUrl . '/common/activity/getCoupon'.'&home_page='.$home_page;
|
|
|
+ $appURI = Yii::app()->request->baseUrl . '/index.php?r=common/activity/getCoupon'.'&home_page='.$home_page.'&coupon_id='.$coupon_id;
|
|
|
$redirectURI = $redirectURI.'/'.$home_page;
|
|
|
}else{
|
|
|
-
|
|
|
-
|
|
|
- $appURI = Yii::app()->request->baseUrl . '/common/activity/getCoupon&coupon_id='.$coupon_id;
|
|
|
+ $appURI = Yii::app()->request->baseUrl . '/index.php?r=common/activity/getCoupon&coupon_id='.$coupon_id;
|
|
|
}
|
|
|
$scope = 'snsapi_userinfo';
|
|
|
$state = 'yiguanjia';
|
|
|
$codeURI = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $wxConfig['appId'] . '&redirect_uri=' . urlencode($redirectURI) . '&response_type=code&scope=' . $scope . '&state=' . $state . '#wechat_redirect';
|
|
|
-
|
|
|
$this->renderpartial('wxIndex', array(
|
|
|
'codeURI' => $codeURI,
|
|
|
'appURI' => $appURI
|