feat: 添加新的支付方式统计功能
fix: 修复商品退款金额统计错误的bug refactor: 重构代码,优化代码结构 style: 代码风格优化,添加缺失的分号 test: 添加商品退款金额的测试 docs: 更新商品退款金额的文档说明 build: 更新项目依赖 ops: 更新部署脚本 chore: 更新项目版本
This commit is contained in:
parent
3bdd52e460
commit
e721b96263
@ -41,7 +41,7 @@ class WorkbenchController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
/**
|
||||
* @notes 工作台
|
||||
* @notes 门店
|
||||
* @author 乔峰
|
||||
* @date 2021/12/29 17=>01
|
||||
*/
|
||||
|
@ -3,8 +3,10 @@
|
||||
namespace app\admin\logic\statistic;
|
||||
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\store_finance_flow\StoreFinanceFlow;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user_recharge\UserRecharge;
|
||||
use app\common\model\user_sign\UserSign;
|
||||
|
||||
/**
|
||||
* Class 交易数据
|
||||
@ -282,16 +284,7 @@ class TradeStatisticLogic extends BaseLogic
|
||||
$lastOutYeOrderMoney = $this->getOrderTotalMoney(['pay_type' => 3, 'create_time' => $dateWhere['create_time']], 'sum', "", $isNum);
|
||||
$outYeOrderCurve = $this->getOrderTotalMoney(['pay_type' => 3, 'create_time' => $where['create_time']], 'group', 'create_time');
|
||||
$outYeOrderChain = countRate($outYeOrderMoney, $lastOutYeOrderMoney);
|
||||
//余额购买会员
|
||||
// $outYeMemberMoney = $this->getMemberTotalMoney(['pay_type' => "yue", 'time' => $where['time']], 'sum');
|
||||
// $lastOutYeMemberMoney = $this->getMemberTotalMoney(['pay_type' => "yue", 'time' => $dateWhere['time']], 'sum', "", $isNum);
|
||||
// $outYeMemberCurve = $this->getMemberTotalMoney(['pay_type' => "yue", 'time' => $where['time']], 'group', "pay_time");
|
||||
// $outYeMemberChain = countRate($outYeMemberMoney, $lastOutYeMemberMoney);
|
||||
//余额支付
|
||||
// $outYeMoney = bcadd($outYeOrderMoney, $outYeMemberMoney, 2);
|
||||
// $lastOutYeMoney = bcadd($lastOutYeOrderMoney, $lastOutYeMemberMoney, 2);
|
||||
// $outYeCurve = $this->totalArrData([$outYeOrderCurve, $outYeMemberCurve]);
|
||||
// $outYeChain = countRate($outYeOrderChain, $outYeMemberChain);
|
||||
$outYeMoney = $outYeOrderMoney;
|
||||
$lastOutYeMoney = $lastOutYeOrderMoney;
|
||||
$outYeCurve = $this->totalArrData([$outYeOrderCurve, 0]);
|
||||
@ -307,27 +300,10 @@ class TradeStatisticLogic extends BaseLogic
|
||||
];
|
||||
$Chain['out_ye'] = $outYeCurve;
|
||||
|
||||
|
||||
//支付佣金金额
|
||||
// $outExtractMoney = $this->getExtractTotalMoney($where, 'sum');
|
||||
// $lastOutExtractMoney = $this->getExtractTotalMoney($dateWhere, 'sum', "", $isNum);
|
||||
// $OutExtractCurve = $this->getExtractTotalMoney($where, 'group', "add_time");
|
||||
// $OutExtractChain = countRate($outExtractMoney, $lastOutExtractMoney);
|
||||
// $topData[8] = [
|
||||
// 'title' => '支付佣金金额',
|
||||
// 'desc' => '后台给推广员支付的推广佣金,以实际支付为准',
|
||||
// 'total_money' => $outExtractMoney,
|
||||
// 'rate' => $OutExtractChain,
|
||||
// 'value' => $OutExtractCurve['y'],
|
||||
// 'type' => 0,
|
||||
// 'sign' => 'yong',
|
||||
// ];
|
||||
// $Chain['extract'] = $OutExtractCurve;
|
||||
|
||||
//商品退款金额
|
||||
$outOrderRefund = $this->getOrderRefundTotalMoney(['refund_type' => 6, 'create_time' => $where['create_time']], 'sum');
|
||||
$lastOutOrderRefund = $this->getOrderRefundTotalMoney(['refund_type' => 6, 'create_time' => $dateWhere['create_time']], 'sum', "", $isNum);
|
||||
$outOrderRefundCurve = $this->getOrderRefundTotalMoney(['refund_type' => 6, 'create_time' => $where['create_time']], 'group', 'create_time');
|
||||
$outOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'sum');
|
||||
$lastOutOrderRefund = $this->getOrderRefundTotalMoney(['create_time' => $dateWhere['create_time']], 'sum', "", $isNum);
|
||||
$outOrderRefundCurve = $this->getOrderRefundTotalMoney(['create_time' => $where['create_time']], 'group', 'create_time');
|
||||
$orderRefundChain = countRate($outOrderRefund, $lastOutOrderRefund);
|
||||
$topData[9] = [
|
||||
'title' => '商品退款金额',
|
||||
@ -379,6 +355,72 @@ class TradeStatisticLogic extends BaseLogic
|
||||
// ];
|
||||
// $Chain['jiaoyi'] = $jiaoyiCurve;
|
||||
|
||||
//兑换礼品券
|
||||
$userSign = $this->getUserSign($where, 'sum');
|
||||
$userSignTwo = $this->getUserSign($where, 'sum', "", $isNum);
|
||||
$userSignGroup = $this->getUserSign($where, 'group', "create_time");
|
||||
$userSignRate = countRate($userSign, $userSignTwo);
|
||||
$topData[8] = [
|
||||
'title' => '兑换礼品券',
|
||||
'desc' => '后台给推广员支付的兑换礼品券,以实际支付为准',
|
||||
'total_money' => $userSign,
|
||||
'rate' => $userSignRate,
|
||||
'value' => $userSignGroup['y'],
|
||||
'type' => 1,
|
||||
'sign' => 'user_sign',
|
||||
];
|
||||
$Chain['user_sign'] = $userSignGroup;
|
||||
|
||||
//保证金金额
|
||||
$depositWehre = $where;
|
||||
$depositWehre['financial_type'] = 11;
|
||||
$orderDepositMoney = $this->getFinanceFlow($depositWehre, "sum");
|
||||
$lastOrderDepositMoney = $this->getFinanceFlow($dateWhere, "sum", "", $isNum);
|
||||
$OrderDepositCurve = $this->getFinanceFlow($where, "group", "create_time");
|
||||
$OrderDepositChain = countRate($orderDepositMoney, $lastOrderDepositMoney);
|
||||
|
||||
$topData[10] = [
|
||||
'title' => '保证金金额',
|
||||
'desc' => '门店未交满,订单扣除的保证金',
|
||||
'total_money' => $orderDepositMoney,
|
||||
'rate' => $OrderDepositChain,
|
||||
'value' => $OrderDepositCurve['y'],
|
||||
'type' => 1,
|
||||
'sign' => 'deposit',
|
||||
];
|
||||
$Chain['deposit'] = $OrderDepositCurve;
|
||||
|
||||
//微信支付商品
|
||||
$wechatOrderMoney = $this->getOrderTotalMoney(['pay_type' => [7, 9], 'create_time' => $where['create_time']], 'sum');
|
||||
$lastWechatOrderMoney = $this->getOrderTotalMoney(['pay_type' => [7, 9], 'create_time' => $dateWhere['create_time']], 'sum', "", $isNum);
|
||||
$wechatOrderCurve = $this->getOrderTotalMoney(['pay_type' => [7, 9], 'create_time' => $where['create_time']], 'group', 'create_time');
|
||||
$wechatOrderChain = countRate($wechatOrderMoney, $lastWechatOrderMoney);
|
||||
$topData[11] = [
|
||||
'title' => '微信支付金额',
|
||||
'desc' => '用户下单时使用微信实际支付的金额',
|
||||
'total_money' => $wechatOrderMoney,
|
||||
'rate' => $wechatOrderChain,
|
||||
'value' => $wechatOrderCurve['y'],
|
||||
'type' => 1,
|
||||
'sign' => 'wechat',
|
||||
];
|
||||
$Chain['wechat'] = $wechatOrderCurve;
|
||||
|
||||
//支付宝支付商品
|
||||
$aliPayOrderMoney = $this->getOrderTotalMoney(['pay_type' =>13, 'create_time' => $where['create_time']], 'sum');
|
||||
$lastAlipayOrderMoney = $this->getOrderTotalMoney(['pay_type' => 13, 'create_time' => $dateWhere['create_time']], 'sum', "", $isNum);
|
||||
$aliPayOrderCurve = $this->getOrderTotalMoney(['pay_type' =>13, 'create_time' => $where['create_time']], 'group', 'create_time');
|
||||
$aliPayOrderChain = countRate($aliPayOrderMoney, $lastAlipayOrderMoney);
|
||||
$topData[12] = [
|
||||
'title' => '支付宝支付金额',
|
||||
'desc' => '用户下单时使用支付宝实际支付的金额',
|
||||
'total_money' => $aliPayOrderMoney,
|
||||
'rate' => $aliPayOrderChain,
|
||||
'value' => $aliPayOrderCurve['y'],
|
||||
'type' => 1,
|
||||
'sign' => 'ali_pay',
|
||||
];
|
||||
$Chain['ali_pay'] = $aliPayOrderCurve;
|
||||
/** @var 营业额 $inTotalMoney */
|
||||
$inTotalMoney = $this->tradeTotalMoney($where, "sum");
|
||||
$lastInTotalMoney = $this->tradeTotalMoney($dateWhere, "sum", $isNum);
|
||||
@ -476,21 +518,22 @@ class TradeStatisticLogic extends BaseLogic
|
||||
{
|
||||
$storeOrder = new StoreOrder();
|
||||
$orderSumField = "pay_price";
|
||||
$where[] = ['refund_status', '>', 0];
|
||||
$whereOrder[] = ['refund_status', '>', 0];
|
||||
$whereOrder['refund_type'] = 6;
|
||||
$timeKey = $this->TimeConvert($where['create_time'], $isNum);
|
||||
$where['timeKey'] = $timeKey;
|
||||
// $where['is_cancel'] = 0;
|
||||
switch ($selectType) {
|
||||
case "sum":
|
||||
$totalMoney = $storeOrder->where($where)->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$totalMoney = $storeOrder->where($whereOrder)->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('create_time', strtotime($where['timeKey']['start_time']), strtotime($where['timeKey']['end_time']));
|
||||
})->sum($orderSumField);
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $storeOrder->where($where)->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('create_time', strtotime($where['timeKey']['start_time']), strtotime($where['timeKey']['end_time']));
|
||||
})->count($orderSumField);
|
||||
$totalMoney = $storeOrder->getCurveData($whereOrder, $where, 'count(pay_price)');
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('getOrderTotalMoney:selectType参数错误');
|
||||
throw new \Exception('getOrderRefundTotalMoney:selectType参数错误');
|
||||
}
|
||||
if ($group) {
|
||||
$totalMoney = $this->trendYdata((array)$totalMoney, $this->TimeConvert($where['create_time'], $isNum));
|
||||
@ -498,6 +541,72 @@ class TradeStatisticLogic extends BaseLogic
|
||||
return $totalMoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取兑换卷
|
||||
* @param $where
|
||||
* @param string $selectType
|
||||
* @param string $group
|
||||
* @param bool $isNum
|
||||
* @return array|float|int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getUserSign($where, string $selectType, string $group = '', bool $isNum = false)
|
||||
{
|
||||
$UserSign = new UserSign();
|
||||
$orderSumField = "number";
|
||||
$whereUserSign = ['financial_pm' => 1];
|
||||
$timeKey = $this->TimeConvert($where['create_time'], $isNum);
|
||||
$where['timeKey'] = $timeKey;
|
||||
switch ($selectType) {
|
||||
case "sum":
|
||||
$totalMoney = $UserSign->where($whereUserSign)->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('create_time', strtotime($where['timeKey']['start_time']), strtotime($where['timeKey']['end_time']));
|
||||
})->sum($orderSumField);
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $UserSign->getCurveData($whereUserSign, $where, 'count(number)');
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('getUserSign:selectType参数错误');
|
||||
}
|
||||
if ($group) {
|
||||
$totalMoney = $this->trendYdata((array)$totalMoney, $this->TimeConvert($where['create_time'], $isNum));
|
||||
}
|
||||
return $totalMoney;
|
||||
}
|
||||
|
||||
/**
|
||||
* 财务流水
|
||||
* @param $where
|
||||
* @param string $selectType
|
||||
* @param string $group
|
||||
* @param bool $isNum
|
||||
* @return array|float|int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getFinanceFlow($where, string $selectType, string $group = '', bool $isNum = false)
|
||||
{
|
||||
$store_finance_flow = new StoreFinanceFlow();
|
||||
$timeKey = $this->TimeConvert($where['create_time'], $isNum);
|
||||
unset($where['create_time']);
|
||||
$time['timeKey'] = $timeKey;
|
||||
switch ($selectType) {
|
||||
case "sum":
|
||||
$totalMoney = $store_finance_flow->where($where)->when(isset($time['timeKey']), function ($query) use ($time) {
|
||||
$query->whereBetweenTime('create_time', strtotime($time['timeKey']['start_time']), strtotime($time['timeKey']['end_time']));
|
||||
})->sum('number');
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $store_finance_flow->getCurveData($where, $time, 'count(number)');
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('getFinanceFlow:selectType参数错误');
|
||||
}
|
||||
if ($group) {
|
||||
$totalMoney = $this->trendYdata((array)$totalMoney, $this->TimeConvert($where['create_time'], $isNum));
|
||||
}
|
||||
return $totalMoney;
|
||||
}
|
||||
/**
|
||||
* 获取商品营收
|
||||
* @param $where
|
||||
@ -511,37 +620,20 @@ class TradeStatisticLogic extends BaseLogic
|
||||
{
|
||||
/** 普通商品订单支付金额 */
|
||||
$storeOrder = new StoreOrder();
|
||||
$whereOrderMoner['refund_status'] = isset($where['refund_status']) ? $where['refund_status'] : [0, 3];
|
||||
$whereOrderMoner['paid'] = 1;
|
||||
$where['refund_status'] = isset($where['refund_status']) ? $where['refund_status'] : [0, 3];
|
||||
$where['paid'] = 1;
|
||||
|
||||
$timeKey = $this->TimeConvert($where['create_time'], $isNum);
|
||||
$where['timeKey'] = $timeKey;
|
||||
unset($where['create_time']);
|
||||
$time['timeKey'] = $timeKey;
|
||||
switch ($selectType) {
|
||||
case "sum":
|
||||
$totalMoney = $storeOrder->where($whereOrderMoner)->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('create_time', strtotime($where['timeKey']['start_time']), strtotime($where['timeKey']['end_time']));
|
||||
$totalMoney = $storeOrder->where($where)->when(isset($time['timeKey']), function ($query) use ($time) {
|
||||
$query->whereBetweenTime('create_time', strtotime($time['timeKey']['start_time']), strtotime($time['timeKey']['end_time']));
|
||||
})->sum('pay_price');
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $storeOrder->where($whereOrderMoner)->when(isset($where['timeKey']), function ($query) use ($where, $group) {
|
||||
$query->whereBetweenTime('create_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($where['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($where['timeKey']['days'] > 1 && $where['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] > 30 && $where['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("sum(pay_price) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order('create_time ASC')->select()->toArray();
|
||||
$totalMoney = $storeOrder->getCurveData($where, $time, 'count(pay_price)', $group);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('getOrderTotalMoney:selectType参数错误');
|
||||
@ -580,26 +672,7 @@ class TradeStatisticLogic extends BaseLogic
|
||||
->sum($rechargeSumField);
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $userRechage->where(['paid' => 1])
|
||||
->when(isset($where['create_time']), function ($query) use ($where, $rechargeSumField, $group) {
|
||||
$query->whereBetweenTime('create_time', strtotime($where['timeKey']['start_time']), strtotime($where['timeKey']['end_time']));
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($where['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($where['timeKey']['days'] > 1 && $where['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] > 30 && $where['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("sum($rechargeSumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order('time ASC')->select()->toArray();
|
||||
$totalMoney = $userRechage->getCurveData(['paid' => 1], $where, 'count(price)', $group);
|
||||
break;
|
||||
default:
|
||||
$totalMoney = 0.00;
|
||||
@ -694,28 +767,10 @@ class TradeStatisticLogic extends BaseLogic
|
||||
})->sum($offlineSumField);
|
||||
break;
|
||||
case "group":
|
||||
$totalMoney = $storeOrder->where('pay_type', 'in', [9, 13, 17])->when(isset($where['timeKey']), function ($query) use ($where, $group) {
|
||||
$query->whereBetweenTime('create_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($where['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($where['timeKey']['days'] > 1 && $where['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] > 30 && $where['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("sum(pay_price) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order('time ASC')->select()->toArray();
|
||||
$totalMoney = $storeOrder->getCurveData(['pay_type' => ['in' => [9, 13, 17]]], $where, 'count(pay_price)', $group);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception('getOrderTotalMoney:selectType参数错误');
|
||||
throw new \Exception('getOfflineTotalMoney:selectType参数错误');
|
||||
}
|
||||
if ($group) {
|
||||
$totalMoney = $this->trendYdata((array)$totalMoney, $this->TimeConvert($where['create_time'], $isNum));
|
||||
|
@ -32,4 +32,35 @@ class BaseModel extends Model
|
||||
{
|
||||
return trim($value) ? FileService::setFileUrl($value) : '';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 曲线统计
|
||||
* @param $time
|
||||
* @param $type
|
||||
* @param $timeType
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCurveData($where, $time, $str, string $group = 'create_time')
|
||||
{
|
||||
return $this->where($where)
|
||||
->when(isset($time['timeKey']), function ($query) use ($time, $str, $group) {
|
||||
$query->whereBetweenTime($group, $time['timeKey']['start_time'], $time['timeKey']['end_time']);
|
||||
if ($time['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($time['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($time['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($time['timeKey']['days'] > 1 && $time['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($time['timeKey']['days'] > 30 && $time['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("$str as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order("$group ASC")->select()->toArray();
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,11 @@ class StoreOrder extends BaseModel
|
||||
use SoftDelete;
|
||||
protected $name = 'store_order';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
public function getPayTimeAttr($value)
|
||||
{
|
||||
|
||||
return $value?date('Y-m-d H:i:s', $value):'';
|
||||
}
|
||||
public function store()
|
||||
{
|
||||
return $this->hasOne(SystemStore::class, 'id', 'store_id')
|
||||
@ -85,34 +89,4 @@ class StoreOrder extends BaseModel
|
||||
})->field("FROM_UNIXTIME(create_time,'$timeType') as days,$str as num")
|
||||
->group('days')->select()->toArray();
|
||||
}
|
||||
/**
|
||||
* 曲线统计
|
||||
* @param $time
|
||||
* @param $type
|
||||
* @param $timeType
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCurveData($where,$time,$str)
|
||||
{
|
||||
return $this->where($where)
|
||||
->when(isset($time['timeKey']), function ($query) use ($time,$str) {
|
||||
$query->whereBetweenTime('create_time', $time['timeKey']['start_time'], $time['timeKey']['end_time']);
|
||||
if ($time['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($time['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($time['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($time['timeKey']['days'] > 1 && $time['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($time['timeKey']['days'] > 30 && $time['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("$str as number,FROM_UNIXTIME(create_time, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME(create_time, '$timeUinx')");
|
||||
})
|
||||
->order('create_time ASC')->select()->toArray();
|
||||
}
|
||||
}
|
||||
|
@ -18,5 +18,4 @@ class UserSign extends BaseModel
|
||||
protected $name = 'user_sign';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user