TransactionWithdrawal.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace App\Module\Transaction\Models;
  3. use App\Module\Transaction\Enums\WITHDRAWAL_STATUS;
  4. use Dcat\Admin\Traits\HasDateTimeFormatter;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use UCore\ModelCore;
  7. /**
  8. * 提现记录
  9. *
  10. * field start
  11. * field end
  12. */
  13. class TransactionWithdrawal extends ModelCore
  14. {
  15. // attrlist start
  16. protected $fillable = [
  17. ];
  18. // attrlist end
  19. use HasDateTimeFormatter;
  20. protected $table = 'transaction_withdrawal';
  21. /**
  22. * @param $insert
  23. * @return bool
  24. * 创建提现订单记录
  25. */
  26. public static function insert($insert)
  27. {
  28. $model = new static;
  29. $model->transaction_id = $insert['transaction_id'];
  30. $model->from_address = $insert['from_address'];
  31. $model->to_address = $insert['to_address'];
  32. $model->status = WITHDRAWAL_STATUS::WAIT_REVIEW;
  33. $model->miner_amount = $insert['miner_amount'];
  34. return $model->save();
  35. }
  36. /**
  37. * @param $transactionId
  38. * @return null
  39. * 获取提现单详情
  40. */
  41. public static function getDetail($transactionId)
  42. {
  43. $query = self::query();
  44. $query->where('transaction_id', $transactionId);
  45. return $query->first();
  46. }
  47. }