示例#1
0
 public static function OnlineIt($order_id, $pay_id, $money, $currency = 'CNY', $service = 'alipay', $bank = '支付宝')
 {
     list($_, $_, $quantity, $_) = explode('-', $pay_id);
     if (!$order_id || !$pay_id || $money <= 0) {
         return false;
     }
     $order = Table::Fetch('order', $order_id);
     if ($order['state'] == 'unpay') {
         Table::UpdateCache('order', $order_id, array('pay_id' => $pay_id, 'money' => $money, 'state' => 'pay', 'service' => $service, 'quantity' => $quantity, 'pay_time' => time()));
         $order = Table::FetchForce('order', $order_id);
         if ($order['state'] == 'pay') {
             $table = new Table('pay');
             $table->id = $pay_id;
             $table->order_id = $order_id;
             $table->money = $money;
             $table->currency = $currency;
             $table->bank = $bank;
             $table->service = $service;
             $table->create_time = time();
             $table->insert(array('id', 'order_id', 'money', 'currency', 'service', 'create_time', 'bank'));
             //TeamBuy Operation
             ZTeam::BuyOne($order);
         }
     }
     return true;
 }
示例#2
0
 public static function GetPartner($partner_id)
 {
     if (!$partner_id) {
         return array();
     }
     Table::Fetch('partner', $partner_id);
 }
示例#3
0
文件: sms.php 项目: hhdem/tuangala_v2
function sms_coupon($coupon, $mobile = null)
{
    global $INI;
    if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
        return $INI['system']['couponname'] . '已失效';
    }
    $user = Table::Fetch('user', $coupon['user_id']);
    $order = Table::Fetch('order', $coupon['order_id']);
    if (!Utility::IsMobile($mobile)) {
        $mobile = $order['mobile'];
        if (!Utility::IsMobile($mobile)) {
            $mobile = $user['mobile'];
        }
    }
    if (!Utility::IsMobile($mobile)) {
        return '请设置合法的手机号码,以便接受短信';
    }
    $team = Table::Fetch('team', $coupon['team_id']);
    $partner = Table::Fetch('partner', $coupon['partner_id']);
    $coupon['end'] = date('Y-n-j', $coupon['expire_time']);
    $coupon['name'] = $team['product'];
    $content = render('manage_tpl_smscoupon', array('partner' => $partner, 'coupon' => $coupon, 'user' => $user));
    if (true === ($code = sms_send($mobile, $content))) {
        Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1'), 'sms_time' => time()));
        return true;
    }
    return $code;
}
示例#4
0
 public static function UseCard($order, $card_id)
 {
     if ($order['card_id']) {
         return self::ERR_ORDER;
     }
     $card = Table::Fetch('card', $card_id);
     if (!$card) {
         return self::ERR_NOCARD;
     }
     if ($card['consume'] == 'Y') {
         return self::ERR_USED;
     }
     $today = strtotime(date('Y-m-d'));
     if ($card['begin_time'] > $today || $card['end_time'] < $today) {
         return self::ERR_EXPIRE;
     }
     $team = Table::Fetch('team', $order['team_id']);
     if ($card['partner_id'] > 0 && $card['partner_id'] != $team['partner_id']) {
         return self::ERR_TEAM;
     }
     if ($team['card'] < $card['credit']) {
         return self::ERR_CREDIT;
     }
     $finalcard = $card['credit'] > $order['origin'] ? $order['origin'] : $card['credit'];
     Table::UpdateCache('order', $order['id'], array('card_id' => $card_id, 'card' => $finalcard, 'origin' => array("origin - {$finalcard}")));
     Table::UpdateCache('card', $card_id, array('consume' => 'Y', 'team_id' => $team['id'], 'order_id' => $order['id'], 'ip' => Utility::GetRemoteIp()));
     return true;
 }
示例#5
0
 public static function GetINI()
 {
     $INI = Config::Instance('php');
     $SYS = Table::Fetch('system', 1);
     $SYS = Utility::ExtraDecode($SYS['value']);
     $INI = Config::MergeINI($INI, $SYS);
     return self::BuildINI($INI);
 }
