PaymentCallback.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace App\Http\Models;
  3. use Eloquent;
  4. use Illuminate\Database\Eloquent\Builder;
  5. use Illuminate\Database\Eloquent\Model;
  6. use Illuminate\Support\Carbon;
  7. /**
  8. * 支付回调(有赞云支付)
  9. * Class PaymentCallback
  10. *
  11. * @package App\Http\Models
  12. * @mixin Eloquent
  13. * @property int $id
  14. * @property string|null $client_id
  15. * @property string|null $yz_id
  16. * @property string|null $kdt_id
  17. * @property string|null $kdt_name
  18. * @property int|null $mode
  19. * @property string|null $msg
  20. * @property int|null $sendCount
  21. * @property string|null $sign
  22. * @property string|null $status
  23. * @property int|null $test
  24. * @property string|null $type
  25. * @property string|null $version
  26. * @property Carbon|null $created_at
  27. * @property Carbon|null $updated_at
  28. * @property-read mixed $status_label
  29. * @method static Builder|PaymentCallback newModelQuery()
  30. * @method static Builder|PaymentCallback newQuery()
  31. * @method static Builder|PaymentCallback query()
  32. * @method static Builder|PaymentCallback whereClientId($value)
  33. * @method static Builder|PaymentCallback whereCreatedAt($value)
  34. * @method static Builder|PaymentCallback whereId($value)
  35. * @method static Builder|PaymentCallback whereKdtId($value)
  36. * @method static Builder|PaymentCallback whereKdtName($value)
  37. * @method static Builder|PaymentCallback whereMode($value)
  38. * @method static Builder|PaymentCallback whereMsg($value)
  39. * @method static Builder|PaymentCallback whereSendCount($value)
  40. * @method static Builder|PaymentCallback whereSign($value)
  41. * @method static Builder|PaymentCallback whereStatus($value)
  42. * @method static Builder|PaymentCallback whereTest($value)
  43. * @method static Builder|PaymentCallback whereType($value)
  44. * @method static Builder|PaymentCallback whereUpdatedAt($value)
  45. * @method static Builder|PaymentCallback whereVersion($value)
  46. * @method static Builder|PaymentCallback whereYzId($value)
  47. */
  48. class PaymentCallback extends Model
  49. {
  50. protected $table = 'payment_callback';
  51. protected $primaryKey = 'id';
  52. protected $appends = ['status_label'];
  53. function getStatusLabelAttribute()
  54. {
  55. $status_label = '';
  56. switch($this->attributes['status']){
  57. case 'WAIT_BUYER_PAY':
  58. $status_label = '等待买家付款';
  59. break;
  60. case 'WAIT_SELLER_SEND_GOODS':
  61. $status_label = '等待卖家发货';
  62. break;
  63. case 'TRADE_SUCCESS':
  64. $status_label = '交易成功';
  65. break;
  66. case 'PAID':
  67. $status_label = '支付完成';
  68. break;
  69. }
  70. return $status_label;
  71. }
  72. }