FundTransferModel.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace App\Module\Fund\Models;
  3. use UCore\ModelCore;
  4. use App\Module\User\Models\User;
  5. /**
  6. * App\Module\Fund\Models\FundTransferModel
  7. *
  8. * field start
  9. * @property int $id 自增
  10. * @property int $user_id 用户id
  11. * @property int $to_user_id 转给用户id
  12. * @property string $remark 备注
  13. * @property int $amount 钱数
  14. * @property int $fund_id 来源账户的资金id
  15. * field end
  16. */
  17. class FundTransferModel extends ModelCore
  18. {
  19. protected $table = 'fund_transfer';
  20. // attrlist start
  21. protected $fillable = [
  22. 'id',
  23. 'user_id',
  24. 'to_user_id',
  25. 'remark',
  26. 'amount',
  27. 'fund_id',
  28. ];
  29. // attrlist end
  30. protected $fillable = [
  31. 'user_id',
  32. 'from_fund_id',
  33. 'to_fund_id',
  34. 'amount',
  35. 'status',
  36. 'remark',
  37. 'create_time',
  38. 'create_ip',
  39. 'update_time',
  40. 'update_ip',
  41. 'admin_id',
  42. 'admin_name'
  43. ];
  44. public $timestamps = false;
  45. /**
  46. * 获取用户信息
  47. */
  48. public function user()
  49. {
  50. return $this->belongsTo(User::class, 'id');
  51. }
  52. /**
  53. * 获取来源资金账户
  54. */
  55. public function fromFund()
  56. {
  57. return $this->belongsTo('App\Module\Fund\Models\FundModel', 'from_fund_id');
  58. }
  59. /**
  60. * 获取目标资金账户
  61. */
  62. public function toFund()
  63. {
  64. return $this->belongsTo('App\Module\Fund\Models\FundModel', 'to_fund_id');
  65. }
  66. }