本文整理汇总了PHP中core::db方法的典型用法代码示例。如果您正苦于以下问题:PHP core::db方法的具体用法?PHP core::db怎么用?PHP core::db使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::db方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_account_infor
public function get_account_infor($account_name)
{
$db = core::db()->getConnect('DTS');
$account_name = addslashes($account_name);
$sql = sprintf("SELECT * FROM %s WHERE partner_name='%s' LIMIT 1", $this->tbl, $account_name);
return $db->query($sql, 'array');
}
示例2: get_capital
/**
* 资产信息
* @param id $user_id
* return Array
*/
public function get_capital($user_id)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf("SELECT * FROM %s WHERE uid='%s' LIMIT 1", $this->tbl, $user_id);
$capital = $db->query($sql, 'array');
$data = array();
if (empty($capital)) {
$data['account_money'] = 0.0;
$data['back_money'] = 0.0;
$data['all_money'] = 0.0;
$data['money_freeze'] = 0.0;
$data['money_collect'] = 0.0;
$data['wait_interest'] = 0.0;
return $data;
}
//$interest_collection = M('investor_detail') sum(interest) as interest $transfer_interest_collection = M('transfer_investor_detail')
//$benefit['interest_collection'] = $interest_collection['interest']+ $transfer_interest_collection['interest']-$transfer_interest_collection['fee'];//dai shou ben xi
$sql2 = sprintf("SELECT sum(interest) as interest FROM %s WHERE investor_uid= %s and status in (6,7) ", $this->tbli, $user_id);
$interst = $db->query($sql2, 1);
$data['account_money'] = floatval($capital['account_money'] + $capital['back_money']);
//帐户余额
$data['back_money'] = (double) $capital['back_money'];
//累计收益
$data['all_money'] = floatval($capital['account_money'] + $capital['back_money'] + $capital['money_collect'] + $capital['freeze_money']);
//总资产
$data['money_freeze'] = (double) $capital['money_freeze'];
//冻结金额
$data['money_collect'] = (double) $capital['money_collect'];
//待收总额
$data['wait_interest'] = (double) $interst;
//待收利息,还没算出来
return $data;
}
示例3: setApplicationBorrow
public function setApplicationBorrow($data)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf('INSERT INTO `%s`(`user_phone`,`borrow_use`,`borrow_duration`,`borrow_money`) VALUES("%s","%s","%s","%s")', $this->tbl, $data['user_phone'], $data['borrow_use'], $data['borrow_duration'], $data['borrow_money']);
$db->query($sql);
return mysql_insert_id();
}
示例4: send
public static function send($event)
{
$conf = core::conf();
$db = core::db();
// Поиск шаблона письма по имени события
$template = $db->Execute(sprintf("SELECT `subject`,`text`,`tags` FROM {$conf->db_prefix}mail WHERE `event`='%s' AND `active`='1'", $event))->fields;
$subject = htmlspecialchars_decode($template['subject']);
$message = htmlspecialchars_decode($template['text']);
$tags = explode(',', $template['tags']);
// Замена тегов в письме на значения переменных
foreach ($tags as $tag) {
$tag = explode('.', $tag);
if (is_array($GLOBALS[$tag[0]])) {
$value = $GLOBALS[$tag[0]][$tag[1]];
} elseif (is_object($GLOBALS[$tag[0]])) {
$value = $GLOBALS[$tag[0]]->{$tag}[1];
} else {
$value = $GLOBALS[$tag[0]];
}
$subject = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $subject);
$message = str_replace('{' . $tag[0] . '.' . $tag[1] . '}', $value, $message);
}
$mail_to = $user->email;
$mail_from = $conf->site_mail;
// Отправка письма
if ($subject != '' && $message != '') {
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
$headers .= 'To: ' . $user->name . ' <' . $mail_to . '>' . "\r\n";
$headers .= 'From: ' . $conf->site_name . ' <' . $mail_from . '>' . "\r\n";
mail($mail_to, $subject, $message, $headers);
}
}
示例5: getBorrowInvest
public function getBorrowInvest($bid)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf("SELECT m.user_name,bi.investor_capital,bi.add_time LEFT JOIN %s AS m ON (m.id=bi.investor_uid) FROM %s AS bi WHERE bi.borrow_id = %s", $this->table1, $this->table, $bid);
$zw = $db->query($sql, 1);
return $zw;
}
示例6: getUserBank
public function getUserBank($userId)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf("SELECT m.bank_name,m.bank_num FROM %s AS m where m.uid='%s' ", $this->tbl, $userId);
$zw = $db->query($sql, 'array');
return $zw;
//
}
示例7: log
public function log($mobiles, $content, $response, $report_id = '', $send_status = '')
{
$send_time = date('Y-m-d H:i:s');
$sms_supplier = 'dream';
$db = core::db()->getConnect('SMS');
$sql = sprintf("insert into tbl_log_qunfa set send_time='%s',mobiles='%s',`content`='%s',reponse_data='%s',sms_supplier='%s',report_id='%s',send_status='%s'", $send_time, $mobiles, $content, $response, $sms_supplier, $report_id, $send_status);
$db->query($sql);
}
示例8: changePwd
private function changePwd($mobile, $pwd)
{
if (empty($mobile)) {
return false;
}
$sql = sprintf("update `%s` set user_pass='%s' where user_phone='%s';", $this->numberTab, $pwd, $mobile);
$number = core::db()->getConnect('CAILAI');
$cnt = $number->query($sql);
}
示例9: isRegisted
private function isRegisted($mobile)
{
if (empty($mobile)) {
return false;
}
$sql = sprintf("select user_phone from `%s` where user_phone='%s';", $this->numberTab, $mobile);
$number = core::db()->getConnect('CAILAI');
$cnt = $number->query($sql);
return $cnt;
}
示例10: get_banner
public function get_banner($latest_time)
{
$db = core::db()->getConnect('DTS', true);
$sql = sprintf("SELECT pic_url,`desc`,`link`,`need_update` FROM %s ", $this->tbl);
$ret = $db->query($sql);
while ($row = $db->fetchArray($ret)) {
$data[] = $row;
}
return $data;
}
示例11: update
/**
* 更新响应日志
* @param unknown_type $log_id
* @param unknown_type $response_data
*/
public static function update($log_id, $response_data, $wdu_id = '')
{
$db = core::db()->getConnect('DTS');
$response_time = date('Y-m-d H:i:s');
if (get_magic_quotes_gpc()) {
$sql = sprintf("update %s set request_md5='%s', response_time='%s',response_data='%s' where message_id='%d' limit 1", self::$log_tbl, $wdu_id, $response_time, $response_data, $log_id);
} else {
$sql = sprintf("update %s set request_md5='%s', response_time='%s',response_data='%s' where message_id='%d' limit 1", self::$log_tbl, $wdu_id, $response_time, addslashes($response_data), $log_id);
}
$db->query($sql);
}
示例12: getDealRecord
public function getDealRecord($userId, $offset, $pageSize)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf("SELECT type,affect_money,collect_money,info,add_time,account_money,back_money FROM %s WHERE uid='%s' and `type`!=23 ORDER BY id DESC limit %s,%s ", $this->tbl, $userId, $offset, $pageSize);
$zw = $db->query($sql);
while ($row = $db->fetchArray($zw)) {
$data['type'] = moneyType($row['type']);
$data['affect_money'] = (double) $row['affect_money'];
$data['collect_money'] = (double) $row['collect_money'];
$data['desc'] = $row['info'];
$data['account_money'] = (double) ($row['account_money'] + $row['back_money']);
$data['date'] = date('Y-m-d H:i:s', $row['add_time']);
$result[] = $data;
}
if (empty($result)) {
return $result = (array) array();
}
return $result;
}
示例13: dealRed
public function dealRed($redata)
{
$db = core::db()->getConnect('CAILAI', true);
$redid = $redata['redid'];
$borrow_id = $redata['borrow_id'];
$usetime = $redata['usetime'];
//$is_used=$redata['is_used'];
$transamt = $redata['transamt'];
$orderno = $redata['orderno'];
file_put_contents('/tmp/zw2.txt', date('m-d H:i:s') . "\$redarr " . print_r($redarr, true) . "\n", FILE_APPEND);
if (is_array($redid)) {
foreach ($redid as $key => $value) {
file_put_contents('/tmp/zw2.txt', date('m-d H:i:s') . "\$redarr " . print_r($redid, true) . "\n", FILE_APPEND);
$sql = sprintf("update %s set borrow_id=%s,usetime=%s,transamt=%s,orderno=%s WHERE id = %s", $this->active_redpacket, $borrow_id, $usetime, $transamt, $orderno, $value);
$zw = $db->query($sql);
}
}
return $zw;
}
示例14: event
public function event($event_name)
{
$conf = core::conf();
$db = core::db();
// Поиск действий, связанных с данным событием
$result = $db->execute("SELECT `module`,`action` FROM {$conf->db_prefix}monitor WHERE `event`='?' ORDER BY `weight`", $event_name);
while ($result && !$result->EOF) {
$action = $result->fields['action'];
$module = $result->fields['module'];
$module_group = $db->execute("SELECT `module_group` FROM {$conf->db_prefix}modules WHERE `name`='?'", $module)->fields['group'];
// Запуск действия
$action_path = $conf->root_dir . '/' . $module_group . '/modules/' . $module . '/class.' . $module . '.php';
if (file_exists($action_path)) {
require_once $action_path;
call_user_func($module . '::' . $action, $event_name);
}
$result->MoveNext();
}
}
示例15: getArea
public function getArea($idno)
{
$db = core::db()->getConnect('CAILAI', true);
$sql = sprintf("SELECT lmi.uid,lmi.cell_phone,lmi.idcard,lmi.real_name,lmi.age,lmi.address,m.reg_time From %s as lmi left join %s as m on lmi.uid=m.id where lmi.idcard like '%s%s%s' order by m.reg_time desc", $this->table_lmi, $this->table_m, '%', $idno, '%');
$zw = $db->query($sql);
$data = array();
while ($row = $db->fetchArray($zw)) {
$data['uid'] = $row['uid'];
$data['cell_phone'] = $row['cell_phone'];
$data['idcard'] = $row['idcard'];
$data['real_name'] = $row['real_name'];
$data['age'] = $row['age'];
$data['address'] = $row['address'];
$data['reg_time'] = $row['reg_time'];
$result[] = $data;
}
if (empty($result)) {
return $result = (array) array();
}
return $result;
}