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); } }