Beispiel #1
0
 public function shareListAction()
 {
     $view = new ViewModel();
     $page = $this->getEvent()->getRouteMatch()->getParam('page', 1);
     $size = $this->getEvent()->getRouteMatch()->getParam('size', 10);
     $activityId = $this->getParam('activityId', 0);
     $paginator = $this->share->getList($activityId, $page, $size);
     $activities = array();
     foreach ($paginator as $share) {
         $activities[$share->id] = $this->activity->getById($share->activityId);
     }
     $view->setVariables(array('paginator' => $paginator, 'activities' => $activities, 'activityId' => $activityId, 'page' => $page));
     return $view;
 }
Beispiel #2
0
 /**
  * 记录分享的用户
  */
 public function logShareAction()
 {
     $user = $this->authentication()->getIdentity();
     if (!$user) {
         //如果用户不存在,则说明是普通人转发,不记录任消息
         return new UnifyJsonModel();
     }
     $activityId = $this->getParam('activityId', false);
     if (!$activityId) {
         return new UnifyJsonModel();
     }
     $share = new ShareEntity();
     $share->openid = $user->open_id;
     $share->user = $user->id;
     $share->activityId = $activityId;
     if (!$this->share->getByActivityIdAndUserId($activityId, $user->id)) {
         $this->share->save($share);
         //send share message
         $time_str = date('Y-m-d H:i');
         $data = array('first' => '活动分享通知', 'keyword1' => '暖心活动分享', 'keyword2' => "{$time_str}", 'keyword3' => '完成', 'remark' => '敬爱的车主,恭喜您成功完成“暖心计划”首个神秘任务!我们将会为您寄出观致汽车暖心礼包。为便于礼物顺利到达您的手中,请务必核对手机首次注册时所填写的地址是否正确。如有变动,可联系观致小Q进行更改。再次感谢您对观致汽车“暖心计划”的支持,祝您生活愉快。');
         $tplId = WechatMessageEntity::TEMPLATE_FINISH_SHARE;
         $this->wechat->sendTemplateMessage($user->open_id, $tplId, $data);
     }
     return new UnifyJsonModel();
 }