Ejemplo n.º 1
0
 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');
 }
Ejemplo n.º 2
0
 /**
  * 资产信息
  * @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;
 }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 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);
     }
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
     //
 }
Ejemplo n.º 7
0
 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);
 }
Ejemplo n.º 8
0
 private function changePwd($mobile, $pwd)
 {
     if (empty($mobile)) {
         return false;
     }
     $sql = sprintf("update `%s` set user_pass='******' where user_phone='%s';", $this->numberTab, $pwd, $mobile);
     $number = core::db()->getConnect('CAILAI');
     $cnt = $number->query($sql);
 }
Ejemplo n.º 9
0
 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;
 }
Ejemplo n.º 10
0
 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;
 }
Ejemplo n.º 11
0
 /**
  * 更新响应日志
  * @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);
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 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;
 }
Ejemplo n.º 14
0
 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();
     }
 }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 public function setUserChannelId($data)
 {
     $db = core::db()->getConnect('CAILAIPUSH', true);
     $_sql = sprintf('SELECT * FROM `%s` WHERE channel_id="%s"', $this->tbl_device, $data['channel_id']);
     //判断是否存在,已经存在则不存库;如果channel_id存在,member_id不同,则更新;
     //        return $data;
     $row = $db->query($_sql, 2);
     if ($row['channel_id'] != $data['channel_id'] && $row['member_id'] != $data['member_id']) {
         $sql = sprintf('INSERT INTO `%s`(`member_id`,`member_phone`,`channel_id`,`is_app`,`device_type`) VALUES("%s","%s","%s","%s","%s")', $this->tbl_device, $data['member_id'], $data['member_phone'], $data['channel_id'], IS_APP, $data['device_type']);
         $db->query($sql);
         return mysql_insert_id();
     } else {
         if ($row['channel_id'] == $data['channel_id'] && $row['member_id'] == $data['member_id']) {
             return "已经存在";
         } else {
             if ($row['channel_id'] == $data['channel_id'] && $row['member_id'] != $data['member_id']) {
                 $sql = sprintf("UPDATE %s SET member_id='%s',member_phone='%s' WHERE channel_id='%s'", $this->tbl_device, $data['member_id'], $data['member_phone'], $data['channel_id']);
                 $db->query($sql);
                 return "更新成功";
             }
         }
     }
 }
Ejemplo n.º 17
0
 public function auth()
 {
     $conf = core::conf();
     $db = core::db();
     $time = time();
     // пользователь авторизован
     if (!empty($_SESSION['user_login']) && !empty($_SESSION['user_hash'])) {
         $input_login = $_SESSION['user_login'];
         $input_hash = $_SESSION['user_hash'];
     } elseif (isset($_POST['user_login']) && isset($_POST['user_hash'])) {
         $input_login = $_POST['user_login'];
         $input_hash = $_POST['user_hash'];
     } else {
         return false;
     }
     $data = $this->repository->findOneBy(array('login' => $input_login));
     $hash = md5($user_data['id'] . ':' . $input_login . ':' . $input_hash . ':' . $user_data['salt']);
     if ($user_data['hash'] == $hash) {
         $db->Execute(sprintf("UPDATE {$conf->db_prefix}users SET `time_l`='%d' WHERE `id`='%d'", time(), $user_data['id']));
         $_SESSION['user_login'] = $input_login;
         $_SESSION['user_hash'] = $input_hash;
         return true;
     } else {
         unset($_SESSION['user_hash']);
         return false;
     }
 }
Ejemplo n.º 18
0
function addMemberRedpacket($map)
{
    //            file_put_contents('/tmp/app',date('H:i:s').': '.print_r($map,true),FILE_APPEND);
    $db = core::db()->getConnect('CAILAI', true);
    $ssql = sprintf("SELECT id FROM lzh_members WHERE user_name=%s", $map['usrid']);
    $res = $db->query($ssql, 1);
    //
    //            file_put_contents('/tmp/app',date('H:i:s').': '.print_r($res,true),FILE_APPEND);
    //            file_put_contents('/tmp/app',date('H:i:s').': '.print_r($ssql,true),FILE_APPEND);
    $sql = sprintf("insert into %s set addtime='%s',rednum='%s',shelftime='%s',facevalue='%s',overtime='%s',owner='%s',is_success='%s',is_used='%s',note='%s'", 'lzh_active_redpacket', $map['addtime'], $map['rednum'], $map['shelftime'], $map['facevalue'], $map['overtime'], $res, $map['is_success'], $map['is_used'], $map['note']);
    //            file_put_contents('/tmp/app',date('H:i:s').': '.print_r($sql,true),FILE_APPEND);
    $result = $db->query($sql);
    return mysql_insert_id();
}
Ejemplo n.º 19
0
 public function get_privilege($account_name)
 {
     $accounts = (include "config/config.interface.php");
     if (in_array($account_name, array_keys($accounts))) {
         return $accounts[$account_name];
     } else {
         $db = core::db()->getConnect('DTS');
         $account_name = addslashes($account_name);
         $sql = sprintf("SELECT * FROM %s WHERE partner_name='%s'  LIMIT 1", 'dts_account', $account_name);
         return $db->query($sql, 'array');
     }
 }
Ejemplo n.º 20
0
 public function connect($db)
 {
     $this->_db_read = core::db()->getConnect($db, true);
     $this->_db_write = core::db()->getConnect($db);
     return $this;
 }
Ejemplo n.º 21
0
 public function reds($userId)
 {
     $db = core::db()->getConnect('CAILAI', true);
     $sql = sprintf("SELECT * from %s where owner=%s", $this->table_red, $userId);
     $lj = $db->query($sql);
     $data = array();
     while ($row = $db->fetchArray($lj)) {
         $result[] = $row;
     }
     if (empty($result)) {
         return $result = (array) array();
     }
     return $result;
 }
Ejemplo n.º 22
0
 /**
  *执行其他SQL操作
  */
 function execSQL($sql, $flag)
 {
     //$db = & $GLOBALS['_DSN']->getConnect($this->DBFlag,$flag);
     $db = core::db()->getConnect($this->DBFlag);
     $db->query($sql);
 }
