UserWithDrawCash.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. namespace App\Models\Withdraw;
  3. use Illuminate\Database\Eloquent\Model;
  4. class UserWithDrawCash extends Model
  5. {
  6. protected $table = 'user_withdraw_cashes';
  7. protected $fillable = ['uid', 'distribution_channel_id', 'distribution_channel_name', 'amount','trans_fund_result', 'tallage','status',
  8. 'withdraw_type','withdraw_info','alipay_username','alipay_account','remark','serial_number','check_user_id',
  9. 'check_user_name','pay_merchant_company_id','created_at','updated_at','trans_time','trans_trade_no','tiktok_trade_no'];
  10. public static function getUserWithdrawCashsByUid($uid) {
  11. $result = self::where('uid',$uid)->select('*')->get();
  12. return $result;
  13. }
  14. public static function getToTransUserWithdrawCashes($before_limit_minute=60){
  15. $start_time = date('Y-m-d H:i:s',time() - $before_limit_minute*60);
  16. return self::where('created_at','>=',$start_time)->where('status','待打款')->get();
  17. }
  18. // 获取用户打款记录
  19. public static function getUserWithdrawCashes($data){
  20. $obj = self::select('*')->whereIn('status',['系统已打款','手动已打款']);
  21. if(empty($data['start_date'])){
  22. $data['start_date'] = date('Y-m-d 00:00:00');
  23. }
  24. if(empty($data['end_date'])){
  25. $data['end_date'] = date('Y-m-d 23:59:59');
  26. }
  27. $obj->where('created_at','>=',$data['start_date'])->where('created_at','<=',$data['end_date']);
  28. if(!empty($data['uid'])){
  29. $obj->where('uid',$data['uid']);
  30. }
  31. if(!empty($data['alipay_account'])){
  32. $obj->where('alipay_account',$data['alipay_account']);
  33. }
  34. return $obj->get();
  35. }
  36. }