no message
This commit is contained in:
parent
e2d2838200
commit
50c8987a25
@ -103,6 +103,33 @@ final class HookController
|
||||
http_response_code(200);exit;
|
||||
}
|
||||
|
||||
// 命令列表
|
||||
// /cmdList
|
||||
if (strpos($sText, '/cmdList') === 0 || strpos($sText, '\/cmdList') === 0) {
|
||||
|
||||
$aCmdList = [
|
||||
'流量报告' => '/reportWidth',
|
||||
'查找用户' => '//userFind 11',
|
||||
'查找订单' => '/orderFindByUser 11',
|
||||
'回复工单' => '/reply 11 + /s 你好',
|
||||
'快捷回复工单' => '/ry 11 你好',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
'查找用户' => '/userFind',
|
||||
];
|
||||
|
||||
$this->sendMessage(json_encode($aCmdList, JSON_PRETTY_PRINT));
|
||||
|
||||
Http::response(200, 'ok');
|
||||
|
||||
}
|
||||
|
||||
// 流量报告
|
||||
// /reportWidth
|
||||
if (strpos($sText, '/reportWidth') === 0 || strpos($sText, '\/reportWidth') === 0) {
|
||||
@ -116,6 +143,7 @@ final class HookController
|
||||
}
|
||||
|
||||
// 查找用户
|
||||
// /userFind 11
|
||||
if (strpos($sText, '/userFind') === 0 || strpos($sText, '\/userFind') === 0) {
|
||||
|
||||
list(, $iUserId) = explode(" ", $sText, 2);
|
||||
@ -146,6 +174,7 @@ final class HookController
|
||||
}
|
||||
|
||||
// 查找订单
|
||||
// orderFindByUser 11
|
||||
if (strpos($sText, '/orderFindByUser') === 0 || strpos($sText, '\/orderFindByUser') === 0) {
|
||||
|
||||
list(, $iUserId) = explode(" ", $sText, 2);
|
||||
@ -171,6 +200,7 @@ final class HookController
|
||||
}
|
||||
|
||||
// 回复工单
|
||||
// /reply 11 + /s 你好
|
||||
if (strpos($sText, '/reply') === 0) {
|
||||
|
||||
// 先清除一遍,只进行一个进程
|
||||
@ -190,6 +220,7 @@ final class HookController
|
||||
}
|
||||
|
||||
// 快捷回复工单
|
||||
// /ry 11 你好
|
||||
if (strpos($sText, '/ry') === 0) {
|
||||
|
||||
$sText = $this->trimText($sText, '/ry');
|
||||
@ -224,6 +255,7 @@ final class HookController
|
||||
}
|
||||
|
||||
// 用户报表
|
||||
// /reportUser_day 7 && /
|
||||
if (strpos($sText, '/reportUser_') === 0) {
|
||||
|
||||
@list(, $sOption1, $sOption2, $sOption3) = explode("_", $sText, 4);
|
||||
|
||||
@ -27,36 +27,45 @@ final class ReportUser
|
||||
|
||||
public function ByDate($sStart, $sEnd = false)
|
||||
{
|
||||
|
||||
$query = CountUser::select('from',
|
||||
DB::raw('SUM(count_from) as count_from'),
|
||||
DB::raw('SUM(count_reg) as count_reg'),
|
||||
DB::raw('SUM(count_pay) as count_pay'),
|
||||
DB::raw('SUM(count_pay_new) as count_pay_new'),
|
||||
DB::raw('SUM(count_pay_old) as count_pay_old'),
|
||||
DB::raw('SUM(count_money) as count_money'),
|
||||
DB::raw('SUM(count_money_new) as count_money_new'),
|
||||
DB::raw('SUM(count_money_old) as count_money_old'));
|
||||
try {
|
||||
$query = CountUser::select('from',
|
||||
DB::raw('SUM(count_from) as count_from'),
|
||||
DB::raw('SUM(count_reg) as count_reg'),
|
||||
DB::raw('SUM(count_pay) as count_pay'),
|
||||
DB::raw('SUM(count_pay_new) as count_pay_new'),
|
||||
DB::raw('SUM(count_pay_old) as count_pay_old'),
|
||||
DB::raw('SUM(count_money) as count_money'),
|
||||
DB::raw('SUM(count_money_new) as count_money_new'),
|
||||
DB::raw('SUM(count_money_old) as count_money_old'));
|
||||
|
||||
if ($sEnd) {
|
||||
$query->whereDate('date', '>=', $sStart);
|
||||
$query->whereDate('date', '<=', $sEnd);
|
||||
} else {
|
||||
$query->whereDate('date', '=', $sStart);
|
||||
if ($sEnd) {
|
||||
$query->whereDate('date', '>=', $sStart);
|
||||
$query->whereDate('date', '<=', $sEnd);
|
||||
} else {
|
||||
$query->whereDate('date', '=', $sStart);
|
||||
}
|
||||
|
||||
$aData = $query->groupBy('from')
|
||||
->orderBy('count_reg', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return $this->TgStr($aData);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
|
||||
return $this->TgStr(json_encode($e->getMessage()), true);
|
||||
|
||||
}
|
||||
|
||||
$aData = $query->groupBy('from')
|
||||
->orderBy('count_reg', 'desc')
|
||||
->get()
|
||||
->toArray();
|
||||
|
||||
return $this->TgStr($aData);
|
||||
|
||||
}
|
||||
|
||||
private function TgStr ($aData)
|
||||
private function TgStr ($aData, $bBreak = false)
|
||||
{
|
||||
|
||||
if ($bBreak) {
|
||||
return $aData;
|
||||
}
|
||||
|
||||
// 先算总数
|
||||
$iTotalFromCount = 0;
|
||||
$iTotalRegCount = 0;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user