[积分商城]积分订单-优化
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user