<?php namespace app\model; /** * @property int id * @property int user_id * @property int order_no * @property int account_type * @property float service_fee * @property float apply_num * @property string apply_type * @property string pay_info * @property int status * @property int deal_admin_id * @property string create_time * @property string update_time * @property string deal_time */ class UserWithdrawalModel extends BaseModel { protected $name = 'user_withdrawal'; protected $pk = 'id'; // status 0处理中,1已审核,2已拒绝,3 支付中,4 支付成功, 5客户取消 const STATUS_ZERO = 0; const STATUS_ONE = 1; const STATUS_TWO = 2; const STATUS_THREE = 3; const STATUS_FOUR = 4; const STATUS_FIVE = 5; public static $statusList = [ self::STATUS_ZERO => '处理中', self::STATUS_ONE => '已审核', self::STATUS_TWO => '已拒绝', self::STATUS_THREE => '支付中', self::STATUS_FOUR => '支付成功', self::STATUS_FIVE => '用户取消', ]; public static function getUserDrawalList(array $data) { $where['user_id'] = $data['user_id']; if ($data['account_type'] > 0) { $where['account_type'] = $data['account_type']; } if ($data['page'] < 1) { $data['page'] = 1; } if ($data['page_size'] < 1) { $data['page_size'] = 10; } $count = self::where($where)->count(); $list = self::where($where)->field('account_type,order_no,service_fee,total_amount as apply_num,apply_type,pay_info,status,beizhu,create_time') ->page($data['page'], $data['page_size'])->order('id', 'desc')->select(); if (empty($list)) { return []; } else { return [ 'total' => $count, 'list' => $list->toArray() ]; } } public static function InsertUserDrawalLog(array $data) { $self = new self; $self->user_id = $data['user_id']; $self->order_no = $data['order_no']; $self->account_type = $data['account_type']; $self->service_fee = $data['service_fee']; $self->apply_num = $data['apply_num']; $self->apply_type = $data['apply_type']; $self->pay_info = $data['pay_info']; $self->status = 0; $self->drawal_type = $data['drawal_type']; $self->country = $data['country']; $self->currency_rate = $data['currency_rate']; $self->total_amount = $data['total_amount']; $self->market_amount = $data['market_amount']; $self->deal_admin_id = 0; $self->create_time = date('Y-m-d H:i:s'); $self->update_time = date('Y-m-d H:i:s'); return $self->save(); } public static function getUserDrawalInfo(array $where) { $info = self::where($where)->find(); if ($info) { return $info->toArray(); } else { return []; } } }