本文整理汇总了PHP中Table::Fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::Fetch方法的具体用法?PHP Table::Fetch怎么用?PHP Table::Fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Fetch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnlineIt
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: GetPartner
public static function GetPartner($partner_id)
{
if (!$partner_id) {
return array();
}
Table::Fetch('partner', $partner_id);
}
示例3: sms_coupon
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: UseCard
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: GetINI
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: TipSuccess
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);
}
}
示例7: Secret
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: CreateFromStore
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: CashIt
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: DeleteTeam
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: uc_api_updatepw
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: get_city
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: GetINI
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: OnlineIt
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: Create
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'];
}