|
|
@@ -813,8 +813,15 @@ class User extends BaseController
|
|
813
|
813
|
public function changePro($id,UserRepository $repository)
|
|
814
|
814
|
{
|
|
815
|
815
|
$spread_account = $this->request->param('spread_account');
|
|
816
|
|
- if (!$spread_account || !$id){
|
|
817
|
|
- return app('json')->fail('参数丢失');
|
|
|
816
|
+ $spread_uid = Db::name("user")->where('uid', $id)->value("spread_uid");
|
|
|
817
|
+ if ($spread_uid) {
|
|
|
818
|
+ $spread_message = Db::name("user")->where('uid', $spread_uid)->field("uid,account,nickname")->find();
|
|
|
819
|
+ } else {
|
|
|
820
|
+ $spread_message = ['uid' => null, 'account' => '无推荐人', 'nickname' => '无推荐人'];
|
|
|
821
|
+ }
|
|
|
822
|
+
|
|
|
823
|
+ if (!$spread_account || !$id) {
|
|
|
824
|
+ return app('json')->success("获取成功", ['spread' => $spread_message]);
|
|
818
|
825
|
}
|
|
819
|
826
|
if($repository->update_spread($id,$spread_account)){
|
|
820
|
827
|
return app('json')->success("修改成功");
|
|
|
@@ -832,11 +839,28 @@ class User extends BaseController
|
|
832
|
839
|
*/
|
|
833
|
840
|
public function changeProLevelForm($id)
|
|
834
|
841
|
{
|
|
835
|
|
- if (!$this->repository->exists($id))
|
|
|
842
|
+ if (!$this->repository->exists($id)) {
|
|
836
|
843
|
return app('json')->fail('数据不存在');
|
|
837
|
|
- return app('json')->success(formToData($this->repository->changeProFormLevel($id)));
|
|
|
844
|
+ }
|
|
|
845
|
+
|
|
|
846
|
+ $groupId = Db::name('user')->where('uid', $id)->value('group_id');
|
|
|
847
|
+ if ($groupId) {
|
|
|
848
|
+ $level_message = Db::name('user')->where('uid', $groupId)->field('uid,account,nickname')->find();
|
|
|
849
|
+ } else {
|
|
|
850
|
+ $level_message = ['uid' => null, 'account' => '无节点人', 'nickname' => '无节点人'];
|
|
|
851
|
+ }
|
|
|
852
|
+
|
|
|
853
|
+ $formData = formToData($this->repository->changeProFormLevel($id));
|
|
|
854
|
+
|
|
|
855
|
+ return app('json')->success([
|
|
|
856
|
+ 'formData' => $formData,
|
|
|
857
|
+ 'level' => $level_message
|
|
|
858
|
+ ]);
|
|
838
|
859
|
}
|
|
839
|
860
|
|
|
|
861
|
+
|
|
|
862
|
+
|
|
|
863
|
+
|
|
840
|
864
|
/*
|
|
841
|
865
|
* 更改用户节点人信息
|
|
842
|
866
|
* cabbage
|
|
|
@@ -845,8 +869,8 @@ class User extends BaseController
|
|
845
|
869
|
public function changeProLevel($id,UserRepository $repository)
|
|
846
|
870
|
{
|
|
847
|
871
|
$level_account = $this->request->param('level_account');
|
|
848
|
|
- if (!$level_account || !$id){
|
|
849
|
|
- return app('json')->fail('参数丢失');
|
|
|
872
|
+ if (!$id) {
|
|
|
873
|
+ return app('json')->fail("参数丢失");
|
|
850
|
874
|
}
|
|
851
|
875
|
if($repository->update_level_uid($id,$level_account)){
|
|
852
|
876
|
return app('json')->success("修改成功");
|