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

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)

View File

@@ -2,6 +2,7 @@
namespace app\common\model;
use app\common\model\traits\TimestampInteger;
use support\think\Model;
/**
@@ -9,6 +10,8 @@ use support\think\Model;
*/
class MallPintsOrder extends Model
{
use TimestampInteger;
// 表名
protected $name = 'mall_pints_order';

View File

@@ -59,6 +59,7 @@ const baTable = new baTableClass(
label: t('mall.pintsOrder.malluser__username'),
prop: 'mallUser.username',
align: 'center',
minWidth: 120,
operatorPlaceholder: t('Fuzzy query'),
render: 'tags',
operator: 'LIKE',
@@ -68,6 +69,8 @@ const baTable = new baTableClass(
label: t('mall.pintsOrder.type'),
prop: 'type',
align: 'center',
effect: 'dark',
custom: { 1: 'success', 2: 'primary', 3: 'info' },
operator: 'eq',
sortable: false,
render: 'tag',