|
|
|
@ -8,6 +8,7 @@
|
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
namespace Admin\Model;
|
|
|
|
|
|
|
|
|
|
use Common\Api\GameApi;
|
|
|
|
|
use Org\WeixinSDK\Weixin;
|
|
|
|
|
use Think\Model;
|
|
|
|
@ -15,8 +16,8 @@ use Think\Model;
|
|
|
|
|
/**
|
|
|
|
|
* 文档基础模型
|
|
|
|
|
*/
|
|
|
|
|
class SpendModel extends Model{
|
|
|
|
|
|
|
|
|
|
class SpendModel extends Model
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 自动验证规则 */
|
|
|
|
@ -29,7 +30,8 @@ class SpendModel extends Model{
|
|
|
|
|
array('order_number', '', self::MODEL_INSERT),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
protected function _after_select(&$result,$options){
|
|
|
|
|
protected function _after_select(&$result, $options)
|
|
|
|
|
{
|
|
|
|
|
foreach ($result as $key => $value) {
|
|
|
|
|
// $result[$key]['pay_way'] = date('Y-m-d ', $value['time']);
|
|
|
|
|
}
|
|
|
|
@ -41,7 +43,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @param string $tablePrefix 表前缀
|
|
|
|
|
* @param mixed $connection 数据库连接信息
|
|
|
|
|
*/
|
|
|
|
|
public function __construct($name = '', $tablePrefix = '', $connection = '') {
|
|
|
|
|
public function __construct($name = '', $tablePrefix = '', $connection = '')
|
|
|
|
|
{
|
|
|
|
|
/* 设置默认的表前缀 */
|
|
|
|
|
$this->tablePrefix = 'tab_';
|
|
|
|
|
/* 执行构造方法 */
|
|
|
|
@ -54,7 +57,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return int 时间戳
|
|
|
|
|
* @author huajie <banhuajie@163.com>
|
|
|
|
|
*/
|
|
|
|
|
protected function getCreateTime(){
|
|
|
|
|
protected function getCreateTime()
|
|
|
|
|
{
|
|
|
|
|
$create_time = I('post.create_time');
|
|
|
|
|
return $create_time ? strtotime($create_time) : NOW_TIME;
|
|
|
|
|
}
|
|
|
|
@ -63,7 +67,9 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
{
|
|
|
|
|
return session('user_auth.username');
|
|
|
|
|
}
|
|
|
|
|
public function totalSpendTimes($map=""){
|
|
|
|
|
|
|
|
|
|
public function totalSpendTimes($map = "")
|
|
|
|
|
{
|
|
|
|
|
$map['s.pay_status'] = 1;
|
|
|
|
|
$data = $this->alias("s")->field("IFNULL(count(pay_amount),0) as count")
|
|
|
|
|
->join("left join tab_game g on g.id = s.game_id")
|
|
|
|
@ -71,20 +77,24 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
->find();
|
|
|
|
|
return $data['count'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* [dealPage 页码处理]
|
|
|
|
|
* @param [type] $p [description]
|
|
|
|
|
* @return [type] [description]
|
|
|
|
|
*/
|
|
|
|
|
public function dealPage($p){
|
|
|
|
|
public function dealPage($p)
|
|
|
|
|
{
|
|
|
|
|
$page = intval($p);
|
|
|
|
|
$page = $page ? $page : 1; //默认显示第一页数据
|
|
|
|
|
return $page;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 自动补单
|
|
|
|
|
*/
|
|
|
|
|
public static function auto_repair(){
|
|
|
|
|
public static function auto_repair()
|
|
|
|
|
{
|
|
|
|
|
$game = new GameApi();
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
$map['pay_game_status'] = 0;
|
|
|
|
@ -232,14 +242,13 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 微信退款查询接口
|
|
|
|
|
* @param [type] $orderNo [description]
|
|
|
|
|
* @return [type] [description]
|
|
|
|
|
*/
|
|
|
|
|
public function weixin_refundquery($orderNo){
|
|
|
|
|
public function weixin_refundquery($orderNo)
|
|
|
|
|
{
|
|
|
|
|
$weixn = new Weixin();
|
|
|
|
|
$res = $weixn->weixin_refundquery($orderNo);
|
|
|
|
|
if ($res == "SUCCESS") {
|
|
|
|
@ -253,13 +262,13 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 威富通查询退款接口
|
|
|
|
|
* @param [type] $map [description]
|
|
|
|
|
* @return [type] [description]
|
|
|
|
|
*/
|
|
|
|
|
public function swiftpass_refund($orderNo){
|
|
|
|
|
public function swiftpass_refund($orderNo)
|
|
|
|
|
{
|
|
|
|
|
$config = array("partner" => trim(C("weixin.partner")), "email" => "", "key" => trim(C("weixin.key")));
|
|
|
|
|
$pay = new \Think\Pay('swiftpass', $config);
|
|
|
|
|
$vo = new \Think\Pay\PayVo();
|
|
|
|
@ -280,22 +289,14 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 开放平台 付费人数
|
|
|
|
|
* @param string $map
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function countSpendUserOfOpen($map=""){
|
|
|
|
|
public function countSpendUserOfOpen($map = "")
|
|
|
|
|
{
|
|
|
|
|
$sql = $this->alias("s")->field("s.user_id")
|
|
|
|
|
->join("left join tab_game g on g.id = s.game_id")
|
|
|
|
|
->where($map)
|
|
|
|
@ -312,7 +313,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function totalSpend($map=""){
|
|
|
|
|
public function totalSpend($map = "")
|
|
|
|
|
{
|
|
|
|
|
$map['s.pay_status'] = 1;
|
|
|
|
|
$data = $this->alias("s")->field("IFNULL(sum(pay_amount),0) as num")
|
|
|
|
|
->join("right join tab_game g on g.id = s.game_id")
|
|
|
|
@ -328,7 +330,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @param $develop_id
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function getOpenSpend($map,$develop_id,$game_id){
|
|
|
|
|
public function getOpenSpend($map, $develop_id, $game_id)
|
|
|
|
|
{
|
|
|
|
|
// empty($game_id) || $map['s.game_id'] = $game_id;
|
|
|
|
|
empty($game_id) || $join = "and g.id = {$game_id}";
|
|
|
|
|
$data = $this->alias("s")->field("IFNULL(sum(pay_amount),0) as num,d.time")
|
|
|
|
@ -347,7 +350,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function getPayerNum($map,$develop_id,$game_id){
|
|
|
|
|
public function getPayerNum($map, $develop_id, $game_id)
|
|
|
|
|
{
|
|
|
|
|
// empty($game_id) || $map['s.game_id'] = $game_id;
|
|
|
|
|
empty($game_id) || $join = "and g.id = {$game_id}";
|
|
|
|
|
$data = $this->alias("s")->field("IFNULL(count(DISTINCT user_id),0) as num,d.time")
|
|
|
|
@ -368,7 +372,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function getNewPayerNum($start,$end,$develop_id,$game_id){
|
|
|
|
|
public function getNewPayerNum($start, $end, $develop_id, $game_id)
|
|
|
|
|
{
|
|
|
|
|
//第一次充值
|
|
|
|
|
empty($game_id) || $map['s.game_id'] = $game_id;
|
|
|
|
|
|
|
|
|
@ -391,7 +396,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function getTotalPayerNum($start,$end,$develop_id){
|
|
|
|
|
public function getTotalPayerNum($start, $end, $develop_id)
|
|
|
|
|
{
|
|
|
|
|
$start = strtotime($start);
|
|
|
|
|
$end = strtotime($end);
|
|
|
|
|
$map['g.developers'] = $develop_id;
|
|
|
|
@ -409,7 +415,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return mixed
|
|
|
|
|
* author: xmy 280564871@qq.com
|
|
|
|
|
*/
|
|
|
|
|
public function getTotalSpend($map){
|
|
|
|
|
public function getTotalSpend($map)
|
|
|
|
|
{
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
$data = $this->field("IFNULL(sum(pay_amount),0) as num")->where($map)->find();
|
|
|
|
|
return $data;
|
|
|
|
@ -420,7 +427,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 结果集
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function checkSpend() {
|
|
|
|
|
public function checkSpend()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$list = $this->field('id,user_id,user_account,game_id,game_name,pay_amount,pay_order_number')->where(array('pay_status' => 0))->select();
|
|
|
|
|
$type = 101;
|
|
|
|
@ -428,7 +436,9 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
|
|
|
|
|
$list = D('check')->dealWithCheckList($type, $list);
|
|
|
|
|
|
|
|
|
|
if (empty($list[0])) {return '';}
|
|
|
|
|
if (empty($list[0])) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$data[$k]['info'] = '玩家:' . $v['user_account'] . ',游戏[' . $v['game_name'] . ']充值金额:' . $v['pay_amount'] . ',订单状态:下单未支付';
|
|
|
|
@ -451,7 +461,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 结果集
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function checkSupplement() {
|
|
|
|
|
public function checkSupplement()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$list = $this->field('id,user_id,user_account,pay_order_number')->where(array('pay_status' => 1, 'pay_game_status' => 0))->select();
|
|
|
|
|
$type = 102;
|
|
|
|
@ -459,7 +470,9 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
|
|
|
|
|
$list = D('check')->dealWithCheckList($type, $list);
|
|
|
|
|
|
|
|
|
|
if (empty($list[0])) {return '';}
|
|
|
|
|
if (empty($list[0])) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach ($list as $k => $v) {
|
|
|
|
|
$data[$k]['info'] = '玩家:' . $v['user_account'] . ',订单:' . $v['pay_order_number'] . ',操作:补单失败';
|
|
|
|
@ -484,7 +497,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return integer 数量
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function totalAmount($map=array()) {
|
|
|
|
|
public function totalAmount($map = array())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
@ -504,21 +518,38 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 详细数据
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function totalAmountByGroup($map=array(),$fieldname='amount',$group='time',$flag=1,$order='time') {
|
|
|
|
|
public function totalAmountByGroup($map = array(), $fieldname = 'amount', $group = 'time', $flag = 1, $order = 'time')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch ($flag) {
|
|
|
|
|
case 2:{$dateform = '%Y-%m';};break;
|
|
|
|
|
case 3:{$dateform = '%Y-%u';};break;
|
|
|
|
|
case 4:{$dateform = '%Y';};break;
|
|
|
|
|
case 5:{$dateform = '%Y-%m-%d %H';};break;
|
|
|
|
|
default:$dateform = '%Y-%m-%d';
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%u';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m-%d %H';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$dateform = '%Y-%m-%d';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = $this->field('FROM_UNIXTIME(pay_time,"' . $dateform . '") as ' . $group . ',sum(pay_amount) as ' . $fieldname)
|
|
|
|
|
|
|
|
|
|
->where($map)->group($group)->order($order)->select();
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
@ -533,38 +564,49 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 详细数据
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function allAmountByGroup($map=array(),$fieldname='amount',$group='time',$flag=1,$order='time') {
|
|
|
|
|
public function allAmountByGroup($map = array(), $fieldname = 'amount', $group = 'time', $flag = 1, $order = 'time')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch ($flag) {
|
|
|
|
|
case 2:{$dateform = '%Y-%m';};break;
|
|
|
|
|
case 3:{$dateform = '%Y-%u';};break;
|
|
|
|
|
case 4:{$dateform = '%Y';};break;
|
|
|
|
|
case 5:{$dateform = '%Y-%m-%d %H';};break;
|
|
|
|
|
default:$dateform = '%Y-%m-%d';
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%u';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m-%d %H';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$dateform = '%Y-%m-%d';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
|
$union = D('deposit')->field('pay_order_number,FROM_UNIXTIME(create_time,"' . $dateform . '") as ' . $group . ',sum(pay_amount) as ' . $fieldname)
|
|
|
|
|
|
|
|
|
|
->where(['create_time' => $map['pay_time'], 'pay_status' => 1])
|
|
|
|
|
|
|
|
|
|
->group($group)->select(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$bind = M('Bind_recharge', 'tab_')->field('pay_order_number,FROM_UNIXTIME(create_time,"' . $dateform . '") as ' . $group . ',sum(real_amount) as ' . $fieldname)
|
|
|
|
|
|
|
|
|
|
->where(['create_time' => $map['pay_time'], 'pay_status' => 1])
|
|
|
|
|
|
|
|
|
|
->group($group)->select(false);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql = $this->field('pay_order_number,FROM_UNIXTIME(pay_time,"' . $dateform . '") as ' . $group . ',sum(pay_amount) as ' . $fieldname)
|
|
|
|
|
|
|
|
|
|
->union('(' . $union . ')')
|
|
|
|
|
|
|
|
|
|
->union('(' . $bind . ')')
|
|
|
|
|
|
|
|
|
|
->where($map)->group($group)->select(false);
|
|
|
|
|
|
|
|
|
|
$data = $this->table('(' . $sql . ') as a')->field('a.' . $group . ',sum(a.' . $fieldname . ') as ' . $fieldname)->group('a.' . $group)->order($order)->select();
|
|
|
|
@ -581,21 +623,38 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 详细数据
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function totalPlayerByGroup($map=array(),$fieldname='count',$group='time',$flag=1,$order='time') {
|
|
|
|
|
public function totalPlayerByGroup($map = array(), $fieldname = 'count', $group = 'time', $flag = 1, $order = 'time')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch ($flag) {
|
|
|
|
|
case 2:{$dateform = '%Y-%m';};break;
|
|
|
|
|
case 3:{$dateform = '%Y-%u';};break;
|
|
|
|
|
case 4:{$dateform = '%Y';};break;
|
|
|
|
|
case 5:{$dateform = '%Y-%m-%d %H';};break;
|
|
|
|
|
default:$dateform = '%Y-%m-%d';
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%u';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m-%d %H';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$dateform = '%Y-%m-%d';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$data = $this->field('FROM_UNIXTIME(pay_time,"' . $dateform . '") as ' . $group . ',count( DISTINCT user_id) as ' . $fieldname)
|
|
|
|
|
|
|
|
|
|
->where($map)->group($group)->order($order)->select();
|
|
|
|
|
|
|
|
|
|
return $data;
|
|
|
|
@ -612,14 +671,32 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @return array 详细数据
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function totalPlayerByTime($start,$end,$fieldname='count',$group='time',$flag=1,$order='time') {
|
|
|
|
|
public function totalPlayerByTime($start, $end, $fieldname = 'count', $group = 'time', $flag = 1, $order = 'time')
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
switch ($flag) {
|
|
|
|
|
case 2:{$dateform = '%Y-%m';};break;
|
|
|
|
|
case 3:{$dateform = '%Y-%u';};break;
|
|
|
|
|
case 4:{$dateform = '%Y';};break;
|
|
|
|
|
case 5:{$dateform = '%Y-%m-%d %H';};break;
|
|
|
|
|
default:$dateform = '%Y-%m-%d';
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%u';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
$dateform = '%Y-%m-%d %H';
|
|
|
|
|
};
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$dateform = '%Y-%m-%d';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
@ -637,9 +714,7 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
$map['pay_time'] = ['between', [$start, $end]];
|
|
|
|
|
|
|
|
|
|
$lists = $this->field('FROM_UNIXTIME(pay_time,"' . $dateform . '") as ' . $group . ',GROUP_CONCAT( DISTINCT user_id) as user_id')
|
|
|
|
|
|
|
|
|
|
->union(' (' . $bindrecharge_data . ') ')->union(' (' . $deposit_data . ') ')
|
|
|
|
|
|
|
|
|
|
->where($map)->group($group)->select(false);
|
|
|
|
|
|
|
|
|
|
$lists = $this->field('a.' . $group . ',GROUP_CONCAT(a.user_id) as user_id')->table(' (' . $lists . ') as a')->group('a.' . $group)->order('a.' . $order)->select();
|
|
|
|
@ -663,12 +738,12 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @param array $map 条件数组
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function player($map=array()) {
|
|
|
|
|
public function player($map = array())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
|
$data = $this->field('count( DISTINCT user_id) as count')
|
|
|
|
|
|
|
|
|
|
->where($map)->select();
|
|
|
|
|
|
|
|
|
|
return $data[0] ? $data[0]['count'] : 0;
|
|
|
|
@ -680,12 +755,12 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
* @param array $map 条件数组
|
|
|
|
|
* @author 鹿文学
|
|
|
|
|
*/
|
|
|
|
|
public function amount($map=array()) {
|
|
|
|
|
public function amount($map = array())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$map['pay_status'] = 1;
|
|
|
|
|
|
|
|
|
|
$data = $this
|
|
|
|
|
|
|
|
|
|
->where($map)->sum('pay_amount');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -701,12 +776,12 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
*
|
|
|
|
|
* @return mixed
|
|
|
|
|
*
|
|
|
|
|
* @author: 鹿文学[lwx]<fyj301415926@126.com>
|
|
|
|
|
* @since: 2019\4\11 0011 13:40
|
|
|
|
|
* @throws \think\Exception
|
|
|
|
|
* @throws \think\db\exception\DataNotFoundException
|
|
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
|
|
* @throws \think\exception\DbException
|
|
|
|
|
* @author: 鹿文学[lwx]<fyj301415926@126.com>
|
|
|
|
|
* @since: 2019\4\11 0011 13:40
|
|
|
|
|
*/
|
|
|
|
|
public function lists($p = 1, $map = array(), $order, $field = true)
|
|
|
|
|
{
|
|
|
|
@ -735,7 +810,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
/**
|
|
|
|
|
* 获取统计 $map,$page,$row
|
|
|
|
|
*/
|
|
|
|
|
public function getSpendData($map=[],$field='',$group='',$order='',$page = 0,$row = 0) {
|
|
|
|
|
public function getSpendData($map = [], $field = '', $group = '', $order = '', $page = 0, $row = 0)
|
|
|
|
|
{
|
|
|
|
|
if ($row == 0) {
|
|
|
|
|
$data = $this->field($field)->where($map)->group($group)->order($order)->select();
|
|
|
|
|
} else {
|
|
|
|
@ -745,7 +821,8 @@ protected function _after_select(&$result,$options){
|
|
|
|
|
return $data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function sumSpend($map=[],$field='') {
|
|
|
|
|
public function sumSpend($map = [], $field = '')
|
|
|
|
|
{
|
|
|
|
|
$sum = $this->where($map)->sum($field);
|
|
|
|
|
|
|
|
|
|
return $sum;
|
|
|
|
|