function getcoupon($price, $num, $uname = "")
 {
     $price = GetNum($price);
     $num = intval(GetNum($num));
     //暂时只能兑换5元优惠卷
     if ($price > 50) {
         return lang('max_exchange_wushi');
     }
     if ($num < 1) {
         return lang('notless_one_exchange');
     }
     if (empty($uname)) {
         return lang('user_cantempty');
     }
     $scores = DB::result_first("select scores from " . $this->tablepre . "users where uname='" . $uname . "'");
     if (empty($scores) || $scores <= 0) {
         return lang('user_Nopointrecord');
     }
     $totalnum = $price * $num * 100;
     if ($totalnum > $scores) {
         return lang('Points_not_exchange');
     }
     include_once INC_PATH . "/member.class.php";
     $m = new memberclass();
     $note = lang('Redeem') . $price . lang('Per_coupon') . $num . lang('Zhang');
     $m->scoreedit($uname, -$totalnum, $note);
     for ($i = 1; $i <= $num; $i++) {
         $this->add($uname, $price, 1, 1);
         //兑换生成优惠卷
     }
     return "OK";
 }
示例#2
0
    }
    //空选择
    //执行删除多个操作
    $delids = explode('|', $delids);
    foreach ($delids as $id) {
        if (GetNum($id)) {
            $info = $Table->del($id);
        }
    }
    if ($info == "OK") {
        exit("1");
    }
} elseif ($action == "audit" && !empty($gid)) {
    //推荐送积分
    $gid = GetNum($gid);
    $arrayadd = array("Audit" => 1);
    $info = $Table->edit($gid, $arrayadd);
    if ($info == "OK") {
        showmsg("更新成功!", "goods_list.php");
        //出错!
    } else {
        showmsg("更新失败!", "goods_list.php");
        //出错!
    }
    $member = new memberclass();
    $note = "推荐送积分:" . $cfg_recommend_score;
    $member->scoreedit($uname, $cfg_recommend_score, $note);
} else {
    showmsg("未知请求", "-1");
    //出错!
}
示例#3
0
            exit(json_encode(lang('update_failed')));
        }
        editstate($o->table_sendorder->table, "state", $wheresqlarr, 3);
        //更改状态操作
        if (!empty($sendorders['totalfee'])) {
            //增加用户积分,后台设置的有就用后台的设置,没有就用购买商品价值
            if (!empty($cfg_sendorder_score)) {
                $tempscore = $cfg_sendorder_score;
            } else {
                $tempscore = $sendorders['totalfee'];
            }
            include_once INC_PATH . "/member.class.php";
            $m = new memberclass();
            $tempscore = $sendorders['totalfee'];
            $note = lang('sendorder_success_point') . $tempscore . lang('sendorderID') . $tempid;
            $m->scoreedit($sendorders['uname'], $tempscore, $note);
        }
        exit(json_encode('OK'));
    } else {
        exit(json_encode(lang('update_failed')));
    }
} elseif ($action == 'upcomment') {
    $jsondata = json_decode(str_replace("'", '"', file_get_contents('php://input')));
    if (!empty($jsondata->comment) && !empty($jsondata->sid)) {
        $tempcomment = Char_cv($jsondata->comment);
        $tempsid = GetNum($jsondata->sid);
        $wheresqlarr = "uname='" . $_USERS['uname'] . "' and sid=" . $tempsid;
        editstate($o->table_sendorder->table, "comment", $wheresqlarr, $tempcomment);
        //更改状态操作
        editstate($o->table_sendorder->table, "commenttime", $wheresqlarr, time());
        //更改状态操作
示例#4
0
文件: index.php 项目: dalinhuang/c2my
    $info = $Table->add($addarray);
    if (GetNum($info)) {
        print "<script language='javascript'>alert('您的提问发布成功,请耐心等待管理员回复!');</script>";
        jumpurl(url('m.php?name=guestbooklist'));
    } else {
        print "<script language='javascript'>alert('发布提问失败,请稍微重试!');</script>";
        jumpurl(url('m.php?name=guestbooklist'));
    }
} elseif ($action == "upmember") {
    //会员升级操作
    include_once INC_PATH . "/member.class.php";
    $m = new memberclass();
    if ($_USERS['utype'] == 0) {
        if ($_USERS['scores'] >= $cfg_vip_score1) {
            $note = "金卡会员升级";
            $m->scoreedit($_USERS['uname'], -$cfg_vip_score1, $note);
            editstate('users', "utype", "uname='" . $_USERS['uname'] . "'", 1);
            //更改会员等级操作
            editstate('users', "validity", "uname='" . $_USERS['uname'] . "'", time() + 3600 * 24 * $cfg_vip_validity);
            //更改会员有效期操作
            print "<script language='javascript'>alert('升级黄金会员成功!');</script>";
            jumpurl(url('m.php'));
        } else {
            print "<script language='javascript'>alert('积分不足!升级金卡会员需要积分{$cfg_vip_score1}');history.go(-1);</script>";
            exit;
        }
    } elseif ($_USERS['utype'] == 1) {
        if ($_USERS['scores'] >= $cfg_vip_score2) {
            $note = "白金卡会员升级";
            $m->scoreedit($_USERS['uname'], -$cfg_vip_score2, $note);
            editstate('users', "utype", "uname='" . $_USERS['uname'] . "'", 2);