示例#6
0
 public static function TipSuccess($order)
 {
     $orders = DB::LimitQuery('order', array('condition' => array('team_id' => $order['team_id'], 'state' => 'pay')));
     foreach ($orders as $order) {
         $team = Table::Fetch('team', $order['team_id']);
         $user = Table::Fetch('user', $order['user_id']);
         mail_tipped($team, $order, $user);
     }
 }
 public static function Secret($mobile, $secret = null)
 {
     $secret = $secret ? $secret : Utility::VerifyCode();
     $sms = Table::Fetch('smssubscribe', $mobile, 'mobile');
     if ($sms) {
         Table::UpdateCache('smssubscribe', $sms['id'], array('secret' => $secret));
     }
     return $secret;
 }
示例#8
0
 public static function CreateFromStore($user_id = 0, $money = 0)
 {
     $money = abs(intval($money));
     if ($money <= 0 || $user_id <= 0) {
         return;
     }
     //update user money;
     $user = Table::Fetch('user', $user_id);
     Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}")));
     $u = array('user_id' => $user_id, 'money' => $money, 'direction' => 'income', 'action' => 'store', 'detail_id' => 0, 'create_time' => time());
     return DB::Insert('flow', $u);
 }
示例#9
0
 public static function CashIt($order)
 {
     global $login_user_id;
     if (!$order['state'] == 'pay') {
         return 0;
     }
     //update user money;
     $user = Table::Fetch('user', $order['user_id']);
     Table::UpdateCache('user', $order['user_id'], array('money' => moneyit($user['money'] - $order['credit'])));
     //update order
     Table::UpdateCache('order', $order['id'], array('state' => 'pay', 'service' => 'cash', 'admin_id' => $login_user_id, 'money' => $order['origin']));
     $order = Table::FetchForce('order', $order['id']);
     ZTeam::BuyOne($order);
 }
示例#10
0
 public static function DeleteTeam($id)
 {
     $orders = Table::Fetch('order', array($id), 'team_id');
     foreach ($orders as $one) {
         if ($one['state'] == 'pay') {
             return false;
         }
         if ($order['card_id']) {
             Table::UpdateCache('card', $order['card_id'], array('team_id' => 0, 'order_id' => 0, 'consume' => 'N'));
         }
         Table::Delete('order', $one['id']);
     }
     return Table::Delete('team', $id);
 }
示例#11
0
文件: uc.php 项目: hhdem/tuangala_v2
function uc_api_updatepw($get, $post)
{
    $username = $get['username'];
    $password = ZUser::GenPassword($get['password']);
    if (strtolower(UC_CHARSET) != 'utf-8') {
        $username = mb_convert_encoding($username, 'UTF-8', UC_CHARSET);
    }
    $u = Table::Fetch('user', $username, 'username');
    if ($u && $u['password'] != $password) {
        Table::UpdateCache('user', $u['id'], array('password' => $password));
        if ($_SESSION['user_id'] && $_SESSION['user_id'] == $u['id']) {
            unset($_SESSION['user_id']);
        }
    }
    return API_RETURN_SUCCEED;
}
示例#12
0
function get_city($ip = null)
{
    global $INI;
    $cities = Table::Fetch('category', $INI['hotcity']);
    $ip = $ip ? $ip : Utility::GetRemoteIP();
    $url = "http://open.baidu.com/ipsearch/s?wd={$ip}&tn=baiduip";
    $res = mb_convert_encoding(Utility::HttpRequest($url), 'UTF-8', 'GBK');
    if (preg_match('#来自:<b>(.+)</b>#Ui', $res, $m)) {
        foreach ($cities as $one) {
            if (FALSE !== strpos($m[1], $one['name'])) {
                return $one;
            }
        }
    }
    return array();
}
示例#13
0
 public static function GetINI()
 {
     global $INI;
     /* load from php*/
     $dbphp = DIR_CONFIGURE . '/db.php';
     if (file_exists($dbphp)) {
         configure_load();
     } else {
         /* end */
         $INI = Config::Instance('php');
         $SYS = Table::Fetch('system', 1);
         $SYS = Utility::ExtraDecode($SYS['value']);
         $INI = Config::MergeINI($INI, $SYS);
     }
     $INI = ZSystem::WebRoot();
     return self::BuildINI($INI);
 }
