|
|
@ -15,9 +15,11 @@ namespace app\controller\admin\user; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use app\common\repositories\store\ExcelRepository; |
|
|
|
use app\common\repositories\store\ExcelRepository; |
|
|
|
|
|
|
|
use app\common\repositories\user\UserPartnerRepository; |
|
|
|
use app\common\repositories\user\UserSpreadLogRepository; |
|
|
|
use app\common\repositories\user\UserSpreadLogRepository; |
|
|
|
use app\common\repositories\user\UserVisitRepository; |
|
|
|
use app\common\repositories\user\UserVisitRepository; |
|
|
|
use crmeb\basic\BaseController; |
|
|
|
use crmeb\basic\BaseController; |
|
|
|
|
|
|
|
use app\common\repositories\system\admin\PartnerRepository; |
|
|
|
use app\common\repositories\store\coupon\StoreCouponRepository; |
|
|
|
use app\common\repositories\store\coupon\StoreCouponRepository; |
|
|
|
use app\common\repositories\store\coupon\StoreCouponUserRepository; |
|
|
|
use app\common\repositories\store\coupon\StoreCouponUserRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
|
use app\common\repositories\store\order\StoreOrderRepository; |
|
|
@ -89,7 +91,7 @@ class User extends BaseController |
|
|
|
'group_id', |
|
|
|
'group_id', |
|
|
|
'phone', |
|
|
|
'phone', |
|
|
|
'uid', |
|
|
|
'uid', |
|
|
|
]); |
|
|
|
]); |
|
|
|
[$page, $limit] = $this->getPage(); |
|
|
|
[$page, $limit] = $this->getPage(); |
|
|
|
return app('json')->success($this->repository->getList($where, $page, $limit)); |
|
|
|
return app('json')->success($this->repository->getList($where, $page, $limit)); |
|
|
|
} |
|
|
|
} |
|
|
@ -140,7 +142,7 @@ class User extends BaseController |
|
|
|
$data['pwd'] = $this->repository->encodePassword($data['repwd']); |
|
|
|
$data['pwd'] = $this->repository->encodePassword($data['repwd']); |
|
|
|
unset($data['repwd']); |
|
|
|
unset($data['repwd']); |
|
|
|
if ($data['is_promoter']) $data['promoter_time'] = date('Y-m-d H:i:s'); |
|
|
|
if ($data['is_promoter']) $data['promoter_time'] = date('Y-m-d H:i:s'); |
|
|
|
$this->repository->create('h5',$data); |
|
|
|
$this->repository->create('h5', $data); |
|
|
|
|
|
|
|
|
|
|
|
return app('json')->success('添加成功'); |
|
|
|
return app('json')->success('添加成功'); |
|
|
|
} |
|
|
|
} |
|
|
@ -162,7 +164,7 @@ class User extends BaseController |
|
|
|
return app('json')->fail('密码不一致'); |
|
|
|
return app('json')->fail('密码不一致'); |
|
|
|
$data['pwd'] = $this->repository->encodePassword($data['repwd']); |
|
|
|
$data['pwd'] = $this->repository->encodePassword($data['repwd']); |
|
|
|
unset($data['repwd']); |
|
|
|
unset($data['repwd']); |
|
|
|
$this->repository->update($id,$data); |
|
|
|
$this->repository->update($id, $data); |
|
|
|
|
|
|
|
|
|
|
|
return app('json')->success('修改成功'); |
|
|
|
return app('json')->success('修改成功'); |
|
|
|
} |
|
|
|
} |
|
|
@ -212,7 +214,7 @@ class User extends BaseController |
|
|
|
$data['label_id'] = implode(',', $label_id); |
|
|
|
$data['label_id'] = implode(',', $label_id); |
|
|
|
if ($data['is_promoter']) |
|
|
|
if ($data['is_promoter']) |
|
|
|
$data['promoter_time'] = date('Y-m-d H:i:s'); |
|
|
|
$data['promoter_time'] = date('Y-m-d H:i:s'); |
|
|
|
if(!$data['birthday']) unset($data['birthday']); |
|
|
|
if (!$data['birthday']) unset($data['birthday']); |
|
|
|
$this->repository->update($id, $data); |
|
|
|
$this->repository->update($id, $data); |
|
|
|
|
|
|
|
|
|
|
|
return app('json')->success('编辑成功'); |
|
|
|
return app('json')->success('编辑成功'); |
|
|
@ -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 |
|
|
|
* @return mixed |
|
|
|
* @throws DataNotFoundException |
|
|
|
* @throws DataNotFoundException |
|
|
@ -554,7 +581,7 @@ class User extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
public function memberForm($id) |
|
|
|
public function memberForm($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return app('json')->success(formToData($this->repository->memberForm($id,1))); |
|
|
|
return app('json')->success(formToData($this->repository->memberForm($id, 1))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function memberSave($id) |
|
|
|
public function memberSave($id) |
|
|
@ -568,7 +595,7 @@ class User extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
public function spreadLevelForm($id) |
|
|
|
public function spreadLevelForm($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return app('json')->success(formToData($this->repository->memberForm($id,0))); |
|
|
|
return app('json')->success(formToData($this->repository->memberForm($id, 0))); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function spreadLevelSave($id) |
|
|
|
public function spreadLevelSave($id) |
|
|
@ -587,8 +614,8 @@ class User extends BaseController |
|
|
|
|
|
|
|
|
|
|
|
public function svipUpdate($id) |
|
|
|
public function svipUpdate($id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$data = $this->request->params(['is_svip','add_time','type']); |
|
|
|
$data = $this->request->params(['is_svip', 'add_time', 'type']); |
|
|
|
$this->repository->svipUpdate($id, $data,$this->request->adminId()); |
|
|
|
$this->repository->svipUpdate($id, $data, $this->request->adminId()); |
|
|
|
return app('json')->success('修改成功'); |
|
|
|
return app('json')->success('修改成功'); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|