Ejemplo n.º 23
0
<?php

require_once dirname(__FILE__) . '/../../www/header.php';
//用于官方统计
$objDb = core::db()->getConnect('CAILAI');
//首页统计
$sql = "SELECT SUM(investor_capital) as sum FROM `lzh_borrow_investor`";
$res = $objDb->query($sql, 'array');
$get_money = $res['sum'];
//累计帮助企业和个人融资
$sql2 = "SELECT SUM(investor_interest) as sum FROM `lzh_borrow_investor`";
$res2 = $objDb->query($sql2, 'array');
$make_money = $res2['sum'];
//为投资人赚取收益
//$sql3 = "select sum(capital+interest) as sum from lzh_investor_detail where repayment_time=0";//待收余额
$date = date('Y-m-d', strtotime(" -1 day"));
$date_start = strtotime($date . ' 00:00:00');
$date_end = strtotime($date . ' 23:59:59');
$sql3 = "SELECT SUM(borrow_money) as sum FROM `lzh_borrow_info` where add_time>{$date_start} and add_time<{$date_end}";
$res3 = $objDb->query($sql3, 'array');
$needgot_money = $res3['sum'] ? $res3['sum'] : 0;
//昨日交易额
//首页统计入库
$sql4 = "truncate `lzh_home_tongji`";
$objDb->query($sql4);
$sql4 = "insert into `lzh_home_tongji` set get_money='{$get_money}',make_money='{$make_money}',needgot_money='{$needgot_money}'";
$objDb->query($sql4);
//投资榜
$sql5 = "truncate `lzh_amount_top`";
$objDb->query($sql5);
$before_30 = strtotime(date('Y-m-d H:i:s', strtotime('- 30 day')));
Ejemplo n.º 24
0
 public function getBorrowDebtTotal()
 {
     $db = core::db()->getConnect('CAILAI', true);
     $sql = sprintf("SELECT count(*) AS total FROM %s WHERE status NOT IN (3,99)", 'lzh_invest_detb');
     $zw = $db->query($sql, 1);
     return $zw;
 }