示例#14
0
 public static function OnlineIt($order_id, $pay_id, $money, $currency = 'CNY', $service = 'alipay', $bank = '支付宝', $trade_no = '')
 {
     list($_, $_, $quantity, $_) = explode('-', $pay_id);
     if (!$order_id || !$pay_id || $money <= 0) {
         return false;
     }
     $order = Table::Fetch('order', $order_id);
     $team = Table::Fetch('team', $order['team_id']);
     $user_id = abs(intval($order['user_id']));
     team_state($team);
     if ($order['state'] == 'unpay') {
         $table = new Table('pay');
         $table->id = $pay_id;
         $table->vid = $trade_no;
         $table->order_id = $order_id;
         $table->money = $money;
         $table->currency = $currency;
         $table->bank = $bank;
         $table->service = $service;
         $table->create_time = time();
         $ia = array('id', 'vid', 'order_id', 'money', 'currency', 'service', 'create_time', 'bank');
         if (Table::Fetch('pay', $pay_id) || !$table->insert($ia)) {
             return false;
         }
         //update user money; +money
         Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}")));
         $u = array('user_id' => $user_id, 'admin_id' => 0, 'money' => $money, 'direction' => 'income', 'action' => 'paycharge', 'detail_id' => $pay_id, 'create_time' => time());
         DB::Insert('flow', $u);
         $user = Table::FetchForce('user', $user_id);
         //print_r($user);exit;
         if ($user['money'] < $order['origin']) {
             return false;
         }
         if (in_array($team['state'], array('soldout')) || $team['end_time'] < time()) {
             return false;
         }
         Table::UpdateCache('order', $order_id, array('pay_id' => $pay_id, 'money' => $money, 'state' => 'pay', 'trade_no' => $trade_no, 'service' => $service, 'quantity' => $quantity, 'pay_time' => time()));
         $order = Table::FetchForce('order', $order_id);
         if ($order['state'] == 'pay') {
             //TeamBuy Operation
             ZTeam::BuyOne($order);
         }
     }
     return true;
 }
示例#15
0
 public static function Create($user_row)
 {
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['create_time'] = $user_row['login_time'] = time();
     $user_row['ip'] = Utility::GetRemoteIp();
     $user_row['secret'] = md5(Utility::GenSecret(12));
     $user_row['id'] = DB::Insert('user', $user_row);
     if ($_COOKIE['_rid']) {
         $r_user = Table::Fetch('user', $_COOKIE['_rid']);
         if ($r_user) {
             ZInvite::Create($r_user, $user_row);
         }
     }
     if ($user_row['id'] == 1) {
         Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
     }
     return $user_row['id'];
 }
示例#16
0
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     $partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('coupon', $ccon);
     while ($count < $order['quantity']) {
         $id = Utility::GenSecret(8, Utility::CHAR_NUM);
         $cv = Table::Fetch('coupon', $id);
         if ($cv) {
             continue;
         }
         $coupon = array('id' => $id, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'order_id' => $order['id'], 'credit' => $team['credit'], 'team_id' => $order['team_id'], 'secret' => Utility::GenSecret(6, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time());
         DB::Insert('coupon', $coupon);
         sms_coupon($coupon);
         $count = Table::Count('coupon', $ccon);
     }
 }
