Exemple #1
0
 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');
 }
if ($_W['ispost']) {
    $input = array();
    $input['owner'] = $owner['uid'];
    $input['helper'] = $user['uid'];
    $input['dateline'] = TIMESTAMP;
    $ret = $s->createHelp($input);
    if (is_error($ret)) {
        exit($ret['message']);
    } else {
        exit('success');
    }
}
$footer_off = true;
$_W['page']['title'] = $activity['title'];
$_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('shared', array('actid' => $activity['actid'], 'owner' => $user['uid'])), 2);
$got = $a->getRecord($user['uid'], $id);
//分享集红包
$help = array();
$help['total'] = $activity['tag']['helps'];
$help['already'] = $s->helpsCount($owner['uid']);
$help['isok'] = $help['already'] >= $help['total'];
$help['rank'] = $s->getHelpRank($owner['uid'], $user['uid']);
$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('activity-shared-help');
Exemple #3
0
global $_W, $_GPC;
require_once MB_ROOT . '/source/Shared.class.php';
require_once MB_ROOT . '/source/Fans.class.php';
$f = new Fans();
$s = new Shared();
$uid = intval($_GPC['owner']);
$owner = $f->getOne($uid);
if (empty($owner)) {
    message('访问错误', $activity['guide'], 'info');
}
$user = $this->auth();
$activity = $this->getActivity(true, array('user' => $user));
if (is_error($activity)) {
    message($activity['message']);
}
if ($owner['uid'] == $user['uid']) {
    exit('不能帮给自己发红包啊');
} else {
    $rank = $s->getHelpRank($owner['uid'], $user['uid']);
    if (!empty($rank)) {
        exit('您已经向这个好友发过红包啦');
    } else {
        $rec = array();
        $rec['from'] = $owner['uid'];
        $rec['to'] = $user['uid'];
        $rec['dateline'] = TIMESTAMP;
        $s->createHelp($rec);
        exit('success');
    }
}