You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.7 KiB
60 lines
1.7 KiB
<?php
|
|
namespace app\model;
|
|
/**
|
|
* @property int id
|
|
* @property int user_id
|
|
* @property int from_account
|
|
* @property int to_account
|
|
* @property int change_num
|
|
* @property int order_sn
|
|
* @property int status
|
|
* @property string create_time
|
|
* @property string update_time
|
|
*/
|
|
class UserTransferModel extends BaseModel
|
|
{
|
|
protected $name = 'user_transfer';
|
|
protected $pk = 'id';
|
|
|
|
// 账户类型 1 现货 2 合约 3 美股 4 印尼股票 5 马股 6 泰股
|
|
public static function getUserTransferList(array $data):array
|
|
{
|
|
$where['user_id']=$data['user_id'];
|
|
$count=self::where($where)->count();
|
|
if($data['page']<1){
|
|
$data['page']=1;
|
|
}
|
|
if($data['page_size']<1){
|
|
$data['page_size']=10;
|
|
}
|
|
|
|
$list = self::where($where)->order('tran_id desc')->page($data['page'],$data['page_size'])->select();
|
|
if(empty($list)){
|
|
return [];
|
|
}
|
|
return [
|
|
'total'=>$count,
|
|
'list'=>$list->toArray(),
|
|
];
|
|
}
|
|
public static function InsertUserStock(array $data)
|
|
{
|
|
$self = new self;
|
|
$self->user_id = $data['user_id'];
|
|
$self->from_account = $data['from_account'];
|
|
$self->to_account = $data['to_account'];
|
|
$self->from_num = $data['from_num'];
|
|
$self->to_num = $data['to_num'];
|
|
$self->from_account_rate = $data['from_account_rate'];
|
|
$self->to_account_rate = $data['to_account_rate'];
|
|
$self->status = $data['status'];
|
|
$self->order_sn = $data['order_sn'];
|
|
$self->create_time = date('Y-m-d H:i:s');
|
|
$self->update_time = date('Y-m-d H:i:s');
|
|
$self->save();
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|