过滤刷单账号

This commit is contained in:
jianghanbo 2024-09-01 13:38:02 +08:00
parent 1520699f88
commit ea7ad218c6
4 changed files with 72 additions and 16 deletions

View File

@ -3,8 +3,10 @@
namespace app\command;
use app\admin\controller\AdminController;
use app\common\Error;
use app\model\Admins;
use app\model\Blacks;
use app\model\FilterMobiles;
use app\model\Finances;
use app\model\Logs;
use app\model\Orders;
@ -364,19 +366,23 @@ class SpiderDy extends Command
if (empty($item)) {
$order->is_zhibo = $this->zhibo($order->product_name, $order->os);
$oldMobile = orders::where("os", $order->os)->where("mobile", $order->mobile)
->where("create_time", '>=', time() - 24 * 3600 * 3)->find();
if (!empty($oldMobile)) {
$admin_id = $oldMobile->admin_id;
if (FilterMobiles::isFilterMobile($order->mobile)) {
$admin_id = 0;
} else {
$admin_id = $this->poolUser($order->orderStatus, $order->category_desc);
$oldMobile = orders::where("os", $order->os)->where("mobile", $order->mobile)
->where("create_time", '>=', time() - 24 * 3600 * 3)->find();
if (!empty($oldMobile)) {
$admin_id = $oldMobile->admin_id;
} else {
$admin_id = $this->poolUser($order->orderStatus, $order->category_desc);
}
if (empty($admin_id)) return null;
}
if (empty($admin_id)) return null;
$order->admin_id = $admin_id;
$order->give_time = time();
//判断是否需要发短信
if (($order->os == 1 && array_key_exists($order->order_status, [1 => 1, 3 => 3])) ||
($order->os == 2 && array_key_exists($order->order_status, [2 => 2, 3 => 3, 4 => 4])) ||

View File

@ -5,6 +5,7 @@ namespace app\command;
use app\admin\controller\AdminController;
use app\model\Admins;
use app\model\Blacks;
use app\model\FilterMobiles;
use app\model\Finances;
use app\model\Logs;
use app\model\Orders;
@ -387,16 +388,22 @@ class SpiderMt extends Command
if (empty($item)) {
//$order->is_zhibo = $this->zhibo($order->product_name, $order->os);
$oldMobile = orders::where("os", $order->os)->where("mobile", $order->mobile)
->where("create_time", '>=', time() - 24 * 3600 * 3)->find();
if (!empty($oldMobile)) {
$admin_id = $oldMobile->admin_id;
// 刷单账号
if (FilterMobiles::isFilterMobile($order->mobile)) {
$admin_id = 0;
} else {
$admin_id = $this->poolUser($order->orderStatus, $order->category_desc);
$oldMobile = orders::where("os", $order->os)->where("mobile", $order->mobile)
->where("create_time", '>=', time() - 24 * 3600 * 3)->find();
if (!empty($oldMobile)) {
$admin_id = $oldMobile->admin_id;
} else {
$admin_id = $this->poolUser($order->orderStatus, $order->category_desc);
}
if (empty($admin_id)) return null;
}
if (empty($admin_id)) return null;
$order->admin_id = $admin_id;
$order->give_time = time();
@ -404,7 +411,9 @@ class SpiderMt extends Command
if (($order->os == 1 && array_key_exists($order->order_status, [1 => 1, 3 => 3])) ||
($order->os == 2 && array_key_exists($order->order_status, [2 => 2, 3 => 3, 4 => 4])) ||
($order->os == 3 && $order->order_status == 1)) {
$this->sms($admin_id, $order);
if ($admin_id > 0) {
$this->sms($admin_id, $order);
}
}
//新获得一个用户的,提示管理员有新的订单
Redis::incrBy('CRM:USER:ONLINE:NEW:' . $admin_id, 1);

View File

@ -0,0 +1,36 @@
<?php
namespace app\model;
use app\common\Keys;
use support\Redis;
class FilterMobiles extends base
{
/**
* @param string $mobile
* @param bool $refresh
* @return bool
* @throws \think\db\exception\BindParamException
*/
public static function isFilterMobile(string $mobile, bool $refresh = false): bool
{
$key = 'order_filter_mobiles';
if ($refresh || !Redis::exists($key)) {
$list = self::query()->column('id', 'mobile');
if (!empty($list)) {
$chunks = array_chunk($list, 50, true);
foreach($chunks as $mobiles) {
Redis::hMSet($key, $mobiles);
}
Redis::expire($key, 60*60*24);
}
}
return Redis::hExists($key, $mobile);
}
}

View File

@ -4,6 +4,7 @@ namespace app\server;
use app\common\Error;
use app\model\Admins as AdminsModel;
use app\model\FilterMobiles;
use app\model\Finances as FinancesModel;
use app\model\Orders as OrdersModel;
use support\Log;
@ -50,6 +51,10 @@ class Orders {
$result[$order->sn] = Error::undefined('client mobile or admin mobile invalid');
continue;
}
if (FilterMobiles::isFilterMobile($order->mobile)) {
$result[$order->sn] = Error::undefined('刷单账单');
continue;
}
$admin_mobile = $admin_mobile['mobile'] ?? '';
if (Blacks::CExists($order->mobile)) {