feature/main20240421
guojia 9 months ago
parent f3de780780
commit 61f550283c
  1. 6
      app/api/controller/Square.php

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

Loading…
Cancel
Save