0, 'name' => '其他'], ['id' => 1, 'name' => '预约福袋'], ['id' => 2, 'name' => '预约福袋空盒退回'], ['id' => 3, 'name' => '买商品送积分'], ['id' => 4, 'name' => '提现多次返回'], ['id' => 6, 'name' => '兑换商品'], ['id' => 12, 'name' => '平台充补'], ['id' => 13, 'name' => '平台扣除'] ]; private static $stateMap = [ ['id' => 1, 'name' => '增加'], ['id' => 2, 'name' => '减少'] ]; /** * @return array[] */ public static function getStateMap(): array { return self::$stateMap; } /** * @return array[] */ public static function getTypeMap(): array { return self::$typeMap; } public static function scoreLog($page, $limit, $where, $sort) { $model = new ScoreLogModel(); $count = $model ->where($where) ->count(); $type_conf = config('type.score'); $list = $model ->where($where) ->withAttr('type', function ($value, $data) use ($type_conf) { return $type_conf[$value]; }) ->withAttr('score', function ($value, $data) { if ($data['state'] == 2) $value = '-' . $value; return $value; }) ->page($page, $limit) ->order($sort) ->select(); return [$count, $list]; } }