| 123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
- namespace app\common\model;
- use app\common\model\TimeModel;
- use think\Model;
- class MedalLogModel extends Model
- {
- protected $name = "medal_log";
- /**
- * 记录
- * @param $param
- * @return array
- * @throws \think\db\exception\DbException
- */
- public function getLog ($param)
- {
- $type_conf = config('type.medal');
- $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');
- }
- }
|