You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cf-sdk/Application/Admin/Model/WithdrawGoldCoinModel.class...

110 lines
2.7 KiB
PHP

<?php
namespace Admin\Model;
use Think\Model;
/**
* 金币提现记录模型
* @author 鹿文学
*/
class WithdrawGoldCoinModel extends Model{
/**
* 构造函数
* @param string $name 模型名称
* @param string $tablePrefix 表前缀
* @param mixed $connection 数据库连接信息
*/
public function __construct($name = '', $tablePrefix = '', $connection = '') {
/* 设置默认的表前缀 */
$this->tablePrefix ='tab_';
/* 执行构造方法 */
parent::__construct($name, $tablePrefix, $connection);
}
/*
* 获取提现列表通过用户编号
* @param integer $p 页数
* @param integer $uid 用户编号
* @return array 结果数据集
* @author 鹿文学
*/
public function listsByUser($p=1,$uid) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
$row = 10;
return $this->alias('w')->field('w.coin,w.money,w.poundage,w.create_time')
->where(['user_id'=>$uid,'status'=>1])->page($page,$row)->order('w.create_time desc')->select();
}
/**
* 用户金币提现记录列表
* @param integer $p 页码
* @param array $map 条件数组
* @return array 结果数据集
* @author 鹿文学
*/
public function lists($p=1,$map=array()) {
$page = intval($p);
$page = $page ? $page : 1; //默认显示第一页数据
if(isset($_REQUEST['row'])) {$row = $_REQUEST['row'];}else{$row = 10;}
$lists = $this->alias('wgc')->field('wgc.id,order_number,user_account,coin,poundage,money,gold_coin_balance,status,wgc.alipay,wgc.create_time')
->join('tab_user on tab_user.id = wgc.user_id ')->where($map)->page($page,$row)->order('id desc')->select();
$count = $this->where($map)->count();
$data['data'] = $lists;
//分页
$page = set_pagination($count,$row);
if($page) {$data['page']=$page;}
return $data;
}
/*
* 提现未处理列表
* @return array 检测结果数据集
* @author 鹿文学
*/
public function checkWithdrawGoldCoin() {
$map['admin_status'] = 0;
$list = $this->field('id,order_number,user_account')
->where($map)->select();
$type=408;
if ($list[0]) {
$list = D('check')->dealWithCheckList($type,$list);
if (empty($list[0])) {return '';}
foreach ($list as $k => $v) {
$data[$k]['info'] = '用户:'.$v['user_account'].'申请提现,提现状态:未打款';
$data[$k]['type'] = $type;
$data[$k]['url'] = U('UserWithdraw/lists',array('order_number'=>$v['order_number']));
$data[$k]['create_time'] = time();
$data[$k]['status']=0;
$data[$k]['position'] = $v['id'];
}
return $data;
}else {
D('check')->dealWithCheckListOnNull($type);
return '';
}
}
}