Ejemplo n.º 25
0
 public function getPact($bid)
 {
     $db = core::db()->getConnect('CAILAI', true);
     $sql = sprintf('SELECT `id`,`borrow_use`,`borrow_duration`,`borrow_money`,`first_verify_time`,`borrow_interest_rate`,`second_verify_time`,`repayment_type`,`manage_rate`,`borrow_uid`,`borrow_fee` FROM %s where `id`=%s limit 1', $this->table, $bid);
     $ht = $db->query($sql);
     $row = $db->fetchArray($ht);
     $sqli = sprintf('SELECT `borrow_uid`,`investor_uid` ,`investor_capital`,`receive_capital` FROM %s WHERE `borrow_id`=%s', $this->tablebi, $bid);
     $ht = $db->query($sqli);
     $i = 0;
     while ($v = $db->fetchArray($ht)) {
         $row['investor'][$i]['capital'] = $v['investor_capital'] + $v['receive_capital'];
         $sqlp = sprintf('SELECT `cell_phone` FROM %s WHERE `uid`=%s limit 1', $this->tablemi, $v["investor_uid"]);
         $up = $db->query($sqlp, 1);
         $row['investor'][$i]['phone'] = $up;
         ++$i;
     }
     $row['aged1_30'] = '0.05';
     $row['agedm1_30'] = '0.3';
     $row['aged30'] = '0.1';
     $row['agedm30'] = '0.5';
     $sqlp = sprintf('SELECT `cell_phone` FROM %s WHERE `uid`=%s limit 1', $this->tablemi, $row["borrow_uid"]);
     $row['PacePhone'] = $db->query($sqlp, 1);
     return $row;
 }
Ejemplo n.º 26
0
 public function _initiativetenderAct()
 {
     $money = $_POST['TransAmt'];
     $m = date('m', time());
     $d = date('d', time());
     $mi = date('H:i', time());
     if (strcmp($_POST['RespCode'], "000") == 0) {
         $subOrdId = $_POST['OrdId'];
         $db_user = core::db()->getConnect('CAILAI');
         $sql = "update lzh_active_redpacket set is_success='1' where orderno=" . "'" . $subOrdId . "'";
         $rs = $db_user->query($sql);
         file_put_contents('/tmp/debugs', date('m-d H:i:s') . "\\siyuan" . print_r($_POST, true) . "\n", FILE_APPEND);
         file_put_contents('/tmp/debugs', date('m-d H:i:s') . "\\siyuansql" . print_r($sql, true) . "\n", FILE_APPEND);
         file_put_contents('/tmp/debugs', date('m-d H:i:s') . "\\siyuanrs" . print_r($rs, true) . "\n", FILE_APPEND);
         $realName = realNameGet($_POST['UsrCustId']);
         $userName = $realName['real_name'];
         $url = HOST_NAME . 'Style/H/images/apppic.jpg';
         $word = "<b>尊敬的财来网投资人{$userName}</b>您于{$m}月{$d}号 {$mi}分投资 <span> {$money} </span>元,资金已冻结,将于满标复审后开始计息。<br/>详情请咨询客户经理或致电400-079-8558";
     } else {
         $huifuerror = (require_once 'huifuerror.php');
         $errorms = $_POST['RespCode'];
         $backerror = $huifuerror[$errorms];
         $url = HOST_NAME . 'Style/H/images/appshib.jpg';
         $word = "<span class='error'>" . $backerror . "</span>";
     }
     $this->view->assign("url", $url);
     $this->view->assign("word", $word);
     $this->view->assign("money", $money);
 }