UserBalance.php 600 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace app\common\model;
  3. use think\Model;
  4. class UserBalance extends Model
  5. {
  6. // 设置字段信息
  7. protected $schema = [
  8. 'id' => 'int',
  9. 'userid' => 'int',
  10. 'title' => 'string',
  11. 'binout' => 'int',
  12. 'btype' => 'string',
  13. 'bvalue' => 'float',
  14. 'balance' => 'float',
  15. 'ordersn' => 'string',
  16. 'remark' => 'string',
  17. 'createtime' => 'int'
  18. ];
  19. // 设置字段自动转换类型
  20. protected $type = [
  21. 'createtime' => 'timestamp:Y-m-d H:i:s'
  22. ];
  23. // 关联User
  24. public function user()
  25. {
  26. return $this->hasOne(User::class, "id", "userid");
  27. }
  28. }