mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-25 02:40:16 +08:00
modified 完成规则生产方缓存支持
This commit is contained in:
parent
551bc0b009
commit
55268df761
@ -97,6 +97,11 @@ class Fields extends Base {
|
|||||||
$postData['default'] = $postData['defaults'];
|
$postData['default'] = $postData['defaults'];
|
||||||
unset($postData['defaults']);
|
unset($postData['defaults']);
|
||||||
$res = AdminFields::create($postData);
|
$res = AdminFields::create($postData);
|
||||||
|
|
||||||
|
cache('RequestFields:NewRule:' . $postData['hash'], null);
|
||||||
|
cache('RequestFields:Rule:' . $postData['hash'], null);
|
||||||
|
cache('ResponseFieldsRule:' . $postData['hash'], null);
|
||||||
|
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
} else {
|
} else {
|
||||||
@ -115,6 +120,11 @@ class Fields extends Base {
|
|||||||
$postData['default'] = $postData['defaults'];
|
$postData['default'] = $postData['defaults'];
|
||||||
unset($postData['defaults']);
|
unset($postData['defaults']);
|
||||||
$res = AdminFields::update($postData);
|
$res = AdminFields::update($postData);
|
||||||
|
|
||||||
|
cache('RequestFields:NewRule:' . $postData['hash'], null);
|
||||||
|
cache('RequestFields:Rule:' . $postData['hash'], null);
|
||||||
|
cache('ResponseFieldsRule:' . $postData['hash'], null);
|
||||||
|
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
} else {
|
} else {
|
||||||
@ -126,12 +136,19 @@ class Fields extends Base {
|
|||||||
* 字段删除
|
* 字段删除
|
||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \think\exception\DbException
|
||||||
*/
|
*/
|
||||||
public function del() {
|
public function del() {
|
||||||
$id = $this->request->get('id');
|
$id = $this->request->get('id');
|
||||||
if (!$id) {
|
if (!$id) {
|
||||||
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
return $this->buildFailed(ReturnCode::EMPTY_PARAMS, '缺少必要参数');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$fieldsInfo = AdminFields::get($id);
|
||||||
|
cache('RequestFields:NewRule:' . $fieldsInfo->hash, null);
|
||||||
|
cache('RequestFields:Rule:' . $fieldsInfo->hash, null);
|
||||||
|
cache('ResponseFieldsRule:' . $fieldsInfo->hash, null);
|
||||||
|
|
||||||
AdminFields::destroy($id);
|
AdminFields::destroy($id);
|
||||||
|
|
||||||
return $this->buildSuccess([]);
|
return $this->buildSuccess([]);
|
||||||
@ -178,6 +195,10 @@ class Fields extends Base {
|
|||||||
(new AdminFields())->insertAll($addData);
|
(new AdminFields())->insertAll($addData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cache('RequestFields:NewRule:' . $hash, null);
|
||||||
|
cache('RequestFields:Rule:' . $hash, null);
|
||||||
|
cache('ResponseFieldsRule:' . $hash, null);
|
||||||
|
|
||||||
return $this->buildSuccess([]);
|
return $this->buildSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,16 +91,17 @@ class InterfaceList extends Base {
|
|||||||
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
* @author zhaoxiang <zhaoxiang051405@gmail.com>
|
||||||
*/
|
*/
|
||||||
public function changeStatus() {
|
public function changeStatus() {
|
||||||
$id = $this->request->get('id');
|
$hash = $this->request->get('hash');
|
||||||
$status = $this->request->get('status');
|
$status = $this->request->get('status');
|
||||||
$res = AdminList::update([
|
$res = AdminList::update([
|
||||||
'status' => $status
|
'status' => $status
|
||||||
], [
|
], [
|
||||||
'id' => $id
|
'hash' => $hash
|
||||||
]);
|
]);
|
||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
} else {
|
} else {
|
||||||
|
cache('ApiInfo:' . $hash, null);
|
||||||
return $this->buildSuccess([]);
|
return $this->buildSuccess([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -116,6 +117,7 @@ class InterfaceList extends Base {
|
|||||||
if ($res === false) {
|
if ($res === false) {
|
||||||
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
return $this->buildFailed(ReturnCode::DB_SAVE_ERROR, '操作失败');
|
||||||
} else {
|
} else {
|
||||||
|
cache('ApiInfo:' . $postData['hash'], null);
|
||||||
return $this->buildSuccess([]);
|
return $this->buildSuccess([]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,6 +159,8 @@ class InterfaceList extends Base {
|
|||||||
AdminList::destroy(['hash' => $hash]);
|
AdminList::destroy(['hash' => $hash]);
|
||||||
AdminFields::destroy(['hash' => $hash]);
|
AdminFields::destroy(['hash' => $hash]);
|
||||||
|
|
||||||
|
cache('ApiInfo:' . $hash, null);
|
||||||
|
|
||||||
return $this->buildSuccess([]);
|
return $this->buildSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user