diff --git a/app/api/controller/Square.php b/app/api/controller/Square.php index 58e417f0..a59bce96 100644 --- a/app/api/controller/Square.php +++ b/app/api/controller/Square.php @@ -12,6 +12,7 @@ declare (strict_types=1); namespace app\api\controller; +use app\api\model\User as UserModel; use app\common\model\store\StoreSettle; use app\api\service\User as UserService; use think\response\Json; @@ -50,7 +51,6 @@ class Square extends Controller $data['merchant_id'] = $this->merchantId; $data['user_name'] = $useInfo['user_id']; $data['real_name'] = $useInfo['nick_name']; - $data['avatar_id'] = $useInfo['avatar_id']; if ((new squareModel)->add($data)) { return $this->renderSuccess('添加成功'); } @@ -69,6 +69,8 @@ class Square extends Controller $list = $model->getList($this->request->param(), intval($pageSize))->toArray(); foreach ($list['data'] as $kr => $r) { + $model = new UserModel(); + $user = $model->where(['user_id' => $r['user_name']])->get()->toArray(); $res[$kr]['imgs'] = []; $res[$kr]['avatar_url'] = []; if ($r['imgs']) { @@ -77,7 +79,7 @@ class Square extends Controller $list['data'][$kr]['imgs'] = $files ?: null; } if ($r['user_name']) { - $files = UploadFile::getFileList([$r['avatar_id']]); + $files = UploadFile::getFileList([$user['avatar_id']]); $list['data'][$kr]['avatar_url'] = $files ?: null; } }