Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
hanwenbo committed Sep 16, 2018
1 parent c1be99e commit 2e824f9
Showing 1 changed file with 106 additions and 0 deletions.
106 changes: 106 additions & 0 deletions tests/v3/App/Model/TTLockUser.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?php

namespace App\Model;

use fashop\Model;

class BlsUser extends Model
{
protected $resultSetType = 'collection';

/**
* 添加用户
* @param array $data 用户信息
* @author 韩文博
* @throws \Exception
*/
public function addBlsUser( array $data )
{
$now_time = time();
$user_id = $this->insertGetId( array_merge( $data, [
'create_time' => $now_time,
] ) );
return $user_id;
}

/**
* 添加多条
* @datetime 2017-04-20 15:49:43
* @author 韩文博
* @param array $data
* @return boolean
*/
public function addBlsUserAll( $data )
{
return $this->insertAll( $data );
}

/**
* 修改
* @datetime 2017-04-20 15:49:43
* @author 韩文博
* @param array $condition
* @param array $data
* @return boolean
*/
public function editBlsUser( $condition = [], $data = [] )
{
return $this->update( $data, $condition, true );
}

/**
* 删除
* @datetime 2017-04-20 15:49:43
* @author 韩文博
* @param array $condition
* @return boolean
*/
public function delBlsUser( $condition = [] )
{
return $this->where( $condition )->delete();
}

/**
* 计算数量
* @datetime 2017-04-20 15:49:43
* @author 韩文博
* @param array $condition 条件
* @return int
*/
public function getBlsUserCount( $condition )
{
return $this->where( $condition )->count();
}


/**
* 用户列表
* @param array $condition
* @param string $field
* @param number $page
* @param string $order
*/
public function getBlsUserList( $condition = [], $field = '*', $order = 'id desc', $page = "1,10" )
{
$list = $this->where( $condition )->order( $order )->field( $field )->page( $page )->select();
return $list ? $list->toArray() : false;
}

/**
* 获取单个用户信息
* @datetime 2017-04-20T15:23:09+0800
* @author 韩文博
* @param array $condition
* @param string $field
* @param array $extends
* @return array
*/
public function getBlsUserInfo( $condition = [], $field = '*', $extends = [] )
{
$result = $this->field( $field )->where( $condition )->find();
$user_info = $result ? $result->toArray() : [];
unset( $user_info['pay_password'] );
return $user_info;
}

}

0 comments on commit 2e824f9

Please sign in to comment.