예제 #1
0
 function del($id)
 {
     global $_USERS;
     $sendorders = $this->getone($id, "uname,oids,couponid,freight,serverfee,customsfee,totalfee,state");
     if (is_array($sendorders)) {
         if ($sendorders['state'] != 1) {
             return lang('Not_allowcancel_sendorder');
         }
         if ($_USERS['uname'] != $sendorders['uname']) {
             return lang('Permissions_not');
         }
         include_once INC_PATH . "/member.class.php";
         $m = new memberclass();
         $tempmoney = $sendorders['totalfee'];
         $note = lang('cancel_sendorder_id') . $id;
         $m->moneyedit($sendorders['uname'], $tempmoney, 3, $note);
         $wheresqlo = "oid in(" . $sendorders['oids'] . ")";
         editstate($this->tablepre . "order", "state", $wheresqlo, 4);
         //更改订单状态操作
         editstate($this->tablepre . "order", "sid", $wheresqlo, 0);
         //更改订单对应运单ID操作
         if (GetNum($sendorders['couponid'])) {
             editstate($this->tablepre . "coupon", "state", "cid = " . GetNum($sendorders['couponid']), 1);
             //更改优惠卷状态操作
         }
     } else {
         return lang('sendOrderID_notexist');
     }
     $dataarray = array('state' => 4);
     return $this->edit($id, $dataarray);
     //return $this->table_sendorder->del($id);
 }
예제 #2
0
 function del($id)
 {
     global $_USERS;
     $goods = $this->getone($id, "uname,goodsnum,goodsprice,goodsurl,goodsname,sendprice,type,goodsseller,goodssite,state");
     if (is_array($goods)) {
         if ($goods['state'] != 1 && $goods['state'] != 6) {
             return lang('Not_allowcancel_order');
         }
         if ($_USERS['uname'] != $goods['uname']) {
             return lang('Permissions_not');
         }
         //type=1时候表示是代购商品需要返还用户付款额度
         if ($goods['type'] == 1 || $goods['type'] == 2) {
             include_once INC_PATH . "/member.class.php";
             $m = new memberclass();
             $countnum = $this->getcount("uname='" . $goods['uname'] . "' and goodsseller='" . $goods['goodsseller'] . "' and (state=1 or state=6)");
             if ($countnum > 1) {
                 //只退还账户余额]
                 $tempmoney = $goods['goodsprice'] * $goods['goodsnum'];
                 $note = lang('cancel_order') . "<a href=\\'" . $goods['goodsurl'] . "\\' target=\\'_blank\\'>《" . $goods['goodsname'] . "》</a>" . lang('order_id') . $id;
                 $m->moneyedit($goods['uname'], $tempmoney, 4, $note);
             } elseif ($countnum = 1) {
                 //退还账户余额和运费
                 $tempmoney = $goods['goodsprice'] * $goods['goodsnum'] + $goods['sendprice'];
                 $note = lang('cancel_order') . "<a href=\\'" . $goods['goodsurl'] . "\\' target=\\'_blank\\'>《" . $goods['goodsname'] . "》" . lang('And_freight') . $goods['sendprice'] . "</a>" . lang('order_id') . $id;
                 $m->moneyedit($goods['uname'], $tempmoney, 4, $note);
             }
             //else{
             //退还账户余额和运费
             //	$tempmoney=$goods['goodsprice']*$goods['goodsnum']+$goods['sendprice'];
             //	$note="取消订单<a href=\'".$goods['goodsurl']."\' target=\'_blank\'>《".$goods['goodsname']."》和运费:".$goods['sendprice']."</a>订单ID:".$id;
             //	$m->moneyedit($goods['uname'],$tempmoney,4,$note);
             //}
         }
     } else {
         return lang('OrderID_notexist');
     }
     return $this->table_order->del($id);
 }
