diff --git a/application/admin/controller/ScoreLog.php b/application/admin/controller/ScoreLog.php index 53b6580..982d874 100755 --- a/application/admin/controller/ScoreLog.php +++ b/application/admin/controller/ScoreLog.php @@ -13,7 +13,7 @@ use app\common\controller\Backend; */ class ScoreLog extends Backend { - +// protected $relationSearch = true; /** * ScoreLog模型对象 * @var \app\admin\model\ScoreLog @@ -26,6 +26,7 @@ class ScoreLog extends Backend $this->model = new \app\admin\model\ScoreLog; // var_dump((new Level())->getList()); $this->assignconfig("levelList", $this->getList()); + $this->assignconfig("eventList",( new WalletLogModel())->getEventMap()['score']); } @@ -56,8 +57,8 @@ class ScoreLog extends Backend } [$where, $sort, $order, $offset, $limit] = $this->buildparams(); $walletLogs = WalletLogModel::where($where) - ->with(['user.agent.levelInfo','user']) ->score() + ->with(['agent', 'user']) ->order($sort, $order) ->paginate($limit); @@ -74,6 +75,11 @@ class ScoreLog extends Backend foreach ($walletLogs['data'] as &$log) { $log['oper'] = Operator::info($log['oper_type'], $log['oper'] ?? null); $log['memo'] = $log['event_text']; + $log['level_name'] = '--'; + if (!empty($log['agent']['level'])) { + $log['level_name'] = LevelModel::get($log['agent']['level'])->name; + } + } $result = ['total' => $walletLogs['total'], 'rows' => $walletLogs['data']]; return json($result); diff --git a/application/admin/model/shopro/user/WalletLog.php b/application/admin/model/shopro/user/WalletLog.php index 728060e..50d62ca 100755 --- a/application/admin/model/shopro/user/WalletLog.php +++ b/application/admin/model/shopro/user/WalletLog.php @@ -2,6 +2,7 @@ namespace app\admin\model\shopro\user; +use app\admin\model\shopro\commission\Agent; use app\admin\model\shopro\Common; class WalletLog extends Common @@ -83,9 +84,12 @@ class WalletLog extends Common { return $this->eventMap[$data['type']][$data['event']] ?? ''; } - + public function agent() + { + return $this->belongsTo(Agent::class, 'user_id', 'user_id')->setEagerlyType(0); + } public function user() { - return $this->belongsTo(User::class, 'user_id', 'id'); + return $this->belongsTo(User::class, 'user_id', 'id')->setEagerlyType(0); } } diff --git a/public/assets/js/backend/score_log.js b/public/assets/js/backend/score_log.js index adff464..d88af62 100755 --- a/public/assets/js/backend/score_log.js +++ b/public/assets/js/backend/score_log.js @@ -29,10 +29,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin {checkbox: true}, {field: 'id', title: __('Id')}, {field: 'user.nickname', title: '用户昵称',operate: 'LIKE'}, - {field: 'user.agent.level_info.name', title: '用户等级', searchList: Config.levelList}, + {field: 'level_name', title: '用户等级', operate: false}, + {field: 'agent.level', title: '用户等级', visible:false, searchList: Config.levelList}, {field: 'user.mobile', title: '手机号',operate: 'LIKE'}, {field: 'amount', title: '积分变动额度',operate:'BETWEEN'}, - {field: 'memo', title: '积分变动类型'}, + {field: 'memo', title: '积分变动类型', operate: false}, + {field: 'event', title: '积分变动类型', visible:false, searchList: Config.eventList}, {field: 'after', title: '当前积分'}, {field: 'createtime', title: '变动时间',operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, // // {field: 'type', title: __('Type'), operate: 'LIKE'},