本文整理汇总了PHP中Table::Count方法的典型用法代码示例。如果您正苦于以下问题:PHP Table::Count方法的具体用法?PHP Table::Count怎么用?PHP Table::Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table::Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Login
static public function Login($user_id=0) {
global $INI; if ($INI['credit']['login']==0) return ;
$now = Time() - 86400;
$condition = array(
'user_id' => $user_id,
'action' => 'login',
"create_time > $now",
);
$count = Table::Count('credit', $condition);
if ($count>0) return;
self::Create($INI['credit']['login'], $user_id, 'login');
}
示例2: Assign
static function Assign($order)
{
$ccon = array('order_id' => $order['id']);
$count = Table::Count('voucher', $ccon);
while ($count < $order['quantity']) {
$voucher = self::GetValidVoucher($order['team_id']);
if (!$voucher) {
break;
}
Table::UpdateCache('voucher', $voucher['id'], array('user_id' => $order['user_id'], 'order_id' => $order['id']));
$count = Table::Count('voucher', $ccon);
}
}
示例3: Create
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);
}
}
示例4: Create
public static function Create($order)
{
if ($order['state'] == 'unpay') {
return;
}
$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(12, Utility::CHAR_NUM);
$cv = Table::Fetch('coupon', $id);
$coupon = array('id' => Utility::GenSecret(12, Utility::CHAR_NUM), '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(8, Utility::CHAR_WORD), 'expire_time' => $team['expire_time'], 'create_time' => time());
DB::Insert('coupon', $coupon);
$count = Table::Count('coupon', $ccon);
$user = Table::Fetch('user', $order['user_id']);
mail_coupon($team, $partner, $order, $user, $coupon);
}
}
示例5: Create
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);
}
}
}
示例6: Assign
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);
}
}
示例7: Create
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);
}
示例8: serialize
$e[$k]['price'] = $team["express_price_{$v}"];
}
$team['express_relate'] = serialize($e);
//team_type == goods
if($team['team_type'] == 'goods'){
$team['min_number'] = 1;
$team['conduser'] = 'N';
}
if ( !$id ) {
$team['now_number'] = $team['pre_number'];
} else {
$field = strtoupper($table->conduser)=='Y' ? null : 'quantity';
$now_number = Table::Count('order', array(
'team_id' => $id,
'state' => 'pay',
), $field);
$team['now_number'] = ($now_number + $team['pre_number']);
/* 增加了总数,未卖完状态 */
if ( $team['max_number'] > $team['now_number'] ) {
$team['close_time'] = 0;
$insert[] = 'close_time';
}
/* update coupon */
DB::Update('coupon', array('team_id' => $id), array(
'expire_time' => $team['expire_time'],
));
/* update order */
DB::Update('order', array('team_id' => $id), array(
示例9: Address
public static function Address($user_id, $address)
{
if (!$user_id || !is_array($address)) {
return false;
}
$count = Table::Count('address', array('user_id' => $user_id));
$default = $count == 0 ? 'Y' : 'N';
if ($count > 10) {
return false;
}
$add = array('user_id' => $user_id, 'province' => $address['province'], 'area' => $address['area'], 'city' => $address['city'], 'street' => $address['street'], 'zipcode' => $address['zipcode'], 'name' => $address['name'], 'mobile' => $address['mobile'], 'default' => $default, 'create_time' => time());
return DB::Insert('address', $add);
}
示例10: dirname
<?php
require_once dirname(dirname(dirname(__FILE__))) . '/app.php';
need_manager();
need_auth('market');
$like = strval($_GET['like']);
$cs = strval($_GET['cs']);
/* build condition */
$condition = array();
if ($like) {
$condition[] = "email like '%" . mysql_escape_string($like) . "%'";
}
if ($cs) {
$cscity = DB::LimitQuery('category', array('condition' => array('zone' => 'city', 'name' => $cs), 'one' => true));
if ($cscity) {
$condition['city_id'] = $cscity['id'];
} else {
$cs = null;
}
}
/* end */
$count = Table::Count('subscribe', $condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 50);
$subscribes = DB::LimitQuery('subscribe', array('condition' => $condition, 'order' => 'ORDER BY id DESC', 'size' => $pagesize, 'offset' => $offset));
$city_ids = Utility::GetColumn($subscribes, 'city_id');
$cities = Table::Fetch('category', $city_ids);
include template('manage_misc_subscribe');
示例11: array
}
if (preg_match('#/city#', $_SERVER['HTTP_REFERER'])) {
redirect( 'index.php');
}
redirect($_SERVER['HTTP_REFERER']);
}
redirect('index.php');
}
}
$cities = DB::LimitQuery('category', array(
'condition' => array( 'zone' => 'city') ,
));
foreach($cities as &$c){
$daytime = time();
$condition = array(
'city_id' => array(0, abs(intval($c['id']))),
"begin_time < {$daytime}",
"end_time > {$daytime}",
);
$c['team_num'] = Table::Count('team',$condition);
}
$cities = Utility::AssColumn($cities, 'letter', 'ename');
ksort($cities);
$pagetitle = '城市选择';
include template('m_city');
示例12: require_once
<?php
/**
* My
* ----------------------------------------------------------------------------
* This is not free software
* ----------------------------------------------------------------------------
* @author abei <abei@qiang8.cn>
* @version 1.0
* @link http://www.qiang8.cn
*/
require_once(dirname(dirname(__FILE__)) . '/app.php');
need_login(true);
$consume_times = Table::Count('order', array(
'user_id' => $login_user_id,
'state' => 'pay',
));
die(include template('m_my'));
示例13: pagestring
));
$join_number = 0;
foreach($teams_other AS $k=>$one){
$join_number += $one['now_number'];
}
//今日新品判断
if($ncon == 'new'){
$condition[] = "begin_time >= '{$daytime}'";
}
if($sid) $condition['sub_id'] = $sid;
if($cid) $condition[] = "((city_ids like '%@{$cid}@%' or city_ids like '%@0@%') or city_id in(0,{$cid}))";
if ($group_id) $condition['group_id'] = $group_id;
$count = Table::Count('team', $condition);
list($pagesize, $offset, $pagestring) = pagestring($count, 100);
$teams = DB::LimitQuery('team', array(
'condition' => $condition,
'order' => 'ORDER BY ' . $order . ' now_number DESC',
'size' => $pagesize,
'offset' => $offset,
));
//判断是否卖光了
foreach($teams AS $id=>$one){
team_state($one);
if (!$one['close_time']) $one['picclass'] = 'isopen';
if ($one['state']=='soldout') $one['picclass'] = 'soldout';
$teams[$id] = $one;
}
示例14: array
$tcount = Table::Count('team', array('city_id' => $id));
if ($tcount) {
json('本类下存在团购项目', 'alert');
}
} elseif ($category['zone'] == 'group') {
$tcount = Table::Count('team', array('group_id' => $id));
if ($tcount) {
json('本类下存在团购项目', 'alert');
}
} elseif ($category['zone'] == 'express') {
$tcount = Table::Count('order', array('express_id' => $id));
if ($tcount) {
json('本类下存在订单项目', 'alert');
}
} elseif ($category['zone'] == 'public') {
$tcount = Table::Count('topic', array('public_id' => $id));
if ($tcount) {
json('本类下存在讨论区话题', 'alert');
}
}
Table::Delete('category', $id);
option_category($category['zone']);
Session::Set('notice', '删除分类成功');
json(null, 'refresh');
} else {
if ('teamcoupon' == $action) {
need_auth('team');
$team = Table::Fetch('team', $id);
team_state($team);
if ($team['now_number'] < $team['min_number']) {
json('团购未结束或未达到最低成团人数', 'alert');
示例15: array
));
//buyonce
if (strtoupper($team['buyonce'])=='Y') {
$ex_con['state'] = 'pay';
if ( Table::Count('order', $ex_con) ) {
Session::Set('error', '您已经成功购买了本单产品,请勿重复购买,快去关注一下其他产品吧!');
redirect( "index.php");
}
}
//peruser buy count
if ($team['per_number']>0) {
$now_count = Table::Count('order', array(
'user_id' => $login_user_id,
'team_id' => $id,
'state' => 'pay',
), 'quantity');
$team['per_number'] -= $now_count;
if ($team['per_number']<=0) {
Session::Set('error', '您购买本单产品的数量已经达到上限,快去关注一下其他产品吧!');
redirect( 'now.php' );
}
}
//post buy
if ( $_POST ) {
need_login(true);
$express_id = (int) $_POST['express_id'];
if($team['delivery'] == 'express'){
foreach ($express_ralate as $k=>$v) {