更新修复异常

This commit is contained in:
yaooo 2023-09-06 13:15:16 +08:00
parent 85c2db7397
commit 49d26627b4
3 changed files with 10 additions and 3 deletions

View File

@ -707,13 +707,18 @@ class Community extends BaseController
$queryBuilder->where('c.mer_status', 2);
}
$count = $queryBuilder->count();
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.uid', 'c.title', 'c.image', 'c.entrust_mer_id','m.mer_name','m.mer_avatar', 'c.mer_status'])->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
$list = $queryBuilder->setOption('field', [])->field(['c.community_id', 'c.uid', 'c.title', 'c.image', 'c.entrust_mer_id', 'm.credit_buy', 'm.settle_cycle', 'm.interest_rate', 'm.mer_name', 'm.mer_avatar', 'c.mer_status'])->order('c.community_id', 'desc')->page($page, $limit)->fetchSql(false)->select();
if ($list) $list = $list->toArray();
foreach($list as $k => $v) {
$list[$k]['mer_name'] = 0;
// type1发起的委托 2收到的委托
if ($type == 2) {
$merchantInfo = Db::name('merchant')->where('uid', $v['uid'])->find();
$list[$k]['mer_name'] = $merchantInfo['mer_name'];
$list[$k]['mer_avatar'] = $merchantInfo['mer_avatar'];
$list[$k]['credit_buy'] = $merchantInfo['credit_buy'] ?? 0;
$list[$k]['settle_cycle'] = $merchantInfo['settle_cycle'] ?? 0;
$list[$k]['interest_rate'] = $merchantInfo['interest_rate'] ?? 0;
$list[$k]['mer_name'] = $merchantInfo['mer_name'] ?? '';
$list[$k]['mer_avatar'] = $merchantInfo['mer_avatar'] ?? '';
}
}
return app('json')->success(compact('count', 'list'));

View File

@ -20,6 +20,7 @@ use app\validate\merchant\StoreProductValidate;
use crmeb\basic\BaseController;
use crmeb\services\UploadService;
use think\App;
use think\facade\Db;
use think\exception\HttpResponseException;
use think\exception\ValidateException;

View File

@ -24,6 +24,7 @@ use crmeb\basic\BaseController;
use app\validate\merchant\StoreProductValidate as validate;
use app\common\repositories\store\product\ProductRepository as repository;
use think\exception\ValidateException;
use think\facade\Db;
class Product extends BaseController
{