Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,10 @@ ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so

WORKDIR /opt/www

COPY . /opt/www

RUN composer install --no-dev -o && php bin/hyperf.php

EXPOSE 9501 9502 9503

ENTRYPOINT ["php", "/opt/www/bin/hyperf.php", "start"]
2 changes: 1 addition & 1 deletion app/Setting/Mapper/SettingConfigMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function updateByKey(string $key, mixed $value = null): bool
*/
public function save(array $data): mixed
{
$this->filterExecuteAttributes($data);
$data = $this->filterExecuteAttributes($data);
$model = $this->model::create($data);
return ($model->{$model->getKeyName()}) ? 1 : 0;
}
Expand Down
12 changes: 5 additions & 7 deletions app/System/Mapper/SystemRoleMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

use App\System\Model\SystemRole;
use Hyperf\Database\Model\Builder;
use Hyperf\DbConnection\Annotation\Transactional;
use Mine\Abstracts\AbstractMapper;
use Mine\Annotation\DeleteCache;
use Mine\Annotation\Transaction;

class SystemRoleMapper extends AbstractMapper
{
Expand Down Expand Up @@ -77,13 +77,11 @@ public function checkRoleCode(string $code): bool
/**
* 新建角色.
*/
#[Transaction]
#[Transactional]
public function save(array $data): mixed
{
$menuIds = $data['menu_ids'] ?? [];
$deptIds = $data['dept_ids'] ?? [];
$this->filterExecuteAttributes($data);

$role = $this->model::create($data);
empty($menuIds) || $role->menus()->sync(array_unique($menuIds), false);
empty($deptIds) || $role->depts()->sync($deptIds, false);
Expand All @@ -93,12 +91,12 @@ public function save(array $data): mixed
/**
* 更新角色.
*/
#[DeleteCache('loginInfo:*'), Transaction]
#[DeleteCache('loginInfo:*'), Transactional]
public function update(mixed $id, array $data): bool
{
$menuIds = $data['menu_ids'] ?? [];
$deptIds = $data['dept_ids'] ?? [];
$this->filterExecuteAttributes($data, true);
$data = $this->filterExecuteAttributes($data, true);
$this->model::query()->where('id', $id)->update($data);
if ($id != env('ADMIN_ROLE')) {
$role = $this->model::find($id);
Expand Down Expand Up @@ -128,7 +126,7 @@ public function delete(array $ids): bool
/**
* 批量真实删除角色.
*/
#[DeleteCache('loginInfo:*'), Transaction]
#[DeleteCache('loginInfo:*'), Transactional]
public function realDelete(array $ids): bool
{
foreach ($ids as $id) {
Expand Down
1 change: 0 additions & 1 deletion tests/Expectations.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
array $updateFailParams,
array $uris = ['save', 'update']
) {
$this->toBeString();
$saveUri = $this->value . '/' . $uris[0];
foreach ($failParams as $param) {
$failResult = ClientBuilder::post($saveUri, $param);
Expand Down