本文整理汇总了PHP中db_factory::query方法的典型用法代码示例。如果您正苦于以下问题:PHP db_factory::query方法的具体用法?PHP db_factory::query怎么用?PHP db_factory::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db_factory
的用法示例。
在下文中一共展示了db_factory::query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pub_mode_init
function pub_mode_init($std_cache_name, $data = array())
{
global $kekezu;
global $_lang;
$release_info = $this->_std_obj->_release_info;
switch ($this->_pub_mode) {
case "professional":
break;
case "guide":
break;
case "onekey":
if (!$release_info) {
$sql = " select model_id,task_title,task_desc,indus_id,indus_pid,\n\t\t\t\t\t\ttask_cash,contact from %switkey_task where task_id='%d' and model_id='%d'";
$task_info = db_factory::get_one(sprintf($sql, TABLEPRE, $data['t_id'], $this->_model_id));
$task_info or kekezu::show_msg($_lang['operate_notice'], $_SERVER['HTTP_REFERER'], 3, $_lang['not_exsist_relation_task_and_not_user_onekey'], "warning");
$release_info = $this->onekey_mode_format($task_info);
$allow_time = $kekezu->get_show_day($task_info['task_cash'], $this->_model_id);
$task_day = date('Y-m-d', $allow_time * 24 * 3600 + time());
$release_info['txt_task_day'] = $task_day;
$release_info['txt_task_cash'] = intval($task_info['task_cash']);
$prize_info = db_factory::query(sprintf("select * from %switkey_task_prize where task_id='%d'", TABLEPRE, $data['t_id']));
foreach ($prize_info as $v) {
$release_info['txt_prize' . $v['prize'] . '_num'] = $v['prize_count'];
$release_info['txt_prize' . $v['prize'] . '_cash'] = intval($v['prize_cash']);
}
$this->save_task_obj($release_info, $std_cache_name);
}
break;
}
}
示例2: querySelect
static function querySelect($table_name, $field, $tablefields)
{
$db_factory = new db_factory();
$fori = 0;
$forlimit = 500;
$sqlCount = $db_factory->get_count("select count(*) from " . $table_name);
if (!$sqlCount) {
return false;
}
$tabledump = '';
$numfields = count($tablefields);
while ($fori <= $sqlCount) {
$sql = $db_factory->query("select * from " . $table_name . " limit " . $fori . "," . $forlimit);
foreach ($sql as $r) {
$row = array_values($r);
$sqlmsg = $comma = '';
for ($i = 0; $i < $numfields; $i++) {
$sqlmsg .= $comma . (!empty($row[$i]) && (self::strexists($tablefields[$i]['Type'], 'char') || self::strexists($tablefields[$i]['Type'], 'text')) ? '0x' . bin2hex($row[$i]) : '\'' . mysql_escape_string($row[$i]) . '\'');
$comma = ',';
}
$tabledump .= " INSERT INTO " . $table_name . " VALUES(" . $sqlmsg . ") ;\n";
}
$fori += $forlimit;
}
return $tabledump;
}
示例3: income_data
function income_data($path, $every_year = false)
{
global $_lang;
$year_arr = db_factory::query(sprintf("SELECT DISTINCT(YEAR(FROM_UNIXTIME(fina_time))) as year from %switkey_finance", TABLEPRE));
$month_init_arr = array();
$series_arr = array();
for ($i = 1; $i <= 12; $i++) {
$month_init_arr[$i] = '<point name="' . $i . '" y="0"/>';
}
if (strtolower(CHARSET) != 'utf-8') {
$y = kekezu::gbktoutf($_lang['year']);
}
foreach ($year_arr as $key => $value) {
$month_arr = $month_init_arr;
$sql = " SELECT MONTH(FROM_UNIXTIME(fina_time)) as mon,sum(fina_cash) as cash,sum(fina_credit) as credit from %switkey_finance where year(FROM_UNIXTIME(fina_time))='%s' GROUP BY mon order by mon desc";
$temp = db_factory::query(sprintf($sql, TABLEPRE, $value['year']));
$point = array();
while (list($k, $v) = each($temp)) {
$point[$v['mon']] = '<point name="' . (int) $v['mon'] . '" y="' . ($v['cash'] + $v['credit']) . '"/>';
unset($month_arr[$v['mon']]);
}
$point = $month_arr + $point;
ksort($point);
$point = implode('', $point);
$series_arr[$value['year']] = '<series name="' . $value['year'] . $y . '">' . $point . '</series>';
if ($every_year == true) {
$year_path = sprintf($path, $value['year']);
update_xml($year_path, '<data>' . $series_arr[$value['year']] . '</data>', 'income');
}
}
$series = implode('', $series_arr);
update_xml(sprintf($path, 'total'), '<data>' . $series . '</data>', 'income');
}
示例4: isFieldsExsits
public function isFieldsExsits()
{
$col_info = db_factory::query("show COLUMNS FROM " . $this->_tbname . " WHERE Field='" . $this->_tbfield . "' ");
if ($col_info) {
return true;
}
return false;
}
示例5: goods_top_end
public function goods_top_end()
{
$goods_list = db_factory::query(sprintf(" select a.service_id ,b.end_time from %switkey_service a left join %switkey_payitem_record b on a.service_id=b.obj_id\n\t\t\t\t where a.model_id=6 and a.goodstop=1 and b.obj_type='goods' and b.end_time<%d order by service_id desc ", TABLEPRE, TABLEPRE, time()));
if (is_array($goods_list)) {
foreach ($goods_list as $k => $v) {
keke_shop_class::updateGoodsTop($v['service_id']);
}
}
}
示例6: task_confirm_timeout
function task_confirm_timeout()
{
$task_list = db_factory::query(sprintf("select * from %switkey_task where task_status =6 and end_time<'%s' and model_id=12", TABLEPRE, time()));
if (is_array($task_list)) {
foreach ($task_list as $v) {
$task_obj = new match_task_class($v);
$task_obj->task_other_timeout();
}
}
}
示例7: task_top_end
public function task_top_end()
{
$task_list = db_factory::query(sprintf(" select * from %switkey_task a left join %switkey_payitem_record b\n\t\t\t\ton a.task_id=b.obj_id where a.tasktop=1 and a.model_id = '2' and b.obj_type='task' and b.end_time < '%s' ", TABLEPRE, TABLEPRE, time()));
if (is_array($task_list)) {
foreach ($task_list as $k => $v) {
$task_obj = new sreward_task_class($v);
$task_obj->task_top_end();
}
}
}
示例8: process_report
public function process_report($op_result, $type)
{
global $_lang;
$trans_name = $this->get_transrights_name($this->_report_type);
$op_result['result'] = $op_result['process_result'];
$op_result = $this->op_result_format($op_result);
if ($op_result['action']) {
switch ($op_result['task']) {
case 1:
$this->_task_obj->dispose_task_return();
$this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']);
$res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']);
break;
case 2:
$arrBids = db_factory::query("select * from " . TABLEPRE . "witkey_task_work where work_status=4");
if (is_array($arrBids)) {
foreach ($arrBids as $k => $v) {
db_factory::execute(sprintf("update %switkey_task_work set work_status = 0 where work_id = '%d'", TABLEPRE, $v['work_id']));
db_factory::execute(sprintf(" update %switkey_space set accepted_num = accepted_num-1 where uid = '%d'", TABLEPRE, $v['uid']));
}
}
$this->_task_obj->auto_choose();
$this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']);
$res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']);
break;
case 3:
$this->process_notify('nopass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result'], $op_result['reply']);
$res = $this->change_status($this->_report_id, '3', $op_result, $op_result, $op_result['process_result']);
break;
case 4:
$res = $this->shield_work($this->_obj_info['obj_id']);
$this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']);
$res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']);
break;
case 5:
$this->cancel_bid($this->_obj_info['obj_id']);
$this->_task_obj->auto_choose();
$this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']);
$res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']);
break;
case 6:
$this->disablePeople();
$this->process_notify('pass', $this->_report_info, $this->_user_info, $this->_to_user_info, $op_result['process_result']);
$res = $this->change_status($this->_report_id, '4', $op_result, $op_result['process_result']);
$res and kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=rights&type={$type}", "3", '', 'success') or kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning');
}
if ($res) {
kekezu::admin_show_msg($trans_name . $_lang['deal_success'], "index.php?do=trans&view=report&type={$type}", "3", "", "success");
} else {
kekezu::admin_show_msg($trans_name . $_lang['deal_fail'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning");
}
}
}
示例9: get_priv_item
public static function get_priv_item($model_id)
{
global $kekezu;
$priv_item = $kekezu->_cache_obj->get("priv_rule_item_" . $model_id);
if (!$priv_item) {
$sql = " select a.*,b.g_title,b.m_title,c.rule,c.r_id,c.mark_rule_id from " . TABLEPRE . "witkey_priv_rule c left join " . TABLEPRE . "witkey_priv_item\n\t\ta on c.item_id = a.op_id left join " . TABLEPRE . "witkey_mark_rule b on c.mark_rule_id = b.mark_rule_id where a.model_id = '{$model_id}' order by c.mark_rule_id asc";
$item = db_factory::query($sql);
$priv_item = array();
foreach ($item as $v) {
$priv_item[$v['op_code']][$v['mark_rule_id']] = $v;
}
$kekezu->_cache_obj->set("priv_rule_item_" . $model_id, $priv_item);
}
return $priv_item;
}
示例10: redirect_second_domain
static function redirect_second_domain()
{
global $_K, $kekezu;
if ($kekezu->_sys_config['second_domain']) {
$host = $_SERVER['HTTP_HOST'];
preg_match('/^(\\d+)\\./', $host, $m);
if ($m[1]) {
$uid = intval($m[1]);
$e = db_factory::query(sprintf(' select uid from %switkey_member where uid=%d', TABLEPRE, $uid));
if ($e) {
header('Location:' . $_K['siteurl'] . '/index.php?do=seller&id=' . $uid . '&' . $_SERVER['QUERY_STRING']);
} else {
header('Location:' . $_K['siteurl'] . '/index.php?do=error&type=user');
}
}
}
}
示例11: task_agreement_freeze
public function task_agreement_freeze()
{
global $model_list, $_K, $_lang;
$config = unserialize($model_list[1]['config']);
$sql = " select a.agree_id,a.agree_status,a.seller_status,a.buyer_status,a.seller_uid,a.buyer_uid,a.task_id,a.on_time,b.task_title from %switkey_agreement a left join %switkey_task b on a.task_id=b.task_id where\n\t\t\t\ta.model_id=1 and b.task_status=6 and a.on_time<'%d'";
$agree_list = db_factory::query(sprintf($sql, TABLEPRE, TABLEPRE, time() - intval($config['agree_complete_time']) * 24 * 3600));
if (!empty($agree_list)) {
$msg_obj = new keke_msg_class();
foreach ($agree_list as $k => $v) {
$ginfo = kekezu::get_user_info($v['seller_uid']);
$winfo = kekezu::get_user_info($v['buyer_uid']);
db_factory::execute(sprintf(" update %switkey_task set task_status=13 where task_id='%d'", TABLEPRE, $v['task_id']));
db_factory::execute(sprintf(" update %switkey_agreement set agree_status=5 where agree_id='%d'", TABLEPRE, $v['agree_id']));
$url = "<a href=\"" . $_K['siteurl'] . '/index.php?do=task&id=' . $v['task_id'] . "\">" . $v['task_title'] . "</a>";
$v1 = array('动作' => $_lang['agree_g_ac'], '原因' => '由于超时未完成交付已被系统冻结,请尽快联系客服,由客服介入处理', '任务标题' => $url);
$v2 = array('动作' => $_lang['agree_w_ac'], '原因' => '由于超时未完成交付已被系统冻结,请尽快联系客服,由客服介入处理', '任务标题' => $url);
$msg_obj->send_message($ginfo['uid'], $ginfo['username'], "task_freeze", '协议交付超时冻结通知', $v1, $ginfo['email'], $ginfo['mobile']);
$msg_obj->send_message($winfo['uid'], $winfo['username'], "task_freeze", '协议交付超时冻结通知', $v2, $winfo['email'], $winfo['mobile']);
}
}
}
示例12: set_on_sale_num
public static function set_on_sale_num($service_ids, $status = 2)
{
$service_ids = (array) $service_ids;
$service_ids = implode(',', $service_ids);
if ($service_ids) {
$shop_ids = db_factory::query(' select shop_id,service_status ss from ' . TABLEPRE . 'witkey_service where service_id in (' . $service_ids . ')');
if ($shop_ids) {
foreach ($shop_ids as $v) {
$ss = intval($v['ss']);
if ($ss != $status) {
if ($status == 3 || $ss == 2 && ($status = -1)) {
$plus = -1;
} else {
$plus = 1;
}
$ids .= $v['shop_id'] . ',';
}
}
$ids = rtrim($ids, ',');
$ids && $plus and db_factory::execute(' update ' . TABLEPRE . 'witkey_shop set on_sale=on_sale+' . $plus . ' where shop_id in (' . $ids . ')');
}
}
}
示例13: get_user_auth_info
public function get_user_auth_info($uid, $is_username = 0, $show_id = '')
{
$sql = "select * from " . TABLEPRE . $this->_auth_table_name;
if ($uid) {
$is_username == '0' and $sql .= " where uid = '" . intval($uid) . "' " or $sql .= " where username = '" . kekezu::escape($uid) . "' ";
$show_id and $sql .= " and " . $this->_primary_key . "=" . intval($show_id);
$sql .= " order by {$this->_primary_key} desc";
$data = db_factory::query($sql);
if (sizeof($data) == 1) {
return $data[0];
} else {
return $data;
}
} else {
return array();
}
}
示例14: defined
<?php
defined('ADMIN_KEKE') or exit('Access Denied');
kekezu::admin_check_role(73);
$msg_obj = new Keke_witkey_msg_tpl_class();
$config_msg_arr = $kekezu->get_table_data("*", "witkey_msg_config", " 1 = 1 ", "config_id desc ", '', '', 'config_id');
$now_msg_arr = db_factory::get_one(" select * from " . TABLEPRE . "witkey_msg_config where k='{$slt_tpl_code}'");
$now_v = unserialize($now_msg_arr['v']);
if (isset($tpl_code)) {
$msg_tpl = db_factory::query(" select * from " . TABLEPRE . "witkey_msg_tpl where tpl_code='{$tpl_code}'");
if ($msg_tpl) {
kekezu::echojson('', 1, $msg_tpl);
} else {
echo json_encode(array("status" => 0));
}
}
$objMsgC = new Keke_witkey_msg_config_class();
if (isset($sbt_edit)) {
if ($slt_tpl_code) {
$objMsgC->setWhere("k='{$slt_tpl_code}'");
$objMsgC->setContent($tar_msg_temp_content);
$res = $objMsgC->edit_keke_witkey_msg_config();
}
if ($res) {
kekezu::admin_system_log($_lang['edit_sms_tpl']);
kekezu::admin_show_msg($_lang['edit_sms_tpl_success'], 'index.php?do=msg&view=intertpl&slt_tpl_code=' . $slt_tpl_code, 3, '', 'success');
}
}
$msg_tpl = db_factory::get_one("select content from " . TABLEPRE . "witkey_msg_config where k='{$slt_tpl_code}'");
$msg_tpl = $msg_tpl['content'];
require $kekezu->_tpl_obj->template(ADMIN_DIRECTORY . '/tpl/admin_msg_' . $view);
示例15: array_merge
$strSql = ' select a.case_id,a.obj_id,a.obj_type,a.case_img,a.case_title,a.case_price ';
$task_open and $strSql .= ',b.work_num,b.model_id,b.username,b.uid ';
$shop_open and $strSql .= ' ,c.sale_num,c.model_id,c.username,b.uid ';
$strSql .= ' from ' . TABLEPRE . 'witkey_case a ';
$task_open and $strSql .= ' left join ' . TABLEPRE . 'witkey_task b ON a.obj_id = b.task_id ';
$shop_open or $strSql .= ' where a.obj_type="task" ';
$shop_open and $strSql .= ' left join ' . TABLEPRE . 'witkey_service c on a.obj_id= c.service_id ';
$task_open or $strSql .= ' where a.obj_type="service" ';
$strSql .= " order by a.on_time desc limit 9 ";
$arrCaseLists = db_factory::query($strSql, 1, $intIndexCacheTime);
if (!$basic_config['css_auto_fit']) {
$arrCaseLists = array_merge(array($arrCaseLists[0]), $arrCaseLists);
if (count($arrCaseLists) > 9) {
unset($arrCaseLists[9]);
}
}
$arrDynamicPlays = kekezu::get_feed("feedtype='work_accept'", "feed_time desc", 10);
$arrRecommShops = db_factory::query(sprintf("select a.username,a.uid,b.indus_id,b.indus_pid,a.shop_name,if(b.seller_total_num>0,b.seller_good_num/b.seller_total_num,0) as good_rate from %switkey_shop a " . " left join %switkey_space b on a.uid=b.uid where b.recommend=1 and b.status=1 and IFNULL(a.is_close,0)=0 and shop_status=1 order by good_rate desc limit 0,6", TABLEPRE, TABLEPRE), 1, $intIndexCacheTime);
$arrRecommShops1 = db_factory::query(sprintf("select a.username,a.uid,b.indus_id,b.indus_pid,a.shop_name,if(b.seller_total_num>0,b.seller_good_num/b.seller_total_num,0) as good_rate from %switkey_shop a " . " left join %switkey_space b on a.uid=b.uid where b.recommend=1 and b.status=1 and IFNULL(a.is_close,0)=0 and shop_status=1 order by good_rate desc ", TABLEPRE, TABLEPRE), 1, $intIndexCacheTime);
$arrArticleTop = db_factory::get_one("select * from " . TABLEPRE . "witkey_article where cat_type='article' and LENGTH(art_pic)>20 order by pub_time desc limit 1", 1, $intIndexCacheTime);
$arrArticleLists = db_factory::query("select * from " . TABLEPRE . "witkey_article where cat_type='article' and art_id !='" . $arrArticleTop['art_id'] . "' order by pub_time desc limit 6", 1, $intIndexCacheTime);
$arrPubToday = db_factory::query("select count(*) as count from " . TABLEPRE . "witkey_task where date(from_unixtime(start_time)) = curdate() and task_status>=2", 1, $intIndexCacheTime);
$arrAcceptTask = db_factory::query("SELECT obj_id FROM " . TABLEPRE . "witkey_feed where obj_id>0 and feedtype='work_accept' and date(from_unixtime(feed_time)) = curdate() group by obj_id ; ", 1, $intIndexCacheTime);
$arrAcceptToday = count($arrAcceptTask);
$arrCashToday = db_factory::query("SELECT sum(fina_cash) as cash FROM " . TABLEPRE . "witkey_finance where (fina_action='task_bid' or fina_action='sale_service') and date(from_unixtime(fina_time)) = curdate() ;", 1, $intIndexCacheTime);
$arrPubAll = db_factory::query("select count(*) as count from " . TABLEPRE . "witkey_task where task_status>=2", 1, $intIndexCacheTime);
$arrAcceptTasks = db_factory::query("SELECT obj_id FROM " . TABLEPRE . "witkey_feed where obj_id>0 and feedtype='work_accept' group by obj_id ;", 1, $intIndexCacheTime);
$arrAcceptAll = count($arrAcceptTasks);
$arrCashAll = db_factory::query("SELECT sum(fina_cash) as cash FROM " . TABLEPRE . "witkey_finance where (fina_action='task_bid' or fina_action='sale_service') ;", 1, $intIndexCacheTime);
$arrFlink = kekezu::get_table_data("link_id,link_name,link_url,listorder", "witkey_link", "", " listorder asc", "", "", "", $intIndexCacheTime);
}