public function check($account = '', $type = '')
 {
     $rules['phone'] = Sp_Dictionary::getOtherOption("patternMobile");
     $rules['email'] = Sp_Dictionary::getOtherOption("patternEmail");
     $msg['phone'] = "电话格式不正确";
     $msg['email'] = "邮箱格式不正确";
     $return = 1;
     $filter = array('phone', 'email');
     if (false == in_array($type, $filter)) {
         $return = array("status" => -100, "msg" => "参数错误");
     } else {
         if (FALSE == preg_match($rules[$type], $account)) {
             $return = array("status" => -101, "msg" => $msg[$type]);
         } else {
             $currentTime = time();
             $time = $currentTime - 60;
             $hours = $currentTime - 60 * 60;
             $where = array($type => $account);
             $flag = Da_Wrapper::select()->table('sp.huitong.ht_sms_report')->columns('id')->where($where)->where("crttime >= {$time}")->getOne();
             if (false != $flag) {
                 $return = array("status" => -102, "msg" => "请一分钟后在试");
             }
             $sendCount = Da_Wrapper::select()->table('sp.huitong.ht_sms_report')->columns('id')->where($where)->where("crttime >= {$hours}")->getTotal();
             if (5 <= $sendCount) {
                 $return = array("status" => -103, "msg" => "你已多次获取,为保证账号的安全,防止恶意验证,请1小时后再试");
             }
         }
     }
     return $return;
 }
Пример #2
0
 /**
  * 添加邀请函
  */
 public static function add($row)
 {
     if (empty($row['crttime'])) {
         $row['crttime'] = time();
     }
     $data = Da_Wrapper::insert()->table(self::DB_TABLE_LETTER)->data($row)->execute();
     return $data;
 }
 /**
  * function getUserIfCanEdit
  * @param int $id
  * @return boolean
  */
 public static function getUserById($id = 0, $column = '')
 {
     if ($id < 1) {
         return -1;
     }
     if (empty($column)) {
         $data = Da_Wrapper::select()->table(self::DB_TABLE_ADMIN_USER)->where('id', '=', $id)->getRow();
         if (!isset($data) || empty($data)) {
             return -2;
         }
     } else {
         $data = Da_Wrapper::select()->table(self::DB_TABLE_ADMIN_USER)->columns($column)->where('id', '=', $id)->getOne();
     }
     return $data;
 }
Пример #4
0
 public function getSignIdCode($data)
 {
     $where = array('id' => $data["id"]);
     $signId = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->columns('signId')->where($where)->getOne();
     if ($signId) {
         $signCode = $signId;
     } else {
         $time = date("YmdHis");
         $activeId = substr($data["activeId"], -2);
         $activeId = strlen($activeId) > 1 ? $activeId : "0{$activeId}";
         $phone = substr($data["phone"], -3);
         $signIdEle = array(substr($time, 3, 4), substr($phone, 0, 2), $activeId, substr($phone, -1), substr($time, 7, 1), substr($time, 8));
         $signCode = implode("", $signIdEle);
         Da_Wrapper::update()->table("sp.huitong.ht_apply_data")->data(array("signId" => $signCode))->where($where)->execute();
     }
     return $signCode;
 }
