Ejemplo n.º 1
0
function Mobile_UpdateMember($theThis, $uniacid, $uid, $data)
{
    global $_W, $_GPC;
    $rd = new ReturnData("");
    load()->model('mc');
    if (!mc_update($uid, $data)) {
        $rd->setMsg("更新个人信息失败");
        $rd->setCode(200);
    }
    return $rd;
}
Ejemplo n.º 2
0
 public function doMobileAjaxReg()
 {
     global $_W, $_GPC;
     $weid = $_W['weid'];
     $uniacid = $_W['uniacid'];
     $id = intval($_GPC['id']);
     $openid = Mobile_GetOpenid();
     $rd = Mobile_GetWeivoteVote($this, $uniacid, $id);
     if (!$rd->getState()) {
         return $rd->toJson();
     }
     $weivote_vote = $rd->getData();
     $rd = Mobile_GetMember($this, $uniacid, $id, $openid);
     if (!$rd->getState()) {
         return $rd->toJson();
     }
     $fans = $rd->getData('fans');
     $member = $rd->getData('member');
     $follow = $fans['follow'];
     $rd = new ReturnData(null);
     $rd->addData('member', $member);
     return $rd->toJson();
 }
Ejemplo n.º 3
0
function Mobile_CheckVoteLog($theThis, $uniacid, $weivote_vote, $openid, $oid, $clientip)
{
    global $_W, $_GPC;
    $rd = new ReturnData('');
    $vid = $weivote_vote['id'];
    $oidcount = 0;
    $oidstr = '';
    if (!is_array($oid) && !(strpos($oid, ',') !== false)) {
        $oidstr = $oid;
        $oidcount = 1;
    } else {
        if (is_array($oid) && count($oid) > 0) {
            foreach ($oid as $oid_one) {
                $oidstr .= $oid_one . ',';
            }
            $oidstr = substr($oidstr, 0, strlen($oidstr) - 1);
            $oidcount = count($oid);
        }
    }
    $sql = 'SELECT COUNT(*) FROM ' . tablename($theThis->table_option) . " WHERE vid = '{$vid}' AND id in (" . $oidstr . ')';
    $setting_option_count = pdo_fetchcolumn($sql);
    if ($setting_option_count != $oidcount) {
        $rd->setCode(200);
        $rd->setNode('Mobile_CheckVoteLog');
        $rd->setMsg('您的投票选项有误!');
        return $rd;
    }
    $sql = 'SELECT COUNT(*) FROM ' . tablename($theThis->table_log) . " WHERE from_user = '******' AND vid = '{$vid}' ";
    $fans_log_count = pdo_fetchcolumn($sql);
    if ($weivote_vote['once_vote'] != null && $weivote_vote['once_vote'] == 1 && $fans_log_count > 0) {
        $rd->setCode(201);
        $rd->setNode('Mobile_CheckVoteLog');
        $rd->setMsg('您已参加过本次活动!');
        $rd->setUrl('ajax/result.html');
        return $rd;
    }
    if ($weivote_vote['interval_time'] > 0) {
        $now_clientip = $clientip;
        $now_createtime = TIMESTAMP;
        $last_log = pdo_fetch('SELECT * FROM ' . tablename($theThis->table_log) . " WHERE vid = '{$vid}' and clientip = '{$now_clientip}' order by id desc LIMIT 1 ");
        if ($now_createtime <= $last_log['create_time'] + 60 * $weivote_vote['interval_time']) {
            $rd->setCode(202);
            $rd->setNode('Mobile_CheckVoteLog');
            $rd->setMsg('您参与的投票活动繁忙! 请 ' . $weivote_vote['interval_time'] . ' 分钟后参与投票!');
            return $rd;
        }
    }
    $today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
    $tomorrow = mktime(0, 0, 0, date('m'), date('d') + 1, date('Y'));
    $sql = 'SELECT COUNT(*) FROM ' . tablename($theThis->table_log) . " WHERE from_user = '******' AND vid = '{$vid}' AND create_time > " . $today . ' AND create_time < ' . $tomorrow;
    $fans_log_today_count = pdo_fetchcolumn($sql);
    if ($fans_log_today_count >= $weivote_vote['max_vote_day']) {
        $rd->setCode(203);
        $rd->setNode('Mobile_CheckVoteLog');
        $rd->setMsg('您今天投票次数已用完!');
        $rd->setUrl('ajax/result.html');
        return $rd;
    }
    if ($oidcount < 1 || $oidcount > $weivote_vote['max_vote_day'] || $oidcount > $weivote_vote['max_vote_count'] - $fans_log_today_count) {
        $rd->setCode(204);
        $rd->setNode('Mobile_CheckVoteLog');
        $rd->setMsg('投票数量不符合要求,请重新选择!');
        return $rd;
    }
    if ($fans_log_count >= $weivote_vote['max_vote_count']) {
        $rd->setCode(205);
        $rd->setNode('Mobile_CheckVoteLog');
        $rd->setMsg('您的投票次数已用完!');
        $rd->setUrl('ajax/result.html');
        return $rd;
    }
    if ($weivote_vote['type_vote'] == 1) {
        $sql = 'SELECT COUNT(*) FROM ' . tablename($theThis->table_log) . " WHERE from_user = '******' AND vid = '{$vid}' AND create_time > " . $today . ' AND create_time < ' . $tomorrow . ' AND oid in (' . $oidstr . ')';
        $fans_log_count = pdo_fetchcolumn($sql);
        if ($fans_log_count != 0) {
            $rd->setCode(206);
            $rd->setNode('Mobile_CheckVoteLog');
            $rd->setMsg('已投过该选项,请投给其他选项!');
            return $rd;
        }
    }
    return $rd;
}
Ejemplo n.º 4
0
function Web_ManageLogPlus($theThis, $uniacid, $vid, $oid, $num = 1)
{
    global $_W, $_GPC;
    $rd = new ReturnData("");
    $weivote_vote = pdo_fetch("SELECT * FROM " . tablename($theThis->table_vote) . " WHERE id = :id and uniacid=:uniacid", array(':id' => $vid, ':uniacid' => $uniacid));
    $weivote_option = pdo_fetch("SELECT * FROM " . tablename($theThis->table_option) . " WHERE id = :id and uniacid=:uniacid", array(':id' => $oid, ':uniacid' => $uniacid));
    $update = array('log_count' => $weivote_vote['log_count'] + $num);
    if (!pdo_update($theThis->table_vote, $update, array('id' => $weivote_vote['id']))) {
        $rd->setCode(200);
        $rd->setMsg("系统超级繁忙~");
        $rd->setNode('Web_LogCount');
        return $rd;
    }
    $update = array('log_count' => $weivote_option['log_count'] + $num);
    if (!pdo_update($theThis->table_option, $update, array('id' => $weivote_option['id']))) {
        $rd->setCode(201);
        $rd->setMsg("系统超级繁忙~~");
        $rd->setNode('Web_LogCount');
        return $rd;
    }
    return $rd;
}