ScoreLock1LogModel.php 924 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /**
  3. * 积分明细
  4. */
  5. namespace app\common\model;
  6. use think\Model;
  7. class ScoreLock1LogModel extends Model
  8. {
  9. protected $name = "scorelock1_log";
  10. /**
  11. * 记录
  12. * @param $param
  13. * @return array
  14. * @throws \think\db\exception\DbException
  15. */
  16. public function getLog ($param)
  17. {
  18. $type_conf = config('type.scorelock1');
  19. $list = self::where('uid', $param->uid)
  20. ->withAttr('type', function ($value, $data) use ($type_conf) {
  21. return isset($type_conf[$value]) ? $type_conf[$value] : '未知类型';
  22. })
  23. ->order('create_at', 'desc')
  24. ->paginate($param->data['limit'])
  25. ->toArray();
  26. // $history = self::where([
  27. // ['uid', '=', $param->uid],
  28. // ['state', '=', 1]
  29. // ])->sum('money');
  30. return $list['data'];
  31. return compact('list', 'history');
  32. }
  33. }