示例#17
0
 public static function Create($user_row, $uc = true)
 {
     $user_row['password'] = self::GenPassword($user_row['password']);
     $user_row['create_time'] = $user_row['login_time'] = time();
     $user_row['ip'] = Utility::GetRemoteIp();
     $user_row['secret'] = md5(rand(1000000, 9999999) . time() . $user_row['email']);
     $user_row['id'] = DB::Insert('user', $user_row);
     $_rid = abs(intval(cookieget('_rid')));
     if ($_rid) {
         $r_user = Table::Fetch('user', $_rid);
         if ($r_user) {
             ZInvite::Create($r_user, $user_row);
         }
     }
     if ($user_row['id'] == 1) {
         Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
     }
     return $user_row['id'];
 }
 public static function Create($order)
 {
     $team = Table::Fetch('team', $order['team_id']);
     //$partner = Table::Fetch('partner', $order['partner_id']);
     $ccon = array('order_id' => $order['id']);
     $count = Table::Count('code', $ccon);
     require dirname(dirname(dirname(__FILE__))) . "/zhongyu/Zhongyu.class.php";
     $zhongyu = new Zhongyu();
     while ($count < $order['quantity']) {
         $id = date('YmdHis', time()) . rand(100000, 999999);
         $id = Utility::VerifyCode($id);
         $cv = Table::Fetch('code', $id);
         if ($cv) {
             continue;
         }
         /* 这里请求第三方发码接口 */
         if ('zhongyu' == $team['codeform']) {
             //判断为中娱发码方式
             $codeform = 'zhongyu';
             $info = array('req_seq' => $id, 'serv_code' => $team['serv_code'], 'phone_rece' => $order['mobile'], 'notes' => '');
             $result = $zhongyu->send($info);
             //print_r($result);exit;
             $doc = new DOMDocument();
             $doc->loadXML($result);
             $response_id = $doc->getElementsByTagName("id")->item(0)->nodeValue;
             if ('0000' == $response_id) {
                 //成功
                 $sys_seq = $doc->getElementsByTagName("order_num")->item(0)->nodeValue;
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 1;
             } else {
                 //失败
                 $msg = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
                 $mms = 0;
             }
         }
         $code = array('id' => $id, 'sys_seq' => $sys_seq, 'user_id' => $order['user_id'], 'partner_id' => $team['partner_id'], 'city_id' => $team['city_id'], 'order_id' => $order['id'], 'team_id' => $order['team_id'], 'expire_time' => $team['expire_time'], 'create_time' => time(), 'msg' => $msg, 'mms' => $mms, 'codeform' => $codeform);
         if (DB::Insert('code', $code)) {
             //sms_coupon($coupon);
             $count = Table::Count('code', $ccon);
         }
     }
 }
示例#19
0
 public static function Enable($mobile, $enable = false, $user_id = '')
 {
     $condition = array('tools' => $mobile, 'enable' => 'Y');
     $remove = DB::GetTableRow('toolsbind', $condition);
     if ($remove) {
         Table::Delete('toolsbind', $remove['id']);
     }
     $havecondition = array('user_id' => $user_id, 'enable' => 'Y');
     $removeold = DB::GetTableRow('toolsbind', $havecondition);
     if ($removeold) {
         Table::Delete('toolsbind', $removeold['id']);
     }
     $sms = Table::Fetch('toolsbind', $mobile, 'tools');
     $time = time();
     if ($sms) {
         Table::UpdateCache('toolsbind', $sms['id'], array('enable' => 'Y', 'create_time' => $time));
         Table::UpdateCache('user', $sms['user_id'], array('mobile' => $mobile, 'mobilecode' => 'yes', 'enable' => 'Y'));
     }
 }
示例#20
0
 public static function BuyOne($order)
 {
     $order = Table::FetchForce('order', $order['id']);
     $team = Table::FetchForce('team', $order['team_id']);
     $team['now_number'] += $order['quantity'];
     if ($team['max_number'] > 0 && $team['now_number'] >= $team['max_number']) {
         $team['state'] = 'soldout';
         $team['close_time'] = time();
     }
     $table = new Table('team', $team);
     $table->update(array('end_time', 'state', 'now_number'));
     ZFlow::CreateFromOrder($order);
     ZCoupon::CheckOrder($order);
     ZInvite::CheckInvite($order);
     $partner = Table::Fetch('partner', $team['partner_id']);
     $city = Table::Fetch('category', $team['city_id']);
     $user = Table::Fetch('user', $order['user_id']);
     mail_purchase($city, $team, $partner, $order, $user);
 }