예제 #3
0
 function carttoorder($id)
 {
     global $_USERS;
     if (!empty($id)) {
         $wherestr[] = $this->joinid($id);
     }
     $wherestr[] = "uname ='" . $_USERS['uname'] . "'";
     if (empty($wherestr) || empty($_USERS['uname'])) {
         return false;
     }
     if (!empty($wherestr)) {
         $wheresql = implode(' AND ', $wherestr);
     }
     //条件汇总
     //获取数据
     $temparray = $this->getdata("", $wheresql);
     if (!empty($temparray)) {
         //进入用户操作类
         include_once INC_PATH . "/member.class.php";
         $m = new memberclass();
         foreach ($temparray as $value) {
             $addarray = $value;
             $tempstate = $value['type'] == 1 ? 1 : 3;
             //带发直接状态修改成在途中
             unset($addarray['gid']);
             //丢掉
             unset($addarray['anonymous']);
             //丢掉
             $addarray['addtime'] = time();
             //添加时间
             $addarray['state'] = $tempstate;
             //订单状态
             //处理插入数据库
             include_once INC_PATH . "/order.class.php";
             $order = OrderClass::init();
             $info = $order->add($addarray);
             if (GetNum($info)) {
                 $seccessid[] = $info;
                 //扣除用户帐户余额操作
                 if ($value['type'] != 2) {
                     $tempmoney = $value['goodsprice'] * $value['goodsnum'];
                     $note = lang('Buy') . "<a href=\\'" . $value['goodsurl'] . "\\' target=\\'_blank\\'>《" . $value['goodsname'] . "》</a> " . $value['goodsnum'] . lang('Pieces_order_ID') . $info;
                     $m->moneyedit($_USERS['uname'], -$tempmoney, 1, $note);
                     //扣去账户余额
                 }
             } else {
                 $order->del($seccessid);
                 //手动回滚操作
                 return lang('process_CartID') . $value['gid'] . lang('orderid_error');
             }
         }
         //运费扣费处理
         $result = $this->countmoney($temparray);
         //统计运费
         foreach ($result['s'] as $key => $val) {
             $note = lang('goodsseller') . "[" . $key . "]" . lang('Domestic_Ship') . $val;
             $m->moneyedit($_USERS['uname'], -$val, 2, $note);
             //扣去账户余额
         }
         $this->clear($id);
         //删除购物车商品
         return 'OK';
     } else {
         return '订单为空';
     }
 }
 /**
  * 付款成功充值到账户
  *
  * @param unknown_type $sn
  * @return 'OK'
  */
 function paysuccess($sn, $money)
 {
     $sn = GetNum($sn);
     $row = $this->getonebysn($sn, $field = "rid,uname,state,money,payname");
     if (!is_array($row)) {
         return lang('Renumber_notexist');
     }
     if ($row['state'] == 2) {
         return lang('been_recharge');
     }
     //更新状态
     $dataarray = array('money' => $money, 'successtime' => time(), 'state' => 2);
     $this->rechargerecord->edit($row['rid'], $dataarray);
     include_once INC_PATH . "/member.class.php";
     $m = new memberclass();
     $note = $row['payname'] . $money . lang('yuan') . lang('Serial_number') . $sn;
     $m->moneyedit($row['uname'], $money, 9, $note);
     return 'OK';
 }
