2019-09-06 23:53:10 +08:00

82 lines
2.2 KiB
PHP
Executable File

<?php
namespace wstmart\common\model;
use think\Db;
/**
* ============================================================================
* 会员银行卡类
*/
class CompanyBank extends Base{
protected $table = '';
public function __construct(){
parent::__construct();
$this->table = Db::name('company_bank');
}
public function setTable($tableName='user_bank'){
$this->table = Db::name($tableName);
}
public function getStatusTextAttr($value,$data){
$status = [-1=>'已拒绝',0=>'待审核',1=>'已通过'];
return $status[$data['status']];
}
/**
* 获取单条信息
* @param [type] $where [description]
* @param string $field [description]
* @return [type] [description]
*/
public function getInfo($where,$field='*'){
$where['dataFlag'] = 1;
return $this->table->where($where)->field($field)->find();
}
/**
* 获取单条信息
* @param [type] $where [description]
* @param string $field [description]
* @return [type] [description]
*/
public function getField($where,$field='id'){
$where['dataFlag'] = 1;
return $this->table->where($where)->value($field);
}
/**
* 获取多条信息
* @param [type] $where [description]
* @param string $field [description]
* @return [type] [description]
*/
public function getSelect($where,$field='id'){
$where['dataFlag'] = 1;
return $this->table->where($where)->field($field)->paginate(input('pageSize/d',10))->toArray();
}
/**
* 获取多条信息不分页
* @param [type] $where [description]
* @param string $field [description]
* @return [type] [description]
*/
public function getList($where,$field='id'){
$where['dataFlag'] = 1;
return $this->table->where($where)->field($field)->select();
}
/**
* 插入单条信息
* @param string $data [description]
* @return [type] [description]
*/
public function insertInfo($data){
$data['createTime'] = time();
return $this->table->insert($data);
}
/**
* 更新单条信息
* @param [type] $where [description]
* @param string $data [description]
* @return [type] [description]
*/
public function updateInfo($where,$data){
return $this->table->where($where)->update($data);
}
}