示例#21
0
function get_team($team)
{
    if (!$team) {
        return '';
    }
    $xmlitems = '';
    $id = 1;
    foreach ($team['items'] as $k => $v) {
        /*处理城市*/
        $city = Table::Fetch('category', $team['items'][$k]['city_id']);
        $city_name = $city['name'];
        if ($city['name'] == "") {
            $city_name = '全国';
        }
        /*处理商品类别*/
        $group = Table::Fetch('category', $team['items'][$k]['group_id']);
        $class = $group['name'];
        /*处理热销商品的开始和结束时间*/
        if ($team['items'][$k]['team_type'] == 'goods') {
            $team['items'][$k]['begin_time'] = date('YmdHis', time());
            $team['items'][$k]['end_time'] = date('YmdHis', time() + 86400);
        } else {
            /*格式化时间*/
            $team['items'][$k]['begin_time'] = date('YmdHis', $team['items'][$k]['begin_time']);
            $team['items'][$k]['end_time'] = date('YmdHis', $team['items'][$k]['end_time']);
        }
        $team['items'][$k]['expire_time'] = date('YmdHis', $team['items'][$k]['expire_time']);
        $xmlitems .= get_items($team, $k, $id, $city_name, $class);
        $id++;
    }
    $xmloutput = <<<XML
\t\t<?xml version="1.0" encoding="utf-8" ?>
\t\t<data>
\t\t<site_name>{$team['website']}</site_name>
\t\t<goodsdata>{$xmlitems}</goodsdata>
\t\t</data>
XML;
    unset($xmlitems);
    return $xmloutput;
}
示例#22
0
function zuitu_uc_login($email, $pass)
{
    if (!function_exists('uc_user_login')) {
        return array();
    }
    if (!defined('UC_API')) {
        return array();
    }
    $isuid = strpos($email, '@') ? 2 : 0;
    if (strtolower(UC_CHARSET) != 'utf-8') {
        $email = mb_convert_encoding($email, UC_CHARSET, 'UTF-8');
    }
    $ucresult = uc_user_login($email, $pass, $isuid, 0);
    $uckey = array('uid', 'username', 'password', 'email', 'duplicate');
    $ucresult = array_combine($uckey, $ucresult);
    $ucresult = zuitu_encode_array($ucresult);
    $ucresult = zuitu_encode_detect($ucresult);
    DB::Query('SET NAMES UTF8;');
    if ($ucresult['uid'] > 0 && $ucresult['email']) {
        $eu = Table::Fetch('user', $ucresult['email'], 'email');
        if ($eu) {
            if ($eu['username'] != $ucresult['username']) {
                $epass = ZUser::GenPassword($ucresult['password']);
                Table::UpdateCache('user', $eu['id'], array('username' => $ucresult['username'], 'password' => $epass));
                return Table::FetchForce('user', $eu['id']);
            }
            return $eu;
        }
        unset($ucresult['uid']);
        unset($ucresult['duplicate']);
        zuitu_encode_array($ucresult);
        zuitu_encode_detect($ucresult);
        $newuser_id = ZUser::Create($ucresult, false);
        if ($newuser_id) {
            return Table::Fetch('user', $newuser_id);
        }
    }
    return array();
}
示例#23
0
 public static function CheckInvite($order)
 {
     if ($order['state'] == 'unpay') {
         return;
     }
     global $INI;
     $invitecredit = abs(intval($INI['system']['invitecredit']));
     if (!$invitecredit) {
         return;
     }
     $user = Table::Fetch('user', $order['user_id']);
     if (!$user || $user['newbie'] != 'Y') {
         return;
     }
     $invite = Table::Fetch('invite', $order['user_id'], 'other_user_id');
     if (!$invite || $invite['credit'] > 0 || $invite['pay'] != 'N') {
         return;
     }
     Table::UpdateCache('invite', $invite['id'], array('credit' => $invitecredit, 'team_id' => $order['team_id'], 'buy_time' => time()));
     Table::UpdateCache('user', $order['user_id'], array('newbie' => 'N'));
     return true;
 }