예제 #5
0
} elseif ($action == "changestate" && !empty($aid)) {
    //更改状态
    $aid = GetNum($aid);
    $wheresqlarr = "aid ={$aid}";
    editstate($Table->table, "state", $wheresqlarr, 1);
    //更改状态操作
    showmsg("修改状态成功!", "-1");
    //成功提示!
} elseif ($action == "chargeback" && !empty($aid)) {
    //更改状态
    $aid = GetNum($aid);
    $wheresqlarr = "aid ={$aid}";
    $row = $Table->getone($aid);
    $umoney = DB::result_first("Select money From `{$Table->table}` where uname like '{$row['uname']}' ");
    if ($umoney < $row['money']) {
        showmsg("用户帐户余额不足!扣费失败!", "-1");
    }
    //成功提示!
    include_once INC_PATH . "/member.class.php";
    $m = new memberclass();
    $note = $row['name'] . ' 账户:' . $row['account'] . '充值扣费' . $row['money'] . "服务订单ID:" . $row['aid'];
    $m->moneyedit($row['uname'], -$row['money'], 0, $note);
    //扣去账户余额
    editstate($Table->table, "state", $wheresqlarr, 2);
    //更改状态操作
    showmsg("修改状态并且扣费成功!", "-1");
    //成功提示!
} else {
    showmsg("未知请求", "-1");
    //出错!
}
예제 #6
0
            $note = "调整商品<a href=\\'" . $goodsurl . "\\' target=\\'_blank\\'>《" . $goodsname . "》</a>价格:" . -$tempmoney . "订单ID:" . $oid;
            $m->moneyedit($uname, $tempmoney, 5, $note);
            //扣去账户余额
        }
        if ($sendprice != $oldsendprice) {
            //商品运费调整
            $tempmoney = 0;
            $tempmoney = GetNum($oldsendprice - $sendprice);
            //计算运费调整
            $wheresqlarr = "uname = '" . $uname . "' and goodsseller = '" . $goodsseller . "' and state < 3";
            editstate($Table->table, "sendprice", $wheresqlarr, $sendprice);
            //更改状态操作
            include_once INC_PATH . "/member.class.php";
            $m = new memberclass();
            $note = "调整商品<a href=\\'" . $goodsurl . "\\' target=\\'_blank\\'>《" . $goodsname . "》</a>运费:" . -$tempmoney . "订单ID:" . $oid;
            $m->moneyedit($uname, $tempmoney, 5, $note);
            //扣去账户余额
        }
        $arrayedit = array("goodsurl" => $goodsurl, "goodsname" => Char_cv($goodsname), "goodsprice" => GetNum($goodsprice), "sendprice" => GetNum($sendprice), "goodsnum" => GetNum($goodsnum), "goodssize" => Char_cv($goodssize), "goodscolor" => Char_cv($goodscolor), "goodsseller" => Char_cv($goodsseller), "goodsremark" => Char_cv($goodsremark), "orderremark" => Char_cv($orderremark), "sellerurl" => $sellerurl, "expressno" => $expressno, "orderweight" => GetNum($orderweight), "state" => GetNum($state), "payid" => Char_cv($payid), "uptime" => time());
        $info = $Table->edit($oid, $arrayedit);
        if ($info == "OK") {
            exit("<script language='javascript'>alert('编辑成功');parent.parent.\$.fn.colorbox.close();</script>");
        } else {
            exit("<script language='javascript'>alert('编辑失败');parent.location.reload();</script>");
        }
    } else {
        $evalue = $Table->getone($oid);
        //print_r($evalue);
        include "tpl/order_edit.htm";
    }
}
     jumpurl(url('m.php?name=orderlist'));
 }
 $totalfee = sprintf("%01.2f", $totalfee);
 $freight = sprintf("%01.2f", $freight);
 $serverfee = sprintf("%01.2f", $serverfee);
 $deliveryrow['customs_fee'] = sprintf("%01.2f", $deliveryrow['customs_fee']);
 $addarray = array('uid' => $_USERS['uid'], 'uname' => $_USERS['uname'], 'email' => $_USERS['email'], 'oids' => $oids, 'couponid' => GetNum($couponid), 'freight' => GetNum($freight), 'serverfee' => $serverfee, 'customsfee' => $deliveryrow['customs_fee'], 'totalfee' => $totalfee, 'countmoney' => $countmoney, 'countweight' => $countweight, 'consignee' => $consignee, 'country' => $country, 'city' => $city, 'zip' => $zip, 'tel' => $tel, 'address' => $address, 'remark' => $remark, 'did' => $did, 'deliveryname' => $deliveryrow['deliveryname'], 'areaname' => $deliveryrow['areaname'], 'addtime' => time(), 'uptime' => time(), 'state' => 1);
 include_once INC_PATH . "/sendorder.class.php";
 $sendorderobj = SendOrderClass::init();
 $sid = $sendorderobj->add($addarray);
 if (GetNum($sid)) {
     //提交成功,处理扣费和修改订单状态
     include_once INC_PATH . "/member.class.php";
     $m = new memberclass();
     $note = "提交运单,运单ID:" . $sid;
     $m->moneyedit($_USERS['uname'], -$totalfee, 3, $note);
     //扣费操作
     editstate($tablepre . "order", "state", $wheresqlo, 5);
     //更改订单状态操作
     editstate($tablepre . "order", "sid", $wheresqlo, $sid);
     //更改订单对应运单ID操作
     if (GetNum($couponid)) {
         editstate($tablepre . "coupon", "state", "cid = " . GetNum($couponid), 3);
         //更改优惠卷状态操作
     }
     //显示成功页面
     include template('member_tosendorderok');
     //包含输出指定模板
 } else {
     print "<script language='javascript'>alert('生成送货单出错!');</script>";
     jumpurl(url('m.php?name=orderlist'));
예제 #8
0
 InitGP(array("uid", "sn", "uname", "money", "paytype", "payname", "remark"));
 //初始化变量全局返回
 if (!empty($_POST) and !empty($uname)) {
     $uid = DB::result_first("select uid from " . DB::table('users') . " where uname = '{$uname}'");
     //查询uid
     $uid = GetNum($uid);
     if ($uid == 0) {
         showmsg("用户名不存在!", "-1");
     }
     //出错!
     $arrayadd = array("uid" => $uid, "uname" => Char_cv($uname), "sn" => GetNum($sn), "money" => GetNum($money), "paytype" => GetNum($paytype), "payname" => Char_cv($payname), "remark" => Char_cv($remark), "addtime" => $timestamp, "successtime" => $timestamp, "state" => 2);
     $info = $Table->add($arrayadd);
     if (GetNum($info)) {
         include_once INC_PATH . "/member.class.php";
         $m = new memberclass();
         if ($m->moneyedit($uname, $money, "后台转账充值")) {
             showmsg("充值成功!", PHP_SELF);
             //出错!
             exit("<script language='javascript'>alert('编辑成功');parent.parent.\$.fn.colorbox.close();</script>");
         } else {
             $Table->del($info);
             showmsg("充值失败!", "-1");
             //出错!
         }
     } else {
         showmsg("充值失败!", "-1");
         //出错!
         exit("<script language='javascript'>alert('编辑失败');parent.location.reload();</script>");
     }
 } else {
     $evalue = $Table->getone($uid);
예제 #9
0
    $arrayadd['uid'] = $_USERS['uid'];
    $arrayadd['uname'] = $_USERS['uname'];
    $arrayadd['goodsnum'] = GetNum($pieceNum);
    $arrayadd['type'] = 2;
    $arrayadd['goodsremark'] = Char_cv(pieceRemark);
    $arrayadd['addtime'] = time();
    $arrayadd['uptime'] = time();
    $arrayadd['state'] = 1;
    $arrayadd['pinoid'] = GetNum($oid);
    $info = $Table->add($arrayadd);
    if (GetNum($info)) {
        include_once INC_PATH . "/member.class.php";
        $m = new memberclass();
        $note = lang('Buy') . "<a href=\\'" . $value['goodsurl'] . "\\' target=\\'_blank\\'>《" . $value['goodsname'] . "》</a> " . GetNum($pieceNum) . lang('Pieces_order_ID') . $info;
        $tempmoney = $value['goodsprice'] * GetNum($pieceNum);
        $m->moneyedit($_USERS['uname'], -$tempmoney, 1, $note);
        //扣去账户余额
        addfield("order", "pinnum", "oid={$oid}", 1);
        //更改状态操作
        showmsg(lang('fight_sucess'), PHP_SELF);
        //出错!
    } else {
        showmsg(lang('fight_lose'), "-1");
        //出错!
    }
}
//utf-8过滤用于搜索的字符串
function FilterSearch($keyword)
{
    $keyword = ereg_replace("[\"\r\n\t\$\\><']", '', $keyword);
    if ($keyword != stripslashes($keyword)) {
 /**
  * 优惠卷易主
  *
  * @param unknown_type $sn
  * @param unknown_type $uname
  * @return OK
  */
 function buycoupon($sn, $uname)
 {
     $uname = Char_cv($uname);
     $sn = Char_cv($sn);
     $urow = DB::fetch_first("select uid,money from " . $this->tablepre . "users where uname='" . $uname . "'");
     if (empty($urow['uid']) || empty($uname)) {
         return lang('user_cantempty');
     }
     $row = DB::fetch_first("select cid,state,getway,sellmoney,uname from " . $this->table_coupon->table . " where sn='" . $sn . "'");
     if ($row['sellmoney'] > GetNum($urow['money'])) {
         return lang('Insuff_accountbalance');
     }
     if ($row['uname'] == $uname) {
         return lang('notbuy_owncoupons');
     }
     if (is_array($row) && $row['state'] == 2 && $row['getway'] == 1 && GetNum($row['sellmoney'])) {
         $dataarray = array('uid' => $urow['uid'], 'uname' => $uname, 'state' => 1);
         include_once INC_PATH . "/member.class.php";
         $m = new memberclass();
         $note = lang('buy_coupon') . $sn . lang('Spend') . $row['sellmoney'] . lang('yuan');
         $note = lang('sell_coupon') . $sn . lang('Earn') . $row['sellmoney'] . lang('yuan');
         $m->moneyedit($uname, -$row['sellmoney'], $note);
         $m->moneyedit($row['uname'], $row['sellmoney'], $note);
         return $this->table_coupon->edit($row['cid'], $dataarray);
     } else {
         return lang('Coupon_notactivated');
     }
 }