IBChain
extends ASModel
in
内区块链 Inner Block Chain
服务端内部区块链数据支持
默认在插入新块的时候会进行插入锁、插入结束(成功或失败)解锁。 如果希望不影响其他部分性能、Redis服务器应该指定一个独立数据库处理。 不支持Redis时自动使用MySQL数据库、采用插入锁表的方式。
考虑到区块链本身的实时性要求很高、所以应当采用Redis主、MySQL辅(备份)的方式。 其中Redis主数据库集中维护实时数据提交和计算。 MySQL数据库作为一个定时的数据备份,这样避免了MySQL锁的性能瓶颈,通过异步机制或队列管道进行数据的备份。 其中长期不被读取的数据可以从Redis服务器中删除、节省内存空间。
Server internal block-chain data support
Lock inserts when insert a new block by default, and unlock at the end of the insert done (success or failure). If you want to not affect other parts of the performance, you should specify a separate Redis database for processing. * Automatically use MySQL database when Redis is not supported, and lock write when insert block.
Considering the high real-time requirements of the blockchain itself, you should use the Redis master and MySql assistant (backup). The Redis master database centrally maintains real-time data submission and calculations. MySQL database as a timed data backup, this avoids the performance bottleneck of MySQL lock, data backup through asynchronous mechanism or queue pipeline. Data that has not been read for a long time can be deleted from the Redis server, saving memory space.
Table of Contents
$context | Chain context 链上下文(不包含当前块) 用于存储当前块所处的上下文环境 [ 以blockID初始化时前后各2个, 默认以最新block初始化 上下文为最新2个 ] Used to store the context in which the current block is located 2 blocks before and after when initialization with blockID. | |
---|---|---|
$current | Current block 当前块 指向初始化ID的块,没有初始化ID则指向最新一块 | |
$temporary | Temporary block 临时块 用于创建新块 | |
$table | 表 | string |
$primaryid | 主字段 | string |
$addFields | 添加支持字段 | array |
$updateFields | 更新支持字段 | array |
$detailFields | 详情支持字段 | array |
$publicDetailFields | 开放详情支持字段 | array |
$overviewFields | 概览支持字段 | array |
$listFields | 列表支持字段 | array |
$publicListFields | 开放接口列表支持字段 | array |
$countFilters | 过滤字段 | array |
$depthStruct | 转换格式 | array |
$table | 表名称 Table name | string |
$primaryid | 主索引字段 | string |
$addFields | 添加支持字段 | array |
$updateFields | 更新支持字段 | array |
$detailFields | 详情支持字段 | array |
$publicDetailFields | 外部接口详情支持字段 | array |
$overviewFields | 概览支持字段 | array |
$listFields | 列表支持字段 | array |
$publicListFields | 外部接口列表支持字段 | array |
$countFilters | 计数查询支持筛选字段 | array |
$depthStruct | 多重数据结构 | array |
$searchFilters | 搜索过滤字段 | array |
$record_enabled | 开启日志 | bool |
$rds_auto_cache | 自动使用REDIS缓存 | bool |
$Redis | Redis缓存 | ASRedis |
$RedisHash | 缓存hash | mixed |
$fields | 目标字段 Target fields | array |
$id | 主体id Event id | string |
$params | 事件参数暂存 Parameters tmp | array |
$DB | 数据库链接 SQL Connect | ASDB |
$Record | 监控器 Recorder | ASRecord |
$CLASSNAME | 类名 | string |
$result | 结果包装器 | ASResult |
__construct() | ASBase constructor. | mixed |
addBlock() | 添加新块 addBlock | ASResult|Block |
isAdding() | 查询是否添加锁定中 isAdding | bool |
markAdding() | 标记正在添加 markAdding | ASResult|bool |
endAdding() | 结束添加状态 endAdding | ASResult|bool |
verify() | 向前验证 verify | bool |
getBlockFromData() | 从数据建立块 getBlockFromData | Block |
initCreation() | 创建创世区块 init Creation Block | ASResult |
__construct() | ASObject constructor. | mixed |
common() | 通用单例 common | static |
add() | 添加数据 add data to Database | ASResult |
beforeAdd() | 函数注入(插入数据之前) Do something before add | mixed |
beforeAddReturn() | 函数注入(插入数据返回结果之前) Do something before add result returning | mixed |
adds() | 批量添加 adds | ASResult |
beforeAdds() | mixed | |
beforeAddsReturn() | mixed | |
update() | 更新单行数据 update data with itemid | ASResult |
beforeUpdate() | mixed | |
beforeUpdateReturn() | mixed | |
publicUpdate() | mixed | |
remove() | 移除 remove | ASResult |
beforeRemove() | mixed | |
beforeRemoveReturn() | mixed | |
publicRemove() | 开放接口移除 publicRemove | ASResult |
detail() | 查询唯一数据详情 Get detail by itemid | ASResult |
beforeDetail() | mixed | |
beforeDetailReturn() | mixed | |
publicDetail() | 获取公开接口详情 Detail for with public fields | ASResult |
get() | 通过ID获取对应字段值 get value at $key field by itemid | ASResult |
beforeGet() | mixed | |
beforeGetReturn() | mixed | |
overview() | 获取概览 overview | ASResult |
count() | 统计特定数量 count | ASResult |
has() | 查询是否存在对应数据 Check data is exist by filters | bool |
beforeCount() | mixed | |
beforeCountReturn() | mixed | |
countContent() | 查询对应item表所对应的行数 Count contents in item table | ASResult |
countContentInTable() | 查询指定表中所对应的行数 Count contents in specific table | ASResult |
_isCacheEnabled() | 是否支持缓存(Redis) Is cache(Redis) supported in environment | bool |
_hasCache() | 是否存在对应缓存数据 _hasCache | bool |
_getCache() | 取出缓存 Get cache from Redis server | mixed |
_cache() | 缓存数据 Cache data to Redis server | bool |
_trackCache() | 跟踪缓存 trackCache 将对应id的缓存加入到Set中,清空的时候可以将相关缓存一并清理,防止出现关联缓存不同步的问题 Add the cache of the corresponding id to the Set, For to ensure that related caches can be cleared together when emptying. | bool |
_clearSet() | 清空Set下的缓存 clear Cache in set | bool |
list() | 获取列表 Get list | ASResult |
beforeList() | mixed | |
beforeListReturn() | mixed | |
publicList() | mixed | |
joinCount() | 多表联合统计 joinCount | ASResult |
advancedJoinCount() | 多表联合查询统计 完整模式 advancedJoinCount | ASResult |
beforeJoinCount() | mixed | |
beforeJoinCountReturn() | mixed | |
joinHas() | 多表联合检测是否存在 joinHas | bool |
joinList() | 多表联合查询 joinList | ASResult |
advancedJoinList() | mixed | |
beforeJoinList() | mixed | |
beforeJoinListReturn() | mixed | |
joinDetail() | 多表联合详情 joinDetail | ASResult |
beforeJoinDetail() | mixed | |
beforeJoinDetailReturn() | mixed | |
fillJoinParams() | 自动完善JOIN参数 fillJoinParams | array |
search() | mixed | |
convert() | mixed | |
status() | 设置状态 status | ASResult |
beforeStatus() | mixed | |
block() | mixed | |
trash() | mixed | |
sketch() | mixed | |
offline() | mixed | |
online() | mixed | |
recover() | mixed | |
done() | mixed | |
expire() | mixed | |
pending() | mixed | |
pedding() | mixed | |
setFeature() | mixed | |
cancelFeature() | mixed | |
setSort() | mixed | |
increaseSort() | mixed | |
decreaseSort() | mixed | |
view() | mixed | |
increase() | mixed | |
isStatus() | mixed | |
isExist() | mixed | |
setTable() | mixed | |
setId() | mixed | |
DBAdd() | 添加数据到DB DBAdd | mixed |
DBAdds() | 批量添加数据 DBAdds | mixed |
DBGet() | 获取数据 DBGet | mixed |
DBUpdate() | 更新数据 Update to database | mixed |
DBUpdates() | 批量更新数据 DBUpdates | mixed |
DBRemove() | 从数据库中删除行 DBRemove | mixed |
DBCount() | 统计数据库中对应行数 Count valid rows with conditions | mixed |
DBCheck() | 在数据库中检测字段是否是对应数据 Check data is valid at field | mixed |
DBNatureCount() | 基于自然语言关键词查询计数 DBNatureCount | mixed |
DBNatureGet() | 基于自然语言关键词查询 Get data with nature language keyword search | mixed |
DBJoinCount() | 联合查询计数 DBJoinCount | mixed |
DBJoinGet() | 联合查询 DBJoinGet | mixed |
record() | 记录日志到数据 Make a record to DB | mixed |
take() | 设置主体别称 Alias of setContent | $this |
setContent() | 设置结果包装中的主数据 set content of result | mixed |
sign() | 设置方法签名 Set method sign | mixed |
feedback() | 返回结果 通用 Returning result to the caller | ASResult |
error() | 返回错误 Returning Error result | ASResult |
success() | 返回成功 Return Success result | ASResult |
Properties
$context
Chain context 链上下文(不包含当前块) 用于存储当前块所处的上下文环境 [ 以blockID初始化时前后各2个, 默认以最新block初始化 上下文为最新2个 ] Used to store the context in which the current block is located 2 blocks before and after when initialization with blockID.
private
mixed
$context
$current
Current block 当前块 指向初始化ID的块,没有初始化ID则指向最新一块
private
mixed
$current
$temporary
Temporary block 临时块 用于创建新块
private
mixed
$temporary
$table
表
public
static string
$table
= "innerblock_chain"
$primaryid
主字段
public
static string
$primaryid
= "blockid"
$addFields
添加支持字段
public
static array
$addFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status']
$updateFields
更新支持字段
public
static array
$updateFields
= ['status']
$detailFields
详情支持字段
public
static array
$detailFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status', 'createtime', 'lasttime']
$publicDetailFields
开放详情支持字段
public
static array
$publicDetailFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status', 'createtime', 'lasttime']
$overviewFields
概览支持字段
public
static array
$overviewFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status', 'createtime', 'lasttime']
$listFields
列表支持字段
public
static array
$listFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status', 'createtime', 'lasttime']
$publicListFields
开放接口列表支持字段
public
static array
$publicListFields
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'content', 'hash', 'status', 'createtime', 'lasttime']
$countFilters
过滤字段
public
static array
$countFilters
= ['id', 'blockid', 'saasid', 'userid', 'itemid', 'itemtype', 'hash', 'status', 'createtime', 'lasttime']
$depthStruct
转换格式
public
static array
$depthStruct
= ['id' => 'int', 'createtime' => 'int', 'lasttime' => 'int', 'content' => 'ASJson']
$table
表名称 Table name
protected
static string
$table
$primaryid
主索引字段
protected
static string
$primaryid
$addFields
添加支持字段
protected
static array
$addFields
$updateFields
更新支持字段
protected
static array
$updateFields
$detailFields
详情支持字段
protected
static array
$detailFields
$publicDetailFields
外部接口详情支持字段
protected
static array
$publicDetailFields
$overviewFields
概览支持字段
protected
static array
$overviewFields
$listFields
列表支持字段
protected
static array
$listFields
$publicListFields
外部接口列表支持字段
protected
static array
$publicListFields
$countFilters
计数查询支持筛选字段
protected
static array
$countFilters
$depthStruct
多重数据结构
protected
static array
$depthStruct
= null
$searchFilters
搜索过滤字段
protected
static array
$searchFilters
= ['title', 'description']
$record_enabled
开启日志
protected
bool
$record_enabled
= true
$rds_auto_cache
自动使用REDIS缓存
protected
bool
$rds_auto_cache
= false
$Redis
Redis缓存
protected
ASRedis
$Redis
$RedisHash
缓存hash
protected
mixed
$RedisHash
$fields
目标字段 Target fields
protected
array
$fields
= '*'
$id
主体id Event id
protected
string
$id
$params
事件参数暂存 Parameters tmp
protected
array
$params
$DB
数据库链接 SQL Connect
protected
ASDB
$DB
$Record
监控器 Recorder
protected
ASRecord
$Record
$CLASSNAME
类名
protected
string
$CLASSNAME
$result
结果包装器
public
ASResult
$result
Methods
__construct()
ASBase constructor.
public
__construct(
[ $blockID :
mixed
= null ]
)
: mixed
Parameters
- $blockID : mixed = null
Return values
mixedaddBlock()
添加新块 addBlock
public
addBlock(
$content :
mixed
[, $userid :
string|null
= null ]
[, $itemid :
string|null
= null ]
[, $itemtype :
string|null
= null ]
[, $saasid :
string|null
= null ]
)
: ASResult|Block
Parameters
- $content : mixed
[内容]
- $userid : string|null = null
[用户ID]
- $itemid : string|null = null
[对象ID]
- $itemtype : string|null = null
[对象类型]
- $saasid : string|null = null
[saasid ? ]
- 检测(锁定标记) # 系统标记 通过SETTING实现 ( SETTING_IBCHAIN_LOCK, bool ) 其中SETTING自动处理redis
- 等待( 循环等待 <检测间隙,检测次数> ) 2.1 失败超出次数 系统繁忙-退出 2.2 等待成功 开始后续流程 ( 获取同时 进行锁定标记 )
- 获取最后块 3.1 区块链加密 生成临时新块 3.2 插入新块到数据库 3.3 插入完成(无论成功失败) 解除锁定标记
- 更新最后块
- 比对当前块和临时块的Hash是否相同 5.1 相同 插入成功 5.2 不同 插入失败
Return values
ASResult|BlockisAdding()
查询是否添加锁定中 isAdding
public
isAdding(
)
: bool
Return values
boolmarkAdding()
标记正在添加 markAdding
public
markAdding(
)
: ASResult|bool
Return values
ASResult|boolendAdding()
结束添加状态 endAdding
public
endAdding(
)
: ASResult|bool
Return values
ASResult|boolverify()
向前验证 verify
public
verify(
)
: bool
Return values
boolgetBlockFromData()
从数据建立块 getBlockFromData
public
getBlockFromData(
$blockInfo :
array
)
: Block
Parameters
- $blockInfo : array
Return values
BlockinitCreation()
创建创世区块 init Creation Block
public
initCreation(
)
: ASResult
Return values
ASResult__construct()
ASObject constructor.
public
__construct(
)
: mixed
Return values
mixedcommon()
通用单例 common
protected
static common(
)
: static
Return values
staticadd()
添加数据 add data to Database
public
add(
$data :
array
)
: ASResult
Parameters
- $data : array
Return values
ASResultbeforeAdd()
函数注入(插入数据之前) Do something before add
public
beforeAdd(
&$data :
array
)
: mixed
Parameters
- $data : array
Return values
mixedbeforeAddReturn()
函数注入(插入数据返回结果之前) Do something before add result returning
public
beforeAddReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
插入数据(指针)
Return values
mixedadds()
批量添加 adds
public
adds(
$list :
array
)
: ASResult
Parameters
- $list : array
Return values
ASResultbeforeAdds()
public
beforeAdds(
&$list :
array
)
: mixed
Parameters
- $list : array
Return values
mixedbeforeAddsReturn()
public
beforeAddsReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedupdate()
更新单行数据 update data with itemid
public
update(
$data :
array
, $itemid :
string
)
: ASResult
Parameters
- $data : array
- $itemid : string
Return values
ASResultbeforeUpdate()
public
beforeUpdate(
&$data :
array
)
: mixed
Parameters
- $data : array
Return values
mixedbeforeUpdateReturn()
public
beforeUpdateReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedpublicUpdate()
public
publicUpdate(
$data :
array
, $itemid :
string
, $userid :
string
)
: mixed
Parameters
- $data : array
- $itemid : string
- $userid : string
Return values
mixedremove()
移除 remove
public
remove(
$itemid :
string
)
: ASResult
Parameters
- $itemid : string
Return values
ASResultbeforeRemove()
public
beforeRemove(
&$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedbeforeRemoveReturn()
public
beforeRemoveReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedpublicRemove()
开放接口移除 publicRemove
public
publicRemove(
$itemid :
string
, $userid :
string
)
: ASResult
Parameters
- $itemid : string
- $userid : string
Return values
ASResultdetail()
查询唯一数据详情 Get detail by itemid
public
detail(
$itemid :
string
[, $public :
bool
= false ]
)
: ASResult
Parameters
- $itemid : string
- $public : bool = false
Return values
ASResultbeforeDetail()
public
beforeDetail(
&$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedbeforeDetailReturn()
public
beforeDetailReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedpublicDetail()
获取公开接口详情 Detail for with public fields
public
publicDetail(
$itemid :
string
)
: ASResult
Parameters
- $itemid : string
Return values
ASResultget()
通过ID获取对应字段值 get value at $key field by itemid
public
get(
$key :
string
, $itemid :
string
)
: ASResult
Parameters
- $key : string
- $itemid : string
Return values
ASResultbeforeGet()
public
beforeGet(
&$key :
string
, &$itemid :
string
)
: mixed
Parameters
- $key : string
- $itemid : string
Return values
mixedbeforeGetReturn()
public
beforeGetReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedoverview()
获取概览 overview
public
overview(
$itemid :
string
)
: ASResult
Parameters
- $itemid : string
Return values
ASResultcount()
统计特定数量 count
public
count(
$filters :
array
)
: ASResult
Parameters
- $filters : array
Return values
ASResulthas()
查询是否存在对应数据 Check data is exist by filters
public
has(
$filters :
array
)
: bool
Parameters
- $filters : array
Return values
boolbeforeCount()
public
beforeCount(
&$filters :
array
)
: mixed
Parameters
- $filters : array
Return values
mixedbeforeCountReturn()
public
beforeCountReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedcountContent()
查询对应item表所对应的行数 Count contents in item table
public
countContent(
$filters :
array
, $type :
string
)
: ASResult
Parameters
- $filters : array
- $type : string
Return values
ASResultcountContentInTable()
查询指定表中所对应的行数 Count contents in specific table
public
countContentInTable(
$filters :
array
, $table :
string
)
: ASResult
Parameters
- $filters : array
- $table : string
Return values
ASResult_isCacheEnabled()
是否支持缓存(Redis) Is cache(Redis) supported in environment
public
_isCacheEnabled(
)
: bool
Return values
bool_hasCache()
是否存在对应缓存数据 _hasCache
public
_hasCache(
[ $hash :
string|null
= null ]
)
: bool
Parameters
- $hash : string|null = null
缓存哈希
Return values
bool_getCache()
取出缓存 Get cache from Redis server
public
_getCache(
[ $hash :
string|null
= null ]
)
: mixed
Parameters
- $hash : string|null = null
Return values
mixed_cache()
缓存数据 Cache data to Redis server
public
_cache(
[ $hash :
mixed
= null ]
[, $result :
mixed
= null ]
[, $expireDuration :
int
= 3600 ]
)
: bool
Parameters
- $hash : mixed = null
- $result : mixed = null
- $expireDuration : int = 3600
Return values
bool_trackCache()
跟踪缓存 trackCache 将对应id的缓存加入到Set中,清空的时候可以将相关缓存一并清理,防止出现关联缓存不同步的问题 Add the cache of the corresponding id to the Set, For to ensure that related caches can be cleared together when emptying.
public
_trackCache(
$set :
, $id :
, $hashID :
)
: bool
Parameters
Return values
bool_clearSet()
清空Set下的缓存 clear Cache in set
public
_clearSet(
$set :
, $id :
)
: bool
Parameters
Return values
boollist()
获取列表 Get list
public
list(
$filters :
array
[, $page :
int
= 1 ]
[, $size :
int
= 25 ]
[, $sort :
string|null
= null ]
[, $public :
bool
= false ]
)
: ASResult
Parameters
- $filters : array
筛选条件
- $page : int = 1
翻页-页数
- $size : int = 25
翻页-页长
- $sort : string|null = null
排序字段
- $public : bool = false
是否公开列表
Return values
ASResult —结果对象
beforeList()
public
beforeList(
&$filters :
array
[, &$page :
int
= 1 ]
[, &$size :
int
= 25 ]
[, &$sort :
string
= null ]
[, &$public :
mixed
= false ]
)
: mixed
Parameters
- $filters : array
- $page : int = 1
- $size : int = 25
- $sort : string = null
- $public : mixed = false
Return values
mixedbeforeListReturn()
public
beforeListReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedpublicList()
public
publicList(
$filters :
array
[, $page :
int
= 1 ]
[, $size :
int
= 25 ]
[, $sort :
string
= null ]
)
: mixed
Parameters
- $filters : array
- $page : int = 1
- $size : int = 25
- $sort : string = null
Return values
mixedjoinCount()
多表联合统计 joinCount
public
joinCount(
[ $filters :
array
= null ]
[, $mergeJoins :
array
= null ]
[, $subJoins :
array|null
= null ]
)
: ASResult
Parameters
- $filters : array = null
[主表条件]
- $mergeJoins : array = null
[合并查询表]
- $subJoins : array|null = null
[合并查询表(子集)]
Return values
ASResultadvancedJoinCount()
多表联合查询统计 完整模式 advancedJoinCount
public
advancedJoinCount(
[ $primaryParams :
array|null
= null ]
[, $mergeJoins :
array|null
= null ]
[, $subJoins :
array|null
= null ]
)
: ASResult
Parameters
- $primaryParams : array|null = null
- $mergeJoins : array|null = null
- $subJoins : array|null = null
Return values
ASResultbeforeJoinCount()
public
beforeJoinCount(
[ &$filters :
array
= null ]
[, &$mergeJoins :
array
= null ]
[, &$subJoins :
array
= null ]
)
: mixed
Parameters
- $filters : array = null
- $mergeJoins : array = null
- $subJoins : array = null
Return values
mixedbeforeJoinCountReturn()
public
beforeJoinCountReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedjoinHas()
多表联合检测是否存在 joinHas
public
joinHas(
[ $filters :
array|null
= null ]
[, $joins :
array|null
= null ]
)
: bool
Parameters
- $filters : array|null = null
主表条件
- $joins : array|null = null
合并查询表
Return values
booljoinList()
多表联合查询 joinList
public
joinList(
[ $filters :
array
= null ]
[, $mergeJoins :
array
= null ]
[, $subJoins :
array|null
= null ]
[, $page :
int
= 1 ]
[, $size :
int
= 20 ]
[, $sort :
string|null
= null ]
)
: ASResult
Parameters
- $filters : array = null
主表条件
- $mergeJoins : array = null
合并查询表
- $subJoins : array|null = null
合并查询表(子集)
- $page : int = 1
页
- $size : int = 20
大小
- $sort : string|null = null
排序
Return values
ASResultadvancedJoinList()
public
advancedJoinList(
[ $primaryParams :
array
= null ]
[, $mergeJoins :
array
= null ]
[, $subJoins :
array
= null ]
[, $page :
int
= 1 ]
[, $size :
int
= 20 ]
[, $sort :
string
= null ]
)
: mixed
Parameters
- $primaryParams : array = null
- $mergeJoins : array = null
- $subJoins : array = null
- $page : int = 1
- $size : int = 20
- $sort : string = null
Return values
mixedbeforeJoinList()
public
beforeJoinList(
[ &$primaryParams :
array
= null ]
[, &$mergeJoins :
array
= null ]
[, &$subJoins :
array
= null ]
[, &$page :
int
= 1 ]
[, &$size :
int
= 25 ]
[, &$sort :
string
= null ]
)
: mixed
Parameters
- $primaryParams : array = null
- $mergeJoins : array = null
- $subJoins : array = null
- $page : int = 1
- $size : int = 25
- $sort : string = null
Return values
mixedbeforeJoinListReturn()
public
beforeJoinListReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedjoinDetail()
多表联合详情 joinDetail
public
joinDetail(
$itemid :
string
[, $mergeJoins :
array
= null ]
[, $subJoins :
array|null
= null ]
)
: ASResult
Parameters
- $itemid : string
索引ID
- $mergeJoins : array = null
合并查询表
- $subJoins : array|null = null
合并查询表(子集)
Return values
ASResultbeforeJoinDetail()
public
beforeJoinDetail(
&$itemid :
string
[, &$mergeJoins :
array
= null ]
[, &$subJoins :
array
= null ]
)
: mixed
Parameters
- $itemid : string
- $mergeJoins : array = null
- $subJoins : array = null
Return values
mixedbeforeJoinDetailReturn()
public
beforeJoinDetailReturn(
&$result :
ASResult
)
: mixed
Parameters
- $result : ASResult
Return values
mixedfillJoinParams()
自动完善JOIN参数 fillJoinParams
public
fillJoinParams(
[ $joins :
array|null
= null ]
[, $isSubJoin :
bool
= false ]
)
: array
Parameters
- $joins : array|null = null
初始参数
- $isSubJoin : bool = false
是否使用子集结果
Return values
array —结果参数
search()
public
search(
$keyword :
string
[, $params :
array
= null ]
[, $page :
int
= 1 ]
[, $size :
int
= 25 ]
[, $sort :
string
= null ]
)
: mixed
Parameters
- $keyword : string
- $params : array = null
- $page : int = 1
- $size : int = 25
- $sort : string = null
Return values
mixedconvert()
public
convert(
$params :
array
[, $struct :
array
= null ]
)
: mixed
Parameters
- $params : array
- $struct : array = null
Return values
mixedstatus()
设置状态 status
public
status(
$itemid :
string
, $status :
string
)
: ASResult
Parameters
- $itemid : string
- $status : string
Return values
ASResultbeforeStatus()
public
beforeStatus(
&$itemid :
string
, &$status :
string
)
: mixed
Parameters
- $itemid : string
- $status : string
Return values
mixedblock()
public
block(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedtrash()
public
trash(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedsketch()
public
sketch(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedoffline()
public
offline(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedonline()
public
online(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedrecover()
public
recover(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixeddone()
public
done(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedexpire()
public
expire(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedpending()
public
pending(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedpedding()
public
pedding(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedsetFeature()
public
setFeature(
$itemid :
string
[, $featured :
int
= 1 ]
)
: mixed
Parameters
- $itemid : string
- $featured : int = 1
Return values
mixedcancelFeature()
public
cancelFeature(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedsetSort()
public
setSort(
$itemid :
string
, $sort :
int
)
: mixed
Parameters
- $itemid : string
- $sort : int
Return values
mixedincreaseSort()
public
increaseSort(
$itemid :
string
[, $size :
int
= 1 ]
)
: mixed
Parameters
- $itemid : string
- $size : int = 1
Return values
mixeddecreaseSort()
public
decreaseSort(
$itemid :
string
[, $size :
int
= 1 ]
)
: mixed
Parameters
- $itemid : string
- $size : int = 1
Return values
mixedview()
public
view(
$itemid :
string
[, $size :
int
= 1 ]
)
: mixed
Parameters
- $itemid : string
- $size : int = 1
Return values
mixedincrease()
public
increase(
$field :
string
[, $conditions :
mixed
= null ]
[, $size :
int
= 1 ]
)
: mixed
Parameters
- $field : string
- $conditions : mixed = null
- $size : int = 1
Return values
mixedisStatus()
public
isStatus(
$itemid :
string
, $status :
string
)
: mixed
Parameters
- $itemid : string
- $status : string
Return values
mixedisExist()
public
isExist(
$itemid :
string
)
: mixed
Parameters
- $itemid : string
Return values
mixedsetTable()
protected
setTable(
$tableName :
string
)
: mixed
Parameters
- $tableName : string
Return values
mixedsetId()
protected
setId(
$id :
string
)
: mixed
Parameters
- $id : string
Return values
mixedDBAdd()
添加数据到DB DBAdd
protected
DBAdd(
$params :
array
)
: mixed
Parameters
- $params : array
Return values
mixedDBAdds()
批量添加数据 DBAdds
protected
DBAdds(
$list :
array
)
: mixed
Parameters
- $list : array
Return values
mixedDBGet()
获取数据 DBGet
protected
DBGet(
$params :
array
)
: mixed
Parameters
- $params : array
Return values
mixedDBUpdate()
更新数据 Update to database
protected
DBUpdate(
$params :
array
, $conditions :
string
)
: mixed
Parameters
- $params : array
[数据k-v]
- $conditions : string
[description]
Return values
mixedDBUpdates()
批量更新数据 DBUpdates
protected
DBUpdates(
$list :
array
, $keyField :
string
, $conditions :
string
)
: mixed
Parameters
- $list : array
数据列表 Array of K-V
- $keyField : string
筛选字段
- $conditions : string
筛选条件
Return values
mixedDBRemove()
从数据库中删除行 DBRemove
protected
DBRemove(
$conditions :
array|string
)
: mixed
Parameters
- $conditions : array|string
Return values
mixedDBCount()
统计数据库中对应行数 Count valid rows with conditions
protected
DBCount(
$conditions :
array|string
)
: mixed
Parameters
- $conditions : array|string
Return values
mixedDBCheck()
在数据库中检测字段是否是对应数据 Check data is valid at field
protected
DBCheck(
$field :
string
, $value :
mixed
, $conditions :
array|string
[, $sort :
string
= "createtime DESC" ]
)
: mixed
Parameters
- $field : string
字段名
- $value : mixed
数据值
- $conditions : array|string
查询条件
- $sort : string = "createtime DESC"
排序 默认创建时间倒序
Return values
mixedDBNatureCount()
基于自然语言关键词查询计数 DBNatureCount
protected
DBNatureCount(
$conditions :
array|string
, $keyword :
string
)
: mixed
Parameters
- $conditions : array|string
查询条件
- $keyword : string
关键词
Return values
mixedDBNatureGet()
基于自然语言关键词查询 Get data with nature language keyword search
protected
DBNatureGet(
$conditions :
array|string
, $keyword :
string
)
: mixed
Parameters
- $conditions : array|string
查询条件
- $keyword : string
关键词
Return values
mixedDBJoinCount()
联合查询计数 DBJoinCount
protected
DBJoinCount(
$primaryParams :
array
, $joinParams :
array
)
: mixed
Parameters
- $primaryParams : array
- $joinParams : array
Return values
mixedDBJoinGet()
联合查询 DBJoinGet
protected
DBJoinGet(
$primaryParams :
array
, $joinParams :
array
[, $page :
int
= 1 ]
[, $size :
int
= 20 ]
[, $sort :
string|null
= null ]
)
: mixed
Parameters
- $primaryParams : array
- $joinParams : array
- $page : int = 1
- $size : int = 20
- $sort : string|null = null
Return values
mixedrecord()
记录日志到数据 Make a record to DB
protected
record(
[ $event :
string
= null ]
[, $sign :
string
= null ]
)
: mixed
Parameters
- $event : string = null
事件名称 Event name
- $sign : string = null
程序签名 Sign by methods
Return values
mixedtake()
设置主体别称 Alias of setContent
public
take(
$content :
)
: $this
Parameters
Return values
$thissetContent()
设置结果包装中的主数据 set content of result
public
setContent(
$content :
)
: mixed
Parameters
Return values
mixedsign()
设置方法签名 Set method sign
public
sign(
$sign :
)
: mixed
Parameters
Return values
mixedfeedback()
返回结果 通用 Returning result to the caller
public
feedback(
[ $status :
int|null
= null ]
[, $message :
string|null
= null ]
[, $sign :
string|null
= null ]
)
: ASResult
Parameters
- $status : int|null = null
- $message : string|null = null
- $sign : string|null = null
Return values
ASResulterror()
返回错误 Returning Error result
public
error(
$status :
int
, $message :
string
[, $sign :
string|null
= null ]
)
: ASResult
Parameters
- $status : int
- $message : string
- $sign : string|null = null
Return values
ASResultsuccess()
返回成功 Return Success result
public
success(
[ $message :
string|null
= null ]
[, $sign :
string|null
= null ]
)
: ASResult
Parameters
- $message : string|null = null
- $sign : string|null = null