示例#24
0
function sms_coupon($coupon)
{
    global $INI;
    $coupon_user = Table::Fetch('user', $coupon['user_id']);
    if ($coupon['consume'] == 'Y' || $coupon['expire_time'] < strtotime(date('Y-m-d'))) {
        return $INI['system']['couponname'] . '已失效';
    } else {
        if (!Utility::IsMobile($coupon_user['mobile'])) {
            return '请设置合法的手机号码,以便接受短信';
        }
    }
    $team = Table::Fetch('team', $coupon['team_id']);
    $user = Table::Fetch('user', $coupon['user_id']);
    $coupon['end'] = date('Y-n-j', $coupon['expire_time']);
    $coupon['name'] = $team['product'];
    $content = render('manage_tpl_smscoupon', array('coupon' => $coupon, 'user' => $user));
    $content = trim(preg_replace("/[\\s]+/", '', $content));
    if (true === ($code = sms_send($coupon_user['mobile'], $content))) {
        Table::UpdateCache('coupon', $coupon['id'], array('sms' => array('`sms` + 1')));
        return true;
    }
    return $code;
}
示例#25
0
	static function Assign($order) {
		$ccon = array('order_id' => $order['id']);
		$count = Table::Count('voucher', $ccon);
		//send_goods_confirm_by_platform
		if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) {
			alipay_send_goods($order['trade_no']);		
		}
		while($count<$order['quantity']) {
			$voucher = self::GetValidVoucher($order['team_id']);
			if (!$voucher) break;
			$flag =	Table::UpdateCache('voucher', $voucher['id'], array(
						'user_id' => $order['user_id'],
						'order_id' => $order['id'],
						));
			if($flag){
				$voucher = Table::Fetch('voucher', $voucher['id']);
				global $INI;
				if ($INI['sms']['auto']=='1')
					sms_voucher($voucher);
			}
			$count = Table::Count('voucher', $ccon);
		}
	}
示例#26
0
	static public function Create($order) {
		$team = Table::Fetch('team', $order['team_id']);
		$partner = Table::Fetch('partner', $order['partner_id']);
		$ccon = array('order_id' => $order['id']);
		$count = Table::Count('coupon', $ccon);
		while($count<$order['quantity']) {
			/* 配合400验证,ID统一修改为12位伪随机数字,密码为6位数字 */
			$id = (ceil(time()/100)+rand(10000000,20000000));
			$id = Utility::VerifyCode($id);
			$cv = Table::Fetch('coupon', $id);
			if ($cv) continue;
            $coupon = array(
					'id' => $id,
					'user_id' => $order['user_id'],
					'buy_id' => $order['buy_id'],
					'partner_id' => $team['partner_id'],
					'order_id' => $order['id'],
					'credit' => $team['credit'],
					'team_id' => $order['team_id'],
					'secret' => Utility::VerifyCode(Utility::GenSecret(6, Utility::CHAR_NUM)),
					'expire_time' => $team['expire_time'],
					'create_time' => time(),
					);
			DB::Insert('coupon', $coupon);
			$count = Table::Count('coupon', $ccon);
			
			//send_goods_confirm_by_platform
			/**
			if( ($order['service']=='alipay') && ($INI['alipay']['autosendgoods']='Y') && ($INI['alipay']['guarantee']!='Y') ) {
				alipay_send_goods($order['trade_no']);		
			}
			*/
			
		}
		sms_all_coupon($order);
	}
