[积分商城]积分订单-优化

This commit is contained in:
2026-03-19 16:30:05 +08:00
parent 6e06d6fe39
commit 6b8dfcc441
3 changed files with 9 additions and 6 deletions

View File

@@ -45,14 +45,11 @@ class PintsOrder extends Backend
return $this->success();
}
/**
* 1. withJoin 不可使用 alias 方法设置表别名,别名将自动使用关联模型名称(小写下划线命名规则)
* 2. 以下的别名设置了主表别名,同时便于拼接查询参数等
* 3. paginate 数据集可使用链式操作 each(function($item, $key) {}) 遍历处理
*/
list($where, $alias, $limit, $order) = $this->queryBuilder();
$res = $this->model
->withJoin($this->withJoinTable, $this->withJoinType)
->with(['mallUser' => function ($query) {
$query->field('id,username');
}])
->visible(['mallUser' => ['username']])
->alias($alias)
->where($where)