BrokerIncome.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class BrokerIncome extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'brokerid' => 'int',
  10. 'workerid' => 'int',
  11. 'agentid' => 'int',
  12. 'title' => 'string',
  13. 'origin_value' => 'decimal',
  14. 'value' => 'decimal',
  15. 'remark' => 'string',
  16. 'status' => 'int',
  17. 'type' => 'int',
  18. 'createtime' => 'int',
  19. 'yeartime' => 'int',
  20. 'monthtime' => 'int',
  21. ];
  22. // 设置字段自动转换类型
  23. protected $type = [
  24. 'createtime' => 'timestamp:Y-m-d H:i:s',
  25. ];
  26. // 关联User
  27. public function broker()
  28. {
  29. return $this->hasOne(Broker::class, "id", "brokerid");
  30. }
  31. public function getTypeTextAttr($value, $data)
  32. {
  33. $type = [1 => '普通', 2 => '提现'];
  34. return $type[$data['type']];
  35. }
  36. public function getStatusTextAttr($value, $data)
  37. {
  38. $type = [1 => '待处理', 2 => '已成功', 3 => '已拒绝'];
  39. return $type[$data['status']];
  40. }
  41. }