示例#27
0
 public static function CheckInvite($order)
 {
     if ($order['state'] == 'unpay') {
         return;
     }
     $user = Table::Fetch('user', $order['user_id']);
     $team = Table::Fetch('team', $order['team_id']);
     if (!$user || $user['newbie'] != 'Y') {
         return;
     }
     Table::UpdateCache('user', $order['user_id'], array('newbie' => 'N'));
     global $INI;
     $invite = Table::Fetch('invite', $order['user_id'], 'other_user_id');
     $invitecredit = abs(intval($team['bonus']));
     /* 无邀请记录 或 已返利或取消 */
     if (!$invite || $invite['credit'] > 0 || $invite['pay'] != 'N') {
         return;
     }
     if (time() - $invite['create_time'] > 7 * 86400) {
         return;
     }
     Table::UpdateCache('invite', $invite['id'], array('credit' => $invitecredit, 'team_id' => $order['team_id'], 'buy_time' => time()));
     return true;
 }
示例#28
0
 public static function Modify($user_id, $newuser = array())
 {
     if (!$user_id) {
         return;
     }
     /* uc */
     $curuser = Table::Fetch('user', $user_id);
     if ($newuser['password'] && function_exists('zuitu_uc_updatepw')) {
         $em = $curuser['email'];
         $un = $newuser['username'];
         $pp = $newuser['password'];
         if (!zuitu_uc_updatepw($em, $un, $pp)) {
             return false;
         }
     }
     /* tuan db */
     $table = new Table('user', $newuser);
     $table->SetPk('id', $user_id);
     if ($table->password) {
         $plainpass = $table->password;
         $table->password = self::GenPassword($table->password);
     }
     return $table->Update(array_keys($newuser));
 }
示例#29
0
文件: team.php 项目: noikiy/mdwp
		$rtr['imgList'] = null;
	}
	if(!empty($rtr['username'])){
		$username2=mb_substr($rtr['username'],0,1,'utf-8')."**".mb_substr($rtr['username'],mb_strlen($rtr['username'],'utf-8')-1,1,'utf-8');
		$rtr['username2']=$username2;
	}
	if(!empty($rtr['create_time'])){
		$dptime=date("m-d",$ri['create_time']);
		$rtr['dptime']=$dptime;
	}
	$itemList = DB::LimitQuery('order_dp_item',array(
			'condition'=>array('order_id'=>$rtr['order_id'])
	));
	$rtr['itemlist']=$itemList;
	$dp_item_ids = Utility::GetColumn($itemList, 'tpl_item_id');
	$dpitems = Table::Fetch('dptpl_item', $dp_item_ids);
}


include template('team_view');


function getRecentGoods($id){
	$TempNum = 5;//cookie里面存储多少个浏览记录
	if(isset($_COOKIE['RecentlyGoods'])){			//判断是否设置了COOKIE
		$RecentlyGoods=$_COOKIE['RecentlyGoods'];
		$RecentlyGoodsArray=explode(",", $RecentlyGoods);
		$RecentlyGoodsNum=count($RecentlyGoodsArray); //RecentlyGoodsNum 当前存储的变量个数
		if (in_array($id, $RecentlyGoodsArray))
		{
		//     echo "已经存在,则不写入COOKIES <hr />";
示例#30
0
<?php

require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
/* 平台商密钥 */
$key = $INI['tenpay']['sec'];
/* 创建支付应答对象 */
$resHandler = new MediPayResponseHandler();
$resHandler->setKey($key);
//判断签名
if ($resHandler->isTenpaySign()) {
    //商家订单号
    $v_oid = $resHandler->getParameter("mch_vno");
    @(list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4));
    //金额,以分为单位
    $v_amount = moneyit($resHandler->getParameter("total_fee") * 0.01);
    //返回码
    $retcode = $resHandler->getParameter("retcode");
    //状态
    $status = $resHandler->getParameter("status");
    //返回码判断
    if ("0" == $retcode) {
        $order = Table::Fetch('order', $order_id);
        if ($order['state'] == 'pay') {
            Session::Set('notice', "购买成功!");
        }
    } else {
        Session::Set('notice', "支付失败!");
    }
}
redirect(WEB_ROOT . "/order/pay.php?id={$order_id}");