diff --git a/application/adminapi/controller/User.php b/application/adminapi/controller/User.php index 91b80ff..793d7fe 100644 --- a/application/adminapi/controller/User.php +++ b/application/adminapi/controller/User.php @@ -436,7 +436,15 @@ class User extends adminApi $page = input('page',1); $page_limit = input('page_limit',10); $type = input('type',''); - $return = model('UserWallet')->money_change_log($user_id,$type,$page,$page_limit); + $stime = input('stime',''); + $etime = input('etime',''); + $change_type = input('change_type',''); + $seach = [ + 'stime' => $stime, + 'etime' => $etime, + 'change_type' => $change_type + ]; + $return = model('UserWallet')->money_change_log($user_id,$seach,$type,$page,$page_limit); $list = []; foreach($return['list'] as $k=>$v){ $list[$k] = [ @@ -456,6 +464,14 @@ class User extends adminApi return V(1,"操作成功", $return_data); } + /* + * 获取用户资金类型 + */ + public function get_money_type(){ + $reslut = model('UserWallet')->getChangeTypeLableList(); + return V(1,"操作成功", $reslut); + } + /* * 相册列表 */ diff --git a/application/common/model/UserWallet.php b/application/common/model/UserWallet.php index c490830..ed1ba8c 100644 --- a/application/common/model/UserWallet.php +++ b/application/common/model/UserWallet.php @@ -125,7 +125,7 @@ class UserWallet extends Model return isset($status[$value]) ? $status[$value] : ''; } - public static function ChangeTypeLable($type) + public static function ChangeTypeLable($type="") { $status = [ self::OPERATION_SYSTEM => '系统调节', @@ -163,7 +163,12 @@ class UserWallet extends Model self::RED_PACKET_LEFT_COIN => '红包剩余退回(金币)', self::RED_PACKET_LEFT_DIAMOND => '红包剩余退回(钻石)', ]; - return $status[$type] ?? ''; + if($type){ + return $status[$type] ?? ''; + }else{ + return $status; + } + } /** @@ -269,10 +274,19 @@ class UserWallet extends Model /* * 用户资金变动日志 */ - public function money_change_log($user_id, $money_type=0, $page=0,$page_limit=30){ + public function money_change_log($user_id,$seach, $money_type=0, $page=0,$page_limit=30){ if($money_type){ $where['money_type'] =$money_type; } + if($seach['stime']){ + $where['createtime'] = ['>=',strtotime($seach['stime'])]; + } + if($seach['etime']){ + $where['createtime'] = ['<=',strtotime($seach['etime'])]; + } + if($seach['change_type']){ + $where['change_type'] =$seach['change_type']; + } $log['count'] = Db::name('vs_user_money_log')->where($where)->where('user_id',$user_id)->count(); $log_select = Db::name('vs_user_money_log') ->where($where) @@ -306,4 +320,11 @@ class UserWallet extends Model } return $log; } + + /* + * 获取用户资金类型 + */ + public function getChangeTypeLableList(){ + return $this->ChangeTypeLable(); + } } \ No newline at end of file