| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- /**
- * 积分明细
- */
- namespace app\common\model;
- use think\Model;
- class TzLogModel extends Model
- {
- protected $name = "tz_log";
- /**
- * 记录
- * @param $param
- * @return array
- * @throws \think\db\exception\DbException
- */
- public function getLog ($param)
- {
- $type_conf = config('type.tz');
- $list = self::where('uid', $param->uid)
- ->withAttr('type', function ($value, $data) use ($type_conf) {
- return isset($type_conf[$value]) ? $type_conf[$value] : '未知类型';
- })
- ->order('create_at', 'desc')
- ->paginate($param->data['limit'])
- ->toArray();
- // $history = self::where([
- // ['uid', '=', $param->uid],
- // ['state', '=', 1]
- // ])->sum('money');
- return $list['data'];
- return compact('list', 'history');
- }
- }
|