|
|
|
@ -15,9 +15,11 @@ namespace app\controller\admin\user; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\repositories\store\ExcelRepository; |
|
|
|
|
use app\common\repositories\user\UserPartnerRepository; |
|
|
|
|
use app\common\repositories\user\UserSpreadLogRepository; |
|
|
|
|
use app\common\repositories\user\UserVisitRepository; |
|
|
|
|
use crmeb\basic\BaseController; |
|
|
|
|
use app\common\repositories\system\admin\PartnerRepository; |
|
|
|
|
use app\common\repositories\store\coupon\StoreCouponRepository; |
|
|
|
|
use app\common\repositories\store\coupon\StoreCouponUserRepository; |
|
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
@ -302,6 +304,31 @@ class User extends BaseController |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//读取用户标签 |
|
|
|
|
public function getPartner(int $id, UserPartnerRepository $partnerRepository) |
|
|
|
|
{ |
|
|
|
|
if (!$this->repository->exists($id)) |
|
|
|
|
return app('json')->fail('数据不存在'); |
|
|
|
|
return app('json')->success($partnerRepository->changePartnerForm($id)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function changePartner(PartnerRepository $partnerRepository,UserPartnerRepository $userPartnerRepository) |
|
|
|
|
{ |
|
|
|
|
$partner_id = (array)$this->request->param('partner_id', []); |
|
|
|
|
$id = (int)$this->request->param('uid', ''); |
|
|
|
|
if (!$this->repository->exists($id)) |
|
|
|
|
return app('json')->fail('数据不存在'); |
|
|
|
|
foreach ($partner_id as $k => $value) { |
|
|
|
|
$partner_id[$k] = (int)$value; |
|
|
|
|
if (!$partnerRepository->exists((int)$value)) |
|
|
|
|
return app('json')->fail('所选合作人角色不存在'); |
|
|
|
|
} |
|
|
|
|
$userPartnerRepository->editPartner($id, $partner_id); |
|
|
|
|
return app('json')->success('修改成功'); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @return mixed |
|
|
|
|
* @throws DataNotFoundException |
|
|
|
|