ztt 8 months ago
parent 852e3588bf
commit 1604562efd
  1. 10
      application/admin/controller/ScoreLog.php
  2. 8
      application/admin/model/shopro/user/WalletLog.php
  3. 6
      public/assets/js/backend/score_log.js

@ -13,7 +13,7 @@ use app\common\controller\Backend;
*/ */
class ScoreLog extends Backend class ScoreLog extends Backend
{ {
// protected $relationSearch = true;
/** /**
* ScoreLog模型对象 * ScoreLog模型对象
* @var \app\admin\model\ScoreLog * @var \app\admin\model\ScoreLog
@ -26,6 +26,7 @@ class ScoreLog extends Backend
$this->model = new \app\admin\model\ScoreLog; $this->model = new \app\admin\model\ScoreLog;
// var_dump((new Level())->getList()); // var_dump((new Level())->getList());
$this->assignconfig("levelList", $this->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(); [$where, $sort, $order, $offset, $limit] = $this->buildparams();
$walletLogs = WalletLogModel::where($where) $walletLogs = WalletLogModel::where($where)
->with(['user.agent.levelInfo','user'])
->score() ->score()
->with(['agent', 'user'])
->order($sort, $order) ->order($sort, $order)
->paginate($limit); ->paginate($limit);
@ -74,6 +75,11 @@ class ScoreLog extends Backend
foreach ($walletLogs['data'] as &$log) { foreach ($walletLogs['data'] as &$log) {
$log['oper'] = Operator::info($log['oper_type'], $log['oper'] ?? null); $log['oper'] = Operator::info($log['oper_type'], $log['oper'] ?? null);
$log['memo'] = $log['event_text']; $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']]; $result = ['total' => $walletLogs['total'], 'rows' => $walletLogs['data']];
return json($result); return json($result);

@ -2,6 +2,7 @@
namespace app\admin\model\shopro\user; namespace app\admin\model\shopro\user;
use app\admin\model\shopro\commission\Agent;
use app\admin\model\shopro\Common; use app\admin\model\shopro\Common;
class WalletLog extends Common class WalletLog extends Common
@ -83,9 +84,12 @@ class WalletLog extends Common
{ {
return $this->eventMap[$data['type']][$data['event']] ?? ''; return $this->eventMap[$data['type']][$data['event']] ?? '';
} }
public function agent()
{
return $this->belongsTo(Agent::class, 'user_id', 'user_id')->setEagerlyType(0);
}
public function user() public function user()
{ {
return $this->belongsTo(User::class, 'user_id', 'id'); return $this->belongsTo(User::class, 'user_id', 'id')->setEagerlyType(0);
} }
} }

@ -29,10 +29,12 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{checkbox: true}, {checkbox: true},
{field: 'id', title: __('Id')}, {field: 'id', title: __('Id')},
{field: 'user.nickname', title: '用户昵称',operate: 'LIKE'}, {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: 'user.mobile', title: '手机号',operate: 'LIKE'},
{field: 'amount', title: '积分变动额度',operate:'BETWEEN'}, {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: 'after', title: '当前积分'},
{field: 'createtime', title: '变动时间',operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, {field: 'createtime', title: '变动时间',operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
// // {field: 'type', title: __('Type'), operate: 'LIKE'}, // // {field: 'type', title: __('Type'), operate: 'LIKE'},

Loading…
Cancel
Save