GreenScoreLogModel.php 746 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * 绿色积分明细
  4. */
  5. namespace app\common\model;
  6. use think\Model;
  7. class GreenScoreLogModel extends Model
  8. {
  9. protected $name = "green_score_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.green_score');
  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('id', 'desc')
  24. ->paginate($param->data['limit'])
  25. ->toArray();
  26. return $list['data'];
  27. }
  28. }