| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Module\Point\Dto;
- /**
- * 积分日志DTO类
- *
- * 用于传输积分日志相关数据
- */
- class PointLogDto
- {
- public int $id;
- public int $user_id;
- public int $point_id;
- public int $amount;
- public string $operate_id;
- public int $operate_type;
- public string $operate_type_name;
- public string $remark;
- public int $create_time;
- public string $create_ip;
- public int $later_balance;
- public int $before_balance;
- public bool $is_income;
- public bool $is_expense;
- public function __construct(array $data = [])
- {
- $this->id = $data['id'] ?? 0;
- $this->user_id = $data['user_id'] ?? 0;
- $this->point_id = $data['point_id'] ?? 0;
- $this->amount = $data['amount'] ?? 0;
- $this->operate_id = $data['operate_id'] ?? '';
- $this->operate_type = $data['operate_type'] ?? 0;
- $this->operate_type_name = $data['operate_type_name'] ?? '';
- $this->remark = $data['remark'] ?? '';
- $this->create_time = $data['create_time'] ?? 0;
- $this->create_ip = $data['create_ip'] ?? '';
- $this->later_balance = $data['later_balance'] ?? 0;
- $this->before_balance = $data['before_balance'] ?? 0;
- $this->is_income = $data['is_income'] ?? false;
- $this->is_expense = $data['is_expense'] ?? false;
- }
- /**
- * 转换为数组
- *
- * @return array
- */
- public function toArray(): array
- {
- return [
- 'id' => $this->id,
- 'user_id' => $this->user_id,
- 'point_id' => $this->point_id,
- 'amount' => $this->amount,
- 'operate_id' => $this->operate_id,
- 'operate_type' => $this->operate_type,
- 'operate_type_name' => $this->operate_type_name,
- 'remark' => $this->remark,
- 'create_time' => $this->create_time,
- 'create_ip' => $this->create_ip,
- 'later_balance' => $this->later_balance,
- 'before_balance' => $this->before_balance,
- 'is_income' => $this->is_income,
- 'is_expense' => $this->is_expense,
- ];
- }
- }
|