|
@@ -41,7 +41,7 @@ class UserExtract extends BaseModel
|
|
|
* @param $uid
|
|
* @param $uid
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
- public static function userExtractTotalPrice($uid, $status = 1, $where = [])
|
|
|
|
|
|
|
+ public static function userExtractTotalPrice($uid, $status = EXTRACT_SUC, $where = [])
|
|
|
{
|
|
{
|
|
|
return self::getModelTime($where, self::where('uid', 'in', $uid)->where('status', $status))->sum('extract_price') ?: 0;
|
|
return self::getModelTime($where, self::where('uid', 'in', $uid)->where('status', $status))->sum('extract_price') ?: 0;
|
|
|
}
|
|
}
|
|
@@ -49,7 +49,7 @@ class UserExtract extends BaseModel
|
|
|
public static function extractStatistics()
|
|
public static function extractStatistics()
|
|
|
{
|
|
{
|
|
|
//待提现金额
|
|
//待提现金额
|
|
|
- $data['price'] = floatval(self::where('status', 0)->sum('extract_price'));
|
|
|
|
|
|
|
+ $data['price'] = floatval(self::where('status', EXTRACT_AUDITING)->sum('extract_price'));
|
|
|
//总获得
|
|
//总获得
|
|
|
$sum = UserBill::getBrokerageCount();
|
|
$sum = UserBill::getBrokerageCount();
|
|
|
//退款扣除
|
|
//退款扣除
|
|
@@ -57,7 +57,7 @@ class UserExtract extends BaseModel
|
|
|
//佣金总金额
|
|
//佣金总金额
|
|
|
$data['brokerage_count'] = $sum > $lose ? floatval($sum - $lose) : 0;
|
|
$data['brokerage_count'] = $sum > $lose ? floatval($sum - $lose) : 0;
|
|
|
//已提现金额
|
|
//已提现金额
|
|
|
- $data['priced'] = floatval(self::where('status', 1)->sum('extract_price'));
|
|
|
|
|
|
|
+ $data['priced'] = floatval(self::where('status', EXTRACT_SUC)->sum('extract_price'));
|
|
|
//未提现金额
|
|
//未提现金额
|
|
|
$data['brokerage_not'] = bcsub(bcsub($data['brokerage_count'], $data['priced'], 2), $data['price'], 2);
|
|
$data['brokerage_not'] = bcsub(bcsub($data['brokerage_count'], $data['priced'], 2), $data['price'], 2);
|
|
|
return compact('data');
|
|
return compact('data');
|
|
@@ -92,7 +92,7 @@ class UserExtract extends BaseModel
|
|
|
$extract_number = $data['extract_price'];
|
|
$extract_number = $data['extract_price'];
|
|
|
$mark = '提现失败,退回佣金' . $extract_number . '元';
|
|
$mark = '提现失败,退回佣金' . $extract_number . '元';
|
|
|
$uid = $data['uid'];
|
|
$uid = $data['uid'];
|
|
|
- $status = -1;
|
|
|
|
|
|
|
+ $status = EXTRACT_FAILED;
|
|
|
$User = User::where('uid', $uid)->find()->toArray();
|
|
$User = User::where('uid', $uid)->find()->toArray();
|
|
|
UserBill::income('提现失败', $uid, 'now_money', 'extract', $extract_number, $id, bcadd($User['now_money'], $extract_number, 2), $mark);
|
|
UserBill::income('提现失败', $uid, 'now_money', 'extract', $extract_number, $id, bcadd($User['now_money'], $extract_number, 2), $mark);
|
|
|
User::bcInc($uid, 'brokerage_price', $extract_number, 'uid');
|
|
User::bcInc($uid, 'brokerage_price', $extract_number, 'uid');
|
|
@@ -154,7 +154,7 @@ class UserExtract extends BaseModel
|
|
|
], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
|
|
], Url::buildUrl('/user/cashrecord')->suffix('')->domain(true)->build());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- return self::edit(['status' => 1], $id);
|
|
|
|
|
|
|
+ return self::edit(['status' => EXTRACT_SUC], $id);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//测试数据
|
|
//测试数据
|
|
@@ -173,7 +173,7 @@ class UserExtract extends BaseModel
|
|
|
'extract_price' => rand(100, 9999),
|
|
'extract_price' => rand(100, 9999),
|
|
|
'mark' => '测试数据',
|
|
'mark' => '测试数据',
|
|
|
'add_time' => time(),
|
|
'add_time' => time(),
|
|
|
- 'status' => 1,
|
|
|
|
|
|
|
+ 'status' => EXTRACT_SUC,
|
|
|
'wechat' => rand(999, 878788) . $item['uid'],
|
|
'wechat' => rand(999, 878788) . $item['uid'],
|
|
|
];
|
|
];
|
|
|
self::create($data);
|
|
self::create($data);
|
|
@@ -184,23 +184,23 @@ class UserExtract extends BaseModel
|
|
|
public static function getExtractHead()
|
|
public static function getExtractHead()
|
|
|
{
|
|
{
|
|
|
//本月提现人数
|
|
//本月提现人数
|
|
|
- $month = self::getModelTime(['data' => 'month'], self::where('status', 1))->group('uid')->count();
|
|
|
|
|
|
|
+ $month = self::getModelTime(['data' => 'month'], self::where('status', EXTRACT_SUC))->group('uid')->count();
|
|
|
//本月提现笔数
|
|
//本月提现笔数
|
|
|
- $new_month = self::getModelTime(['data' => 'month'], self::where('status', 1))->distinct(true)->count();
|
|
|
|
|
|
|
+ $new_month = self::getModelTime(['data' => 'month'], self::where('status', EXTRACT_SUC))->distinct(true)->count();
|
|
|
//上月提现人数
|
|
//上月提现人数
|
|
|
- $last_month = self::whereTime('add_time', 'last month')->where('status', 1)->group('uid')->distinct(true)->count();
|
|
|
|
|
|
|
+ $last_month = self::whereTime('add_time', 'last month')->where('status', EXTRACT_SUC)->group('uid')->distinct(true)->count();
|
|
|
//上月提现笔数
|
|
//上月提现笔数
|
|
|
- $last_count = self::whereTime('add_time', 'last month')->where('status', 1)->count();
|
|
|
|
|
|
|
+ $last_count = self::whereTime('add_time', 'last month')->where('status', EXTRACT_SUC)->count();
|
|
|
//本月提现金额
|
|
//本月提现金额
|
|
|
- $extract_price = self::getModelTime(['data' => 'month'], self::where('status', 1))->sum('extract_price');
|
|
|
|
|
|
|
+ $extract_price = self::getModelTime(['data' => 'month'], self::where('status', EXTRACT_SUC))->sum('extract_price');
|
|
|
//上月提现金额
|
|
//上月提现金额
|
|
|
- $last_extract_price = self::whereTime('add_time', 'last month')->where('status', 1)->sum('extract_price');
|
|
|
|
|
|
|
+ $last_extract_price = self::whereTime('add_time', 'last month')->where('status', EXTRACT_SUC)->sum('extract_price');
|
|
|
|
|
|
|
|
return [
|
|
return [
|
|
|
[
|
|
[
|
|
|
'name' => '总提现人数',
|
|
'name' => '总提现人数',
|
|
|
'field' => '个',
|
|
'field' => '个',
|
|
|
- 'count' => self::where('status', 1)->group('uid')->count(),
|
|
|
|
|
|
|
+ 'count' => self::where('status', EXTRACT_SUC)->group('uid')->count(),
|
|
|
'content' => '',
|
|
'content' => '',
|
|
|
'background_color' => 'layui-bg-blue',
|
|
'background_color' => 'layui-bg-blue',
|
|
|
'sum' => '',
|
|
'sum' => '',
|
|
@@ -209,7 +209,7 @@ class UserExtract extends BaseModel
|
|
|
[
|
|
[
|
|
|
'name' => '总提现笔数',
|
|
'name' => '总提现笔数',
|
|
|
'field' => '笔',
|
|
'field' => '笔',
|
|
|
- 'count' => self::where('status', 1)->distinct(true)->count(),
|
|
|
|
|
|
|
+ 'count' => self::where('status', EXTRACT_SUC)->distinct(true)->count(),
|
|
|
'content' => '',
|
|
'content' => '',
|
|
|
'background_color' => 'layui-bg-cyan',
|
|
'background_color' => 'layui-bg-cyan',
|
|
|
'sum' => '',
|
|
'sum' => '',
|
|
@@ -239,7 +239,7 @@ class UserExtract extends BaseModel
|
|
|
'count' => $extract_price,
|
|
'count' => $extract_price,
|
|
|
'content' => '提现总金额',
|
|
'content' => '提现总金额',
|
|
|
'background_color' => 'layui-bg-cyan',
|
|
'background_color' => 'layui-bg-cyan',
|
|
|
- 'sum' => self::where('status', 1)->sum('extract_price'),
|
|
|
|
|
|
|
+ 'sum' => self::where('status', EXTRACT_SUC)->sum('extract_price'),
|
|
|
'class' => 'fa fa-line-chart',
|
|
'class' => 'fa fa-line-chart',
|
|
|
],
|
|
],
|
|
|
[
|
|
[
|
|
@@ -276,7 +276,7 @@ class UserExtract extends BaseModel
|
|
|
public static function getExtractList($where, $limit = 15)
|
|
public static function getExtractList($where, $limit = 15)
|
|
|
{
|
|
{
|
|
|
$legdata = ['提现人数', '提现金额'];
|
|
$legdata = ['提现人数', '提现金额'];
|
|
|
- $list = self::getModelTime($where, self::where('status', 1))
|
|
|
|
|
|
|
+ $list = self::getModelTime($where, self::where('status', EXTRACT_SUC))
|
|
|
->field('FROM_UNIXTIME(add_time,"%Y-%c-%d") as un_time,count(uid) as count,sum(extract_price) as sum_price')->group('un_time')->order('un_time asc')->select();
|
|
->field('FROM_UNIXTIME(add_time,"%Y-%c-%d") as un_time,count(uid) as count,sum(extract_price) as sum_price')->group('un_time')->order('un_time asc')->select();
|
|
|
if (count($list)) $list = $list->toArray();
|
|
if (count($list)) $list = $list->toArray();
|
|
|
$xdata = [];
|
|
$xdata = [];
|
|
@@ -298,10 +298,10 @@ class UserExtract extends BaseModel
|
|
|
if (count($xdata) > $limit) $zoom = $xdata[$limit - 5];
|
|
if (count($xdata) > $limit) $zoom = $xdata[$limit - 5];
|
|
|
//饼状图
|
|
//饼状图
|
|
|
$cake = ['支付宝', '银行卡', '微信'];
|
|
$cake = ['支付宝', '银行卡', '微信'];
|
|
|
- $fenbulist = self::getModelTime($where, self::where('status', 1))
|
|
|
|
|
|
|
+ $fenbulist = self::getModelTime($where, self::where('status', EXTRACT_SUC))
|
|
|
->field('count(uid) as count,extract_type')->group('extract_type')->order('count asc')->select();
|
|
->field('count(uid) as count,extract_type')->group('extract_type')->order('count asc')->select();
|
|
|
if (count($fenbulist)) $fenbulist = $fenbulist->toArray();
|
|
if (count($fenbulist)) $fenbulist = $fenbulist->toArray();
|
|
|
- $sum_count = self::getModelTime($where, self::where('status', 1))->count();
|
|
|
|
|
|
|
+ $sum_count = self::getModelTime($where, self::where('status', EXTRACT_SUC))->count();
|
|
|
$color = ['#FB7773', '#81BCFE', '#91F3FE'];
|
|
$color = ['#FB7773', '#81BCFE', '#91F3FE'];
|
|
|
$fenbudata = [];
|
|
$fenbudata = [];
|
|
|
foreach ($fenbulist as $key => $item) {
|
|
foreach ($fenbulist as $key => $item) {
|
|
@@ -327,7 +327,7 @@ class UserExtract extends BaseModel
|
|
|
public static function getUserCountPrice($uid = 0)
|
|
public static function getUserCountPrice($uid = 0)
|
|
|
{
|
|
{
|
|
|
if (!$uid) return 0;
|
|
if (!$uid) return 0;
|
|
|
- $price = self::where('uid', $uid)->where('status', 1)->sum('extract_price');
|
|
|
|
|
|
|
+ $price = self::where('uid', $uid)->where('status', EXTRACT_SUC)->sum('extract_price');
|
|
|
return $price ? $price : 0;
|
|
return $price ? $price : 0;
|
|
|
}
|
|
}
|
|
|
|
|
|