本文整理汇总了PHP中DB::Insert方法的典型用法代码示例。如果您正苦于以下问题:PHP DB::Insert方法的具体用法?PHP DB::Insert怎么用?PHP DB::Insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB
的用法示例。
在下文中一共展示了DB::Insert方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Create
public static function Create($mobile, $user_id, $secret = null, $enable = false)
{
if (!Utility::IsMobile($mobile, true)) {
return;
}
$secret = $secret ? $secret : Utility::VerifyCode();
$table = new Table('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'enable' => $enable ? 'Y' : 'N', 'secret' => $secret));
$condition = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'N');
$haveone = DB::GetTableRow('toolsbind', $condition);
if ($haveone) {
return Table::UpdateCache('toolsbind', $haveone['id'], array('secret' => $secret, 'enable' => 'N'));
}
//已经绑定了本号码
$loginbind = array('user_id' => $user_id, 'tools' => $mobile, 'enable' => 'Y');
$havebind = DB::GetTableRow('toolsbind', $loginbind);
if ($havebind) {
return false;
}
//$table->insert(array( 'user_id', 'tools','secret', 'enable'));
DB::Insert('toolsbind', array('user_id' => $user_id, 'tools' => $mobile, 'secret' => $secret, 'enable' => 'N', 'create_time' => time()));
$have = Table::Fetch('toolsbind', $mobile, 'tools');
if ($have && 'Y' == $have['enable']) {
return true;
}
}
示例2: BindRenRen
public static function BindRenRen($user_row, $renren_uid)
{
$user_renren_row['uid'] = $user_row['id'];
$user_renren_row['renren_uid'] = $renren_uid;
$user_renren_row['id'] = DB::Insert('user_renren', $user_renren_row);
return $user_renren_row['id'];
}
示例3: Create
public static function Create($user_row, $uc = true)
{
if (function_exists('zuitu_uc_register') && $uc) {
$pp = $user_row['password'];
$em = $user_row['email'];
$un = $user_row['username'];
$ret = zuitu_uc_register($em, $un, $pp);
if (!$ret) {
return false;
}
}
$user_row['password'] = self::GenPassword($user_row['password']);
$user_row['create_time'] = $user_row['login_time'] = time();
$user_row['ip'] = Utility::GetRemoteIp();
$user_row['secret'] = md5(Utility::GenSecret(12));
$user_row['id'] = DB::Insert('user', $user_row);
$_rid = abs(intval(cookieget('_rid')));
if ($_rid) {
$r_user = Table::Fetch('user', $_rid);
if ($r_user) {
ZInvite::Create($r_user, $user_row);
}
}
if ($user_row['id'] == 1) {
Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
}
return $user_row['id'];
}
示例4: Create
public static function Create($user_row)
{
$user_row['password'] = self::GenPassword($user_row['password']);
$user_row['login_time'] = time();
$user_row['id'] = DB::Insert('user', $user_row);
return $user_row['id'];
}
示例5: log
/**
* 记日志 实现
* @see Log_Model::log()
*/
public function log($data, $type = 1)
{
$data = self::buildData($data);
$url = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$log = array('type' => intval($type), 'url' => $url, 'post_data' => file_get_contents("php://input"), 'content' => $data, 'create_time' => time());
return DB::Insert($this->table, $log, null, $this->dbType);
}
示例6: log_admin
function log_admin($type, $operation, $relate_data = array())
{
global $login_user;
$user_id = $login_user['id'];
$user_email = $login_user['email'];
$create_on = date('Y-m-d H:i:s');
$relate_data = serialize($relate_data);
DB::Insert('logger_admin', array('user_id' => $user_id, 'user_email' => $user_email, 'type' => $type, 'operation' => $operation, 'relate_data' => $relate_data, 'create_on' => $create_on));
}
示例7: Create
public static function Create($ruser, $newuser)
{
if ($ruser['id'] == $newuser['id']) {
return;
}
$invite = array('user_id' => $ruser['id'], 'user_ip' => $ruser['ip'], 'other_user_id' => $newuser['id'], 'other_user_ip' => $newuser['ip'], 'create_time' => time());
cookieset('_rid', null, -1);
return DB::Insert('invite', $invite);
}
示例8: CreateFromCharge
public static function CreateFromCharge($money, $user_id, $time, $service)
{
if (!$money || !$user_id || !$time || !$service) {
return 0;
}
$pay_id = "charge-{$user_id}-{$time}";
$oarray = array('user_id' => $user_id, 'pay_id' => $pay_id, 'service' => $service, 'state' => 'pay', 'money' => $money, 'origin' => $money, 'create_time' => $time);
return DB::Insert('order', $oarray);
}
示例9: Create
public static function Create($score, $user_id, $action = 'charge', $detail_id = 0)
{
if (!$score || !$user_id) {
return 0;
}
//update user score;
$user = Table::Fetch('user', $user_id);
Table::UpdateCache('user', $user_id, array('score' => array("`score`+{$score}")));
$u = array('user_id' => $user_id, 'admin_id' => 0, 'score' => $score, 'action' => $action, 'detail_id' => $detail_id, 'create_time' => time());
return DB::Insert('credit', $u);
}
示例10: expense_voucher_detail
function expense_voucher_detail($voucher_id, $voucher_paid_from_account, $expense_type, $expense_detail, $expense_ammount, $expense_attachment)
{
$now = getDateTime(0, 'mySQL');
$insert = DB::Insert(DB_PREFIX . $_SESSION['co_prefix'] . 'voucher_expense_detail', array('voucher_id' => $voucher_id, 'expense_account_id' => $voucher_paid_from_account, 'expense_type' => $expense_type, 'expense_description' => $expense_detail, 'expense_amount' => $expense_ammount, 'has_attachment' => $expense_attachment, 'created_by' => $_SESSION['user_name'], 'created_on' => $now, 'voucher_detail_status' => 'Draft'));
$voucher_detail_id = DB::insertId();
if ($voucher_detail_id) {
return $voucher_detail_id;
return $voucher_id;
} else {
return 0;
}
}
示例11: CreateFromStore
public static function CreateFromStore($user_id = 0, $money = 0)
{
$money = abs(intval($money));
if ($money <= 0 || $user_id <= 0) {
return;
}
//update user money;
$user = Table::Fetch('user', $user_id);
Table::UpdateCache('user', $user_id, array('money' => array("money + {$money}")));
$u = array('user_id' => $user_id, 'money' => $money, 'direction' => 'income', 'action' => 'store', 'detail_id' => 0, 'create_time' => time());
return DB::Insert('flow', $u);
}
示例12: PayCardCreate
public static function PayCardCreate($query)
{
$need = $query['quantity'];
while (true) {
$id = Utility::GenSecret(16, Utility::CHAR_NUM);
$paycard = array('id' => $id, 'value' => $query['money'], 'consume' => 'N', 'expire_time' => $query['expire_time']);
$need -= DB::Insert('paycard', $paycard) ? 1 : 0;
if ($need <= 0) {
return true;
}
}
return true;
}
示例13: CardCreate
public static function CardCreate($query)
{
$need = $query['quantity'];
while (true) {
$id = Utility::GenSecret(16, Utility::CHAR_NUM);
$card = array('id' => $id, 'code' => $query['code'], 'partner_id' => $query['partner_id'], 'credit' => $query['money'], 'consume' => 'N', 'begin_time' => $query['begin_time'], 'end_time' => $query['end_time']);
$need -= DB::Insert('card', $card) ? 1 : 0;
if ($need <= 0) {
return true;
}
}
return true;
}
示例14: Create
public static function Create($ruser, $newuser)
{
if ($ruser['id'] == $newuser['id']) {
return;
}
cookieset('_rid', null, -1);
if ($newuser['newbie'] == 'N') {
return;
}
$have = Table::Fetch('invite', $newuser['id'], 'other_user_id');
cookieset('_rid', null, -1);
if ($have) {
return false;
}
$invite = array('user_id' => $ruser['id'], 'user_ip' => $ruser['ip'], 'other_user_id' => $newuser['id'], 'other_user_ip' => $newuser['ip'], 'create_time' => time());
return DB::Insert('invite', $invite);
}
示例15: Create
public static function Create($user_row)
{
$user_row['password'] = self::GenPassword($user_row['password']);
$user_row['create_time'] = $user_row['login_time'] = time();
$user_row['ip'] = Utility::GetRemoteIp();
$user_row['secret'] = md5(Utility::GenSecret(12));
$user_row['id'] = DB::Insert('user', $user_row);
if ($_COOKIE['_rid']) {
$r_user = Table::Fetch('user', $_COOKIE['_rid']);
if ($r_user) {
ZInvite::Create($r_user, $user_row);
}
}
if ($user_row['id'] == 1) {
Table::UpdateCache('user', $user_row['id'], array('manager' => 'Y', 'secret' => ''));
}
return $user_row['id'];
}