public function doMobileRedShared() { global $_W, $_GPC; $modulePublic = '../addons/wwx_fxxt/style/static/'; require_once WWX_FXXT_ROOT . '/class/Activity.class.php'; require_once WWX_FXXT_ROOT . '/class/Fans.class.php'; require_once WWX_FXXT_ROOT . '/class/Shared.class.php'; $a = new Activity(); $f = new Fans(); $user = $this->redauth(); ///74.判断红包领取及用户信息记录。 $id = $_GPC['actid']; $id = intval($id); $activity = $a->getOne($id); /**Activity:2.根据活动ID查询活动内容及设置等**/ $prepare = $this->prepareActivity($activity, array('user' => $user)); ///75.查询红包活动的所有限制条件并输出。 if (is_error($prepare)) { header('Location: ' . $this->createMobileUrl('redactivity', array('actid' => $activity['actid']))); exit; } $uid = intval($_GPC['owner']); $owner = $f->getOne($uid); /**FANS:3.根据用户UID或OPENID查询记录中的用户信息**/ if (empty($owner)) { message('访问错误', $activity['guide'], 'info'); } if ($owner['uid'] == $user['uid']) { header('Location: ' . $this->createMobileUrl('redactivity', array('actid' => $activity['actid']))); exit; } require_once WWX_FXXT_ROOT . '/class/Shared.class.php'; $s = new Shared($activity); if ($_W['ispost']) { $input = array(); $input['owner'] = $owner['uid']; $input['helper'] = $user['uid']; $input['dateline'] = TIMESTAMP; $ret = $s->createHelp($input); /**Shared:4.增加一次助力记录**/ if (is_error($ret)) { exit($ret['message']); } else { exit('success'); } } $footer_off = true; $_W['page']['title'] = $activity['title']; $mid = $this->getMid(); ///11.查询自身wwx_fxxt_member分销表会员ID $_share = array(); $_share['title'] = $activity['share']['title']; $_share['desc'] = $activity['share']['content']; $_share['imgUrl'] = tomedia($activity['share']['image']); $_share['link'] = $_W['siteroot'] . 'app/' . substr($this->createMobileUrl('redshared', array('actid' => $activity['actid'], 'owner' => $user['uid'], 'mid' => $mid, 'joinway' => 2)), 2); $got = $a->getRecord($user['uid'], $id); /**Activity:8.查询活动红包领取信息。**/ //分享集红包 $help = array(); $help['total'] = $activity['tag']['helps']; $help['already'] = $s->helpsCount($owner['uid']); /**Shared:2.获取指定用户的被助力总数**/ $help['isok'] = $help['already'] >= $help['total']; $help['rank'] = $s->getHelpRank($owner['uid'], $user['uid']); /**Shared:5.获取指定用户助力特定用户的名次**/ $activity['tag']['label'] = htmlspecialchars_decode($activity['tag']['label']); $activity['tag']['label'] = str_replace('{nickname}', $owner['nickname'], $activity['tag']['label']); $activity['tag']['request'] = htmlspecialchars_decode($activity['tag']['request']); $activity['tag']['request'] = str_replace('{nickname}', $owner['nickname'], $activity['tag']['request']); include $this->template('redactivity_shared_help'); }
<?php global $_W, $_GPC; $modulePublic = '../addons/microb_redpack/static/'; $footer_off = true; $_W['page']['title'] = $activity['title']; $user = $this->auth(); $activity = $this->getActivity(true, array('user' => $user)); if (is_error($activity)) { message($activity['message']); } $_share = array(); $_share['title'] = $activity['stitle']; $_share['desc'] = $activity['content']; $_share['imgUrl'] = tomedia($activity['image']); $_share['link'] = $_W['siteroot'] . 'app/' . substr(substr($this->createMobileUrl('entry', array('owner' => $user['uid'])), 2), 0, -39); require_once MB_ROOT . '/source/Shared.class.php'; $s = new Shared(); $got = $s->getOneRecord($user['uid']); if ($activity['type'] == 'direct') { //直接发红包 } else { //分享集红包 $help = array(); $help['total'] = $activity['helps']; $help['already'] = $s->helpsCount($user['uid']); $help['ok'] = $help['already'] >= $activity['helps']; } include $this->template('get');
} } else { if ($got['status'] == 'created') { $ret = $this->send($activity, $got, $user); if (is_error($ret)) { exit('红包发放失败, 你可以在活动结束之前重新领取. 活动结束后无法领取, 请注意'); exit($ret['message']); } exit('success'); } } } if ($activity['type'] == 'shared') { require_once MB_ROOT . '/source/Shared.class.php'; $s = new Shared($activity); $count = $s->helpsCount($user['uid']); if ($count < $activity['tag']['helps']) { exit('还没达到领取礼品的条件'); } $got = $a->getRecord($user['uid'], $activity['actid']); if (empty($got)) { if (empty($error)) { $ret = $a->grap($user, $activity); if (is_error($ret)) { exit($ret['message']); } elseif ($ret['status'] == 'none') { exit('这一轮没有抢到红包, 请期待我们下一次活动'); } else { $got = $a->getRecord($user['uid'], $activity['actid']); $ret = $this->send($activity, $got, $user); if (is_error($ret)) {