Пример #5
0
 public static function getpayment($where = "", $isAll = 1)
 {
     if ($isAll > 0) {
         $sql = "SELECT * FROM `payment` " . $where;
         $ret = Da_Wrapper::getAll(self::DB_NS, $sql);
     } else {
         $sql = "SELECT * FROM `payment` " . $where;
         $ret = Da_Wrapper::getRow(self::DB_NS, $sql);
     }
     return $ret;
 }
    $g_timer->display();
    // to output html formated
}
if (isset($g_error_messages)) {
    echo "<!-- error_messages:\n", print_r($g_error_messages, true), "\n-->\n";
}
if (isset($g_log_queries)) {
    echo "<!-- log_queries:\n", print_r($g_log_queries, true), "\n-->\n";
}
echo "<!-- included:\n", print_r(get_included_files(), true), "\n-->\n";
if (class_exists('Cache', false)) {
    echo "<!-- cache:\n", htmlspecialchars(print_r(Cache::factory('all_instances'), true)), "\n-->\n";
}
if (class_exists('Da_Wrapper', false)) {
    echo "<!-- dbos\n";
    foreach (Da_Wrapper::getDbos() as $key => $dbo) {
        echo $key, ":\n";
        echo 'class: ', get_class($dbo), ":\n";
        print_r($dbo->errorInfo());
        if (property_exists($dbo, 'logs')) {
            echo 'logs:', PHP_EOL;
            print_r($dbo->logs);
        }
        //echo 'querynum: ', $dbo->querynum, ":\n";
        //print_r($dbo->queries);
    }
    echo "\n-->\n";
}
if (class_exists('Db_Factory', false)) {
    //var_dump(Db_Factory::getDbos());
    foreach (Db_Factory::getDbos() as $key => $dbo) {
Пример #7
0
 public static function authCode($account = '', $code = '', $type = '')
 {
     $return = self::checkCode($account, $code, $type);
     if (1 !== $return) {
         return $return;
     }
     $update = array('phone' => array('update' => array('mobile_status' => 1), 'where' => array('mobile' => $account)), 'email' => array('update' => array('email_status' => 1), 'where' => array('email' => $account)));
     $data['code'] = $code;
     $data['sms_id'] = $type;
     $data[$type] = $account;
     $time = time() - 15 * 60;
     if ($userid = Da_Wrapper::select()->table(self::DB_TABLE_MSM)->columns('id')->where($data)->where("crttime >= {$time}")->getOne()) {
         $reUpdate = Da_Wrapper::update()->table("sp.huitong.ht_users")->data($update[$type]['update'])->where($update[$type]['where'])->execute();
         $cache = Cache::factory();
         $key = 'user_' . $userid;
         $cache->delete($key);
         return $reUpdate ? 1 : false;
     } else {
         return false;
     }
 }
Пример #8
0
 /**
  * function description
  *
  * @param
  * @return void
  */
 protected function getDbh()
 {
     if ($this->_dbh == null) {
         $this->_dbh = Da_Wrapper::dbo($this->_table_key);
     }
     return $this->_dbh;
 }
Пример #9
0
 /**
  * supplier queue
  *
  * @param string $section
  * @return void
  */
 public static function consoleRunForSupplier($section)
 {
     $start_time = time();
     $queue = self::factory($section);
     if (!is_object($queue)) {
         echo $section . ' is not found', PHP_EOL;
         return;
     }
     $timing = 1;
     $i = 0;
     while (sleep($timing) !== FALSE) {
         $ret_id = $queue->pop();
         if (!$ret_id) {
             break;
         }
         $timing = 1;
         echo PHP_EOL, $i . " got: \"", $ret_id, "\"  ";
         $ret = $queue->run($ret_id);
         if ($ret === false) {
             echo 'run result: false';
         } else {
             echo $ret;
         }
         if (time() - $start_time > self::MAX_RUNING) {
             exit;
         }
         $i++;
         Da_Wrapper::destroy();
         // 清除数据库连接
     }
 }
Пример #10
0
 /**
  * 释放 dbos 对象
  *
  * @return void
  */
 public static function destroy()
 {
     self::$dbos = array();
 }
Пример #11
0
/*
 * editor by carten
 */
define('ROOT_PATH', __DIR__ . '/../../../');
include_once ROOT_PATH . 'config/init.php';
$request = Request::current();
$signNo = $request->signNo;
$activeId = $request->active_Id;
file_put_contents("/sproot/logs/1111_sign_line.txt", "signNo:" . $signNo . ",activeId:" . $activeId);
$patternMobile = Sp_Dictionary::getOtherOption("patternMobile");
if (preg_match($patternMobile, $signNo)) {
    $where = array("phone" => $signNo, "activeId" => $activeId);
} else {
    $where = array("signId" => $signNo);
}
$signId = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->columns('Id,status')->where($where)->getRow();
if (!$signId['Id']) {
    $jsonParam = array("code" => "204", "msg" => "签到码不存在");
} else {
    if (1 == $signId['status']) {
        $jsonParam = array("code" => "205", "msg" => "签到码已使用");
    } else {
        if (-1 == $signId['status']) {
            $jsonParam = array("code" => "206", "msg" => "签到码无效");
        } else {
            if (0 == $signId['status']) {
                $model = new Sp_Account_Attendee();
                if ($model->signAndDelete(array($signId["Id"]), 1)) {
                    $jsonParam = array("code" => "200", "msg" => "恭喜您,签到成功");
                }
            }
Пример #12
0
 /**
  * 活动城市联动
  * 
  */
 public static function getChlidById($id = 0)
 {
     $data = Da_Wrapper::select()->table(self::DB_TABLE_CITY)->where('parentid', $id)->orderby('listorder asc')->getAll();
     return $data;
 }
Пример #13
0
 /**
  * @param $username 账号
  * @param $pwd      密码
  */
 public static function RePwd($username, $pwd)
 {
     $field_name = 'mobile';
     if (preg_match($patternMobile, $username)) {
         $field_name = 'mobile';
     } elseif (preg_match($patternEmail, $username)) {
         $field_name = 'email';
     }
     $row = array();
     $row['kid'] = time();
     $row['pwd'] = self::encrypt($pwd, $row['kid']);
     $ret = Da_Wrapper::update()->table(self::DB_TABLE_USER)->data($row)->where($field_name, $username)->execute();
     return $ret;
 }
Пример #14
0
 /**
  * 根据主键删除活动
  * 
  * @param string|array $key 主键
  */
 public static function delByPrimarykey($key)
 {
     $ids = $key;
     if (is_array($key)) {
         $ids = implode(',', $key);
     }
     $data = Da_Wrapper::execute(self::DB_TABLE_ACTIVE, "update {active} set isdel = 1 where id in ({$ids})");
     return $data;
 }
Пример #15
0
 /**
  * 获取当前参会人的人数
  */
 public static function getCurrentNum($Id)
 {
     return Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where(array("activeId" => $Id))->getTotal();
 }
<?php

/*
 * editor by carten
 */
define('ROOT_PATH', __DIR__ . '/../../../');
include_once ROOT_PATH . 'config/init.php';
$request = Request::current();
$activeId = $request->active_id;
if (is_numeric($activeId)) {
    $where['activeId'] = $activeId;
    $unSign = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where($where)->where("status = 0")->getTotal();
    $signed = Da_Wrapper::select()->table("sp.huitong.ht_apply_data")->where($where)->where("status = 1")->getTotal();
    $jsonParam = array("code" => "204", "msg" => "查询成功", "signed" => $signed, "unsign" => $unSign);
} else {
    $jsonParam = array("code" => "206", "msg" => "参数错误", "signed" => 0, "unsign" => 0);
}
header('Content-type: application/json;charset=utf-8');
echo json_encode($jsonParam);
Пример #17
0
 /**
  * 修改用户密码
  *
  * @param int $userid 用户 id
  * @param string $pwd 密码
  */
 public static function updatePassword($userid, $pwd)
 {
     $data = array('pwd' => $pwd);
     $rs = Da_Wrapper::update()->table(self::DB_TABLE_USER)->data($data)->where('id', $userid)->execute();
     return $rs;
 }
Пример #18
0
 public static function getUniqueId()
 {
     $row = array('tid' => 1);
     $ret = Da_Wrapper::insert()->table(self::DB_TABLE_USER)->data($row)->execute();
     return $ret;
 }
Пример #19
0
 /**
  * 通过手机获得对应的用户信息
  */
 public static function getUserByPhone($phone)
 {
     $select = Da_Wrapper::select()->table(self::DB_TABLE_USER)->where('mobile', $phone);
     return $select->getRow();
 }
Пример #20
0
 public static function last($uid, $type)
 {
     $ret = Da_Wrapper::select()->table(self::DB_TABLE_LOG)->columns('addtime')->where('user_id', $uid)->where('type', $type)->orderby('id DESC')->getOne();
     return $ret;
 }
Пример #21
0
 /**
  * 设置审核成功
  */
 public static function success($id)
 {
     $ret = Da_Wrapper::update()->table(self::DB_TABLE)->data(array("checkStatus" => 1))->where("id", $id)->execute();
     return $ret;
 }