编辑角色格式调整

main
limu 1 year ago
parent 1a9a6e8f3a
commit 902b7c9bc4
  1. 16
      app/common/repositories/user/UserPartnerRepository.php
  2. 2
      app/controller/admin/system/admin/Partner.php
  3. 2
      app/controller/admin/user/User.php

@ -73,10 +73,16 @@ class UserPartnerRepository extends BaseRepository
public function changePartnerForm($uid)
{
/** @var UserLabelRepository $make */
$list = $this->dao->getAll($uid)->column('partner_id');
$partnerForm = new PartnerDao();
$option = $partnerForm->getAll();
return compact('list', 'option');
$list = $this->dao->getAll($uid)->column('partner_id') ?? [];
$data = ['partner_id' => $list];
return Elm::createForm(Route::buildUrl('systemUserChangePartner', compact('uid'))->build(), [
Elm::selectMultiple('partner_id', '用户合作人角色')->options(function () {
$partnerForm = new PartnerDao();
$option = $partnerForm->getAll();
return $option;
}),
])->setTitle('编辑合作人角色')->formData($data);
//return compact('list', 'option');
}
public function editPartner(int $uid, array $partner_id = [])
@ -88,7 +94,7 @@ class UserPartnerRepository extends BaseRepository
if (!empty($partner_id)) {
$data = [];
foreach ($partner_id as $k => $v) {
$data[] = ['uid' => $uid, 'partner_id' => $v,'create_time' => date("Y-m-d H:i:s")];
$data[] = ['uid' => $uid, 'partner_id' => $v, 'create_time' => date("Y-m-d H:i:s")];
}
UserPartner::getInstance()->insertAll($data);
}

@ -63,7 +63,7 @@ class Partner extends BaseController
public function update(PartnerRoleValidate $validate)
{
$data = $this->request->params(['name', 'ratio', 'is_area', 'area_level',
'area_id', ['status', 1], ['type', 1], ['max_role_num', 0], 'brand_id', 'trade_id','id']);
$validate->check($data);

@ -605,7 +605,7 @@ class User extends BaseController
{
if (!$this->repository->exists($id))
return app('json')->fail('数据不存在');
return app('json')->success($partnerRepository->changePartnerForm($id));
return app('json')->success(formToData($partnerRepository->changePartnerForm($id)));
}
public function changePartner(PartnerRepository $partnerRepository,UserPartnerRepository $userPartnerRepository)

Loading…
Cancel
Save