本文整理汇总了PHP中db_factory::get_one方法的典型用法代码示例。如果您正苦于以下问题:PHP db_factory::get_one方法的具体用法?PHP db_factory::get_one怎么用?PHP db_factory::get_one使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db_factory
的用法示例。
在下文中一共展示了db_factory::get_one方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_comment
function save_comment($comment_arr, $obj_id, $is_reply = false)
{
global $_lang, $kekezu, $uid, $username;
if (!$uid) {
return -1;
die;
}
$r = kekezu::check_session('task_leave', 2, 4);
if ($r == false) {
return -2;
die;
}
strtolower(CHARSET) == 'gbk' and $comment_arr['content'] = kekezu::utftogbk(kekezu::escape($comment_arr['content']));
if (kekezu::k_match(array($kekezu->_sys_config['ban_content']), $comment_arr['content'])) {
return -3;
die;
}
$comment_id = $this->_comment_obj->save($comment_arr);
$model_list = $kekezu->_model_list;
if (!$is_reply) {
if ($this->_comment_type == 'task') {
$res = db_factory::execute(sprintf(" update %switkey_task set leave_num =ifnull(leave_num,0)+1 where task_id='%d'", TABLEPRE, $obj_id));
$obj_info = db_factory::get_one(sprintf("select * from %switkey_task where task_id=%d", TABLEPRE, $obj_id));
if ($obj_info['task_cash_coverage']) {
$cash = $obj_info['task_cash_coverage'];
} else {
$cash = $obj_info['task_cash'];
}
} elseif ($this->_comment_type == 'service') {
$res = db_factory::execute(sprintf(" update %switkey_service set leave_num =ifnull(leave_num,0)+1 where service_id='%d'", TABLEPRE, $obj_id));
$obj_info = db_factory::get_one(sprintf("select * from %switkey_service where service_id=%d", TABLEPRE, $obj_id));
}
}
return $comment_id;
}
示例2: 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_coverage,start_time,end_time,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 = $task_info['end_time'] - $task_info['start_time'];
$task_day = date('Y-m-d', $allow_time + time());
$release_info['txt_task_day'] = $task_day;
$release_info['task_cash_cove'] = $task_info['task_cash_coverage'];
$this->save_task_obj($release_info, $std_cache_name);
}
break;
}
}
示例3: cash_out
public static function cash_out($id, $cash, $action, $profit = 0, $obj_type = null, $obj_id = null)
{
$user_info = db_factory::get_one("select * from " . TABLEPRE . "witkey_space where uid = " . intval($id));
$res = false;
$fo = new Keke_witkey_finance_class();
$fo->setFina_action($action);
$fo->setFina_type("out");
$fo->setObj_type($obj_type);
$fo->setObj_id($obj_id);
$fo->setSite_profit($profit);
$fo->setUid($user_info['uid']);
$fo->setUsername($user_info['username']);
if (empty(self::$_mem)) {
$action_arr = keke_glob_class::get_finance_action($action);
self::$_mem = $action_arr[$action];
}
$fo->setFina_mem(self::$_mem);
$user_balance = $user_info['balance'];
if ($cash && $action) {
try {
if ($user_balance < $cash) {
return false;
}
db_factory::execute("update " . TABLEPRE . "witkey_space set balance = balance-" . abs(floatval($cash)) . " where uid ='{$user_info['uid']}'");
$fo->setFina_cash($cash);
$fo->setUser_balance($user_balance - abs($cash));
$fo->setFina_time(time());
$res = $fo->create_keke_witkey_finance();
} catch (Exception $e) {
keke_exception::handler($e);
}
}
return $res;
}
示例4: 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;
}
}
示例5: __construct
public function __construct($report_id, $report_info, $obj_info)
{
parent::__construct($report_id, $report_info, $obj_info);
$this->_task_info = $this->get_task_info($this->_report_info['origin_id']);
$this->_task_obj = new match_task_class($this->_task_info);
$this->_match_task = db_factory::get_one(sprintf(" select * from %switkey_task_match where task_id='%d'", TABLEPRE, $this->_obj_info['origin_id']));
$this->_match_work = db_factory::get_one(sprintf(" select b.* from %switkey_task_work a left join %switkey_task_match_work b on a.work_id=b.work_id where a.task_id='%d' and a.work_status=4", TABLEPRE, TABLEPRE, $this->_obj_info['origin_id']));
}
示例6: checkFieldName
function checkFieldName($name, $model_id)
{
$result = db_factory::get_one("SELECT f_name FROM `" . TABLEPRE . "witkey_custom_fields` where f_name = '" . kekezu::escape($name) . "' and model_id=" . intval($model_id));
if ($result['f_name']) {
return true;
} else {
return false;
}
}
示例7: get_info
function get_info($uid, $t)
{
$sql = " select balance,credit,uid,username from %switkey_space where ";
if ($t == '1') {
$sql1 = sprintf($sql . " uid=%d ", TABLEPRE, $uid, $uid);
$info = db_factory::get_one($sql1);
} else {
$sql = sprintf($sql . " username='%s'", TABLEPRE, $uid);
$info = db_factory::get_one($sql);
}
return $info;
}
示例8: order_charge
function order_charge()
{
global $_K;
$order_id = $this->_order_id;
$sid = $this->_obj_id;
$uid = $this->_uid;
$user_info = $this->_userinfo;
$order_info = db_factory::get_one(sprintf(" select order_status,order_uid,order_username,seller_uid,seller_username from %switkey_order where order_id='%d'", TABLEPRE, $order_id));
$url = $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=2&order_id=" . $order_id;
$s_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=1&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>";
$b_order_link = "<a href=\"" . $_K['siteurl'] . "/index.php?do=user&view=finance&op=order&obj_type=service&role=2&order_id=" . $order_id . "\">" . $order_info['order_name'] . "</a>";
if ($order_info['order_status'] == 'wait') {
$service_info = keke_shop_class::get_service_info($sid);
$service_status = db_factory::get_count(sprintf(" select service_status from %switkey_service where service_id='%d'", TABLEPRE, $sid));
if ($service_status == '2') {
$data = array(':service_id' => $service_info['service_id'], ':title' => $service_info['title']);
keke_finance_class::init_mem('buy_service', $data);
$this->_total_fee > 0 and $res = keke_finance_class::cash_out($uid, $this->_total_fee, 'buy_service', '0', 'service', $order_id);
if ($res) {
db_factory::execute(sprintf(" update %switkey_order set order_status='ok' where order_id='%d'", TABLEPRE, $order_id));
$v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], '用户' => $_lang['you'], '动作' => $_lang['haved_confirm_pay'], '订单编号' => $order_id, '订单链接' => $b_order_link);
keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_confirm_pay'], $v_arr);
$v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], '用户' => $order_info['order_username'], '动作' => $_lang['haved_confirm_pay'], '订单编号' => $order_id, '订单链接' => $s_order_link);
keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_confirm_pay'], $v_arr);
$notice = $_lang['goods_pay_success'];
$type = 'success';
} else {
$notice = $_lang['goods_pay_fail'];
$type = 'warning';
}
} else {
db_factory::execute(sprintf(" update %switkey_order set order_status='close' where order_id='%d'", TABLEPRE, $order_id));
$v_arr = array('用户名' => $order_info['seller_username'], '网站名称' => $kekezu->_sys_config['website_name'], "用户" => $_lang['system'], '动作' => $_lang['stop_your_order_and_your_cash_return'], '订单编号' => $order_id, '订单链接' => $s_order_link);
keke_shop_class::notify_user($order_info['seller_uid'], $order_info['seller_username'], "order_change", $_lang['goods_order_close'], $v_arr);
$v_arr = array('用户名' => $order_info['order_username'], '网站名称' => $kekezu->_sys_config['website_name'], "用户" => $_lang['system'], '动作' => $_lang['stop_your_order_and_your_cash_return'], '订单编号' => $order_id, '订单链接' => $b_order_link);
keke_shop_class::notify_user($order_info['order_uid'], $order_info['order_username'], "order_change", $_lang['goods_order_close'], $v_arr);
$notice = $_lang['goods_pay_fail'];
$type = 'warning';
}
} else {
$notice = $_lang['goods_pay_success'];
$type = 'success';
}
return pay_return_fac_class::struct_response($_lang['operate_notice'], $notice, $url, $type);
}
示例9: service_pass
function service_pass($service_ids)
{
is_array($service_ids) and $ids = implode(",", $service_ids) or $ids = $service_ids;
$ids and self::set_on_sale_num($ids, 2);
$res = db_factory::execute(sprintf("update %switkey_service set service_status='%d' where service_id in(%s)", TABLEPRE, 2, $ids));
if ($res) {
if (is_array($service_ids)) {
foreach ($service_ids as $key => $val) {
$service_info = keke_shop_class::get_service_info($val);
$feed_arr = array("feed_username" => array("content" => $service_info['username'], "url" => "index.php?do=seller&id={$service_info['uid']}"), "action" => array("content" => '发布了服务', "url" => ""), "event" => array("content" => "{$service_info['title']}", "url" => "index.php?do=goods&id={$val}", "cash" => "{$service_info['price']}", "model_id" => "{$service_info['model_id']}"));
kekezu::save_feed($feed_arr, $service_info['uid'], $service_info['username'], 'pub_service', $service_info['service_id']);
}
} else {
$service_info = db_factory::get_one(sprintf("select * from %switkey_service where service_id=%d", TABLEPRE, $service_ids));
$feed_arr = array("feed_username" => array("content" => $service_info['username'], "url" => "index.php?do=seller&id={$service_info['uid']}"), "action" => array("content" => '发布服务', "url" => ""), "event" => array("content" => "{$service_info['title']}", "url" => "index.php?do=goods&id={$service_ids}", "cash" => "{$service_info['price']}", "model_id" => "{$service_info['model_id']}"));
kekezu::save_feed($feed_arr, $service_info['uid'], $service_info['username'], 'pub_service', $service_info['service_id']);
}
}
return $res;
}
示例10: dispose_task
public function dispose_task()
{
global $kekezu, $_lang;
$prom_obj = $objProm = keke_prom_class::get_instance();
$model_code = $this->_model_code;
$agree_info = $this->_agree_info;
$cash_info = db_factory::get_one(sprintf(" select task_cash,task_union,real_cash from %switkey_task where task_id = '%d'", TABLEPRE, $this->_task_id));
$this->plus_mark_num();
keke_user_mark_class::create_mark_log($model_code, '1', $agree_info['seller_uid'], $agree_info['buyer_uid'], $agree_info['work_id'], $cash_info['task_cash'], $this->_task_id, $this->_seller_username, $this->_buyer_username);
keke_user_mark_class::create_mark_log($model_code, '2', $agree_info['buyer_uid'], $agree_info['seller_uid'], $agree_info['work_id'], $cash_info['real_cash'], $this->_task_id, $this->_buyer_username, $this->_seller_username);
$site_profit = $cash_info['task_cash'] - $cash_info['real_cash'];
$task_title = db_factory::get_count(sprintf(" select task_title from %switkey_task where task_id='%d'", TABLEPRE, $this->_task_id));
$data = array(':task_id' => $this->_task_id, ':task_title' => $task_title);
keke_finance_class::init_mem('task_bid', $data);
keke_finance_class::cash_in($agree_info['seller_uid'], $cash_info['real_cash'], 'task_bid', '', 'task', $this->_task_id, $site_profit);
$feed_arr = array("feed_username" => array("content" => $this->_seller_uid, "url" => "index.php?do=seller&id={$this->_seller_uid}"), "action" => array("content" => $_lang['success_bid_haved'], "url" => ""), "event" => array("content" => $task_title, "url" => "index.php?do=task&id={$this->_task_id}", 'cash' => $cash_info['real_cash']));
kekezu::save_feed($feed_arr, $this->_seller_uid, $this->_seller_username, 'work_accept', $this->_task_id);
$prom_obj->dispose_prom_event("bid_task", $agree_info['seller_uid'], $this->_task_id);
$prom_obj->dispose_prom_event("pub_task", $agree_info['buyer_uid'], $this->_task_id);
}
示例11: user_charge
private function user_charge()
{
global $_K;
global $_lang;
$uid = $this->_uid;
$order_id = $this->_order_id;
$order_id = keke_order_class::update_order_charge($this->_out_trade_no, $this->_total_fee);
$order_info = db_factory::get_one(sprintf(" select order_status,order_type from %switkey_order_charge where order_id='%d' and uid='%d'", TABLEPRE, $order_id, $uid));
if ($order_info['order_status'] == 'wait') {
db_factory::execute(sprintf(" update %switkey_order_charge set order_status='ok' where order_id='%d'", TABLEPRE, $order_id));
$res = keke_finance_class::cash_in($uid, $this->_total_fee, $order_info['order_type'], $this->_charge_type, 'user_charge', $order_id);
$v_arr = array($_lang['recharge_account'] => $this->_total_fee);
keke_shop_class::notify_user($this->_uid, $this->_username, "pay_success", $_lang['online_recharge_success'], $v_arr, 2);
} else {
$res = true;
}
if ($res) {
return $this->struct_response($_lang['operate_notice'], $_lang['online_recharge_success'], $url, 'success');
} else {
return $this->struct_response($_lang['operate_notice'], $_lang['online_recharge_fail'], $url, 'warning');
}
}
示例12: add_auth
public function add_auth($data, $file_name = '')
{
global $kekezu, $user_info, $_lang;
$moblie_obj = new Keke_witkey_auth_mobile_class();
$fdata = $this->format_auth_apply($data);
$valid_code = kekezu::randomkeys(4);
$fdata['valid_code'] = $valid_code;
$fdata[auth_time] = time();
$msg_obj = new keke_msg_class();
$content = $_lang['dear'] . $user_info['username'] . $_lang['hello'] . $_lang['mobile_auth_code'] . " {$fdata['valid_code']} " . $_lang['from'] . "[{$kekezu->_sys_config[website_url]}]";
$msg_res = $msg_obj->send_phone_sms($fdata['mobile'], $content);
if ($msg_res == "操作成功") {
$auth_info = db_factory::get_one(sprintf("select * from %switkey_auth_mobile where uid='%d'", TABLEPRE, $user_info['uid']));
if ($auth_info) {
$moblie_obj->setWhere('uid=' . $fdata['uid']);
$moblie_obj->setMobile($fdata[mobile]);
$moblie_obj->setValid_code($fdata['valid_code']);
$moblie_obj->setAuth_status(0);
$moblie_obj->edit_keke_witkey_auth_mobile();
} else {
$moblie_obj->setUid($fdata[uid]);
$moblie_obj->setMobile($fdata[mobile]);
$moblie_obj->setValid_code($fdata['valid_code']);
$moblie_obj->setUsername($fdata[username]);
$moblie_obj->setCash($fdata[cash]);
$moblie_obj->setAuth_time($fdata[auth_time]);
$moblie_obj->setAuth_status(0);
$moblie_obj->create_keke_witkey_auth_mobile();
}
$fdata['start_time'] == $fdata['end_time'] and $end_time = $fdata['end_time'] or $end_time = 0;
$res = $this->add_auth_record($fdata['uid'], $fdata['username'], $this->_auth_code, $end_time, 0);
parse_str($_SERVER['QUERY_STRING'], $arr);
$arr[auth_step] = "step2";
unset($arr['inajax']);
return true;
}
return false;
}
示例13: process_rights
public function process_rights($op_result, $type)
{
global $_lang;
$trans_name = $this->get_transrights_name($this->_report_type);
$op_result = $this->op_result_format($op_result);
$g_info = $this->user_role('gz');
$w_info = $this->user_role('wk');
switch ($op_result['action']) {
case "pass":
if ($this->_process_can['sharing']) {
$total_cash = floatval($this->_obj_info['cash']);
$gz_get = floatval($op_result['gz_get']);
$wk_get = floatval($op_result['wk_get']);
if ($total_cash != $gz_get + $wk_get) {
kekezu::admin_show_msg($_lang['wain_you_give_cash_error_notice'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", "", "warning");
} else {
$res = keke_finance_class::cash_in($g_info['uid'], $gz_get, 'rights_return');
$res .= keke_finance_class::cash_in($w_info['uid'], $wk_get, 'rights_return');
if ($res) {
$order_info = db_factory::get_one(sprintf("SELECT obj_id FROM `%switkey_report` WHERE obj = 'order' and report_id = %d", TABLEPRE, $this->_report_id));
db_factory::execute(sprintf("update %switkey_order set `order_status`='close' where order_id = '%d'", TABLEPRE, intval($order_info['obj_id'])));
$this->process_unfreeze('pass', $op_result['process_result']);
$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');
} else {
kekezu::admin_show_msg($trans_name . $_lang['deal_fail_now_forbit_deal_cash'], "index.php?do=trans&view=process&type={$type}&report_id=" . $this->_report_id, "3", '', 'warning');
}
break;
case "nopass":
$this->process_unfreeze('nopass', $op_result['reply']);
$res = $this->change_status($this->_report_id, '3', $op_result, $op_result['reply']);
$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');
break;
}
}
示例14: add_auth_record
public function add_auth_record($uid, $username, $auth_code, $end_time, $data = array(), $auth_status = '0')
{
$record_obj = new Keke_witkey_auth_record_class();
$record_info = db_factory::get_one(sprintf(" select * from %switkey_auth_record where uid = '%d' and auth_code = '%s'", TABLEPRE, $uid, $auth_code));
if ($record_info['ext_data'] && $data) {
$odata = unserialize($record_info['ext_data']);
$odata and $data = array_merge($odata, $data);
}
$record_obj->setAuth_code($auth_code);
$record_obj->setUid($uid);
$record_obj->setUsername($username);
if ($data) {
is_array($data) and $data = serialize($data);
$data and $record_obj->setExt_data($data);
}
$record_obj->setEnd_time($end_time);
if ($record_info) {
$record_obj->setWhere('record_id = ' . $record_info['record_id']);
return $record_obj->edit_keke_witkey_auth_record();
} else {
$record_obj->setAuth_status($auth_status);
return $record_obj->create_keke_witkey_auth_record();
}
}
示例15: 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);