1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace App\Models;
- use App\Constants\HttpStatus;
- use App\Constants\Util;
- use Illuminate\Foundation\Auth\User as Authenticatable;
- use Illuminate\Notifications\Notifiable;
- use Laravel\Sanctum\HasApiTokens;
- use Illuminate\Database\Eloquent\Builder;
- /**
- * @mixin Builder
- * @method static Builder|static where($column, $operator = null, $value = null, $boolean = 'and')
- */
- class Recharge extends Authenticatable
- {
- use HasApiTokens, Notifiable;
- protected $table = 'recharges';
- // protected $hidden = ['created_at', 'updated_at'];
- // protected $fillable = ['member_id', 'confirmations', 'coin', 'txid','block_time','block_height' ,'net' ,'coin' ,'amount' ,'to_address' ,'from_address' ,'status'];
- const STATUS_STAY = 0;
- const STATUS_SUCCESS = 1;
- const STATUS_FAIL = 2;
- const STATUS_IGNORE = 3;
- public static $STATUS = [
- 0 => '待确认',
- 1 => '已确认',
- 2 => '失败',
- 3 => '已忽略',
- ];
- const TYPE_AUTO = 1; // 自动
- const TYPE_HAND = 2; // 手动
- protected function getAmountAttribute($value)
- {
- return floatval($value);
- }
- protected function getImageAttribute($value)
- {
- return Util::ensureUrl($value);
- }
- protected function getCreatedAtAttribute($value)
- {
- return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
- }
- protected function getUpdatedAtAttribute($value)
- {
- return \Carbon\Carbon::parse($value)->setTimezone('Asia/Shanghai')->format('Y-m-d H:i:s');
- }
- }
|