调整
This commit is contained in:
@@ -129,6 +129,8 @@ class StockOrdersService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 检查绑定
|
||||||
|
(new UserService())->checkBind($userId);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -227,4 +227,26 @@ class UserService
|
|||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function checkBind($userId)
|
||||||
|
{
|
||||||
|
$user = \app\common\model\User::find($userId);
|
||||||
|
if (!$user->report_to) {
|
||||||
|
throw new BusinessException('请先前往个人中心-绑定直属上级');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($user->sign_img === null || $user->sign_img === '') {
|
||||||
|
throw new BusinessException('请先前往个人中心-操作签名');
|
||||||
|
}
|
||||||
|
|
||||||
|
$ug = \app\common\model\UserGroupMembers::with(['group' => function($query) {
|
||||||
|
$query->where('scenario_code', 'stock_orders');
|
||||||
|
}])->where('user_id', $userId)->first();
|
||||||
|
if (!$ug) {
|
||||||
|
throw new BusinessException('请先前往个人中心-绑定内勤');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace app\common\utils;
|
namespace app\common\utils;
|
||||||
|
|
||||||
|
use app\common\model\UserRoles;
|
||||||
use GatewayWorker\Lib\Gateway;
|
use GatewayWorker\Lib\Gateway;
|
||||||
use app\common\utils\WsResponse;
|
use app\common\utils\WsResponse;
|
||||||
use app\common\service\MessageNotificationsService;
|
use app\common\service\MessageNotificationsService;
|
||||||
@@ -303,30 +304,29 @@ class WsEvents
|
|||||||
public function initCheck(int $userId)
|
public function initCheck(int $userId)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'is_report_to' => false,
|
// 'is_report_to' => false,
|
||||||
'is_office_clerk' => false,
|
// 'is_office_clerk' => false,
|
||||||
'is_sign' => false
|
'is_sign' => false
|
||||||
];
|
];
|
||||||
|
|
||||||
$user = \app\common\model\User::find($userId);
|
$user = \app\common\model\User::find($userId);
|
||||||
|
// if ($user->report_to > 0) {
|
||||||
if ($user->report_to > 0) {
|
// $data['is_report_to'] = true;
|
||||||
$data['is_report_to'] = true;
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
if ($user->sign_img !== null && $user->sign_img !== '') {
|
if ($user->sign_img !== null && $user->sign_img !== '') {
|
||||||
$data['is_sign'] = true;
|
$data['is_sign'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ug = \app\common\model\UserGroupMembers::with(['group' => function($query) {
|
// $ug = \app\common\model\UserGroupMembers::with(['group' => function($query) {
|
||||||
$query->where('scenario_code', 'stock_orders');
|
// $query->where('scenario_code', 'stock_orders');
|
||||||
}])->where('user_id', $userId)->first();
|
// }])->where('user_id', $userId)->first();
|
||||||
if ($ug !== null) {
|
// if ($ug !== null) {
|
||||||
$data['is_office_clerk'] = true;
|
// $data['is_office_clerk'] = true;
|
||||||
}
|
// }
|
||||||
|
|
||||||
if ($data['is_report_to'] && $data['is_office_clerk'] && $data['is_sign']) {
|
if ($data['is_sign']) {
|
||||||
Redis::hSet('user:init:check:'.$userId, 'status', 1);
|
Redis::hSet('user:check:sign'.$userId, 'status', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ class StatisticsController extends BaseController
|
|||||||
// 1. 计算时间范围
|
// 1. 计算时间范围
|
||||||
$now = Carbon::now();
|
$now = Carbon::now();
|
||||||
$sixMonthsAgo = $now->copy()->subMonths(5)->startOfMonth(); // 包含6个月
|
$sixMonthsAgo = $now->copy()->subMonths(5)->startOfMonth(); // 包含6个月
|
||||||
var_dump($sixMonthsAgo->timestamp);
|
|
||||||
|
|
||||||
// 2. 获取关联渠道ID
|
// 2. 获取关联渠道ID
|
||||||
$channelIds = $this->getChannelIdsByCompany($companyId);
|
$channelIds = $this->getChannelIdsByCompany($companyId);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
namespace app\process;
|
namespace app\process;
|
||||||
|
|
||||||
use app\common\model\User;
|
use app\common\model\User;
|
||||||
use app\common\model\UserRoles;
|
|
||||||
use app\common\utils\WsEvents;
|
use app\common\utils\WsEvents;
|
||||||
use support\Redis;
|
use support\Redis;
|
||||||
use Workerman\Crontab\Crontab;
|
use Workerman\Crontab\Crontab;
|
||||||
@@ -24,9 +23,9 @@ class CheckWeb
|
|||||||
}
|
}
|
||||||
|
|
||||||
new Crontab('*/3 * * * * *', function(){
|
new Crontab('*/3 * * * * *', function(){
|
||||||
$userIds = UserRoles::where('role_id', 1)->pluck('user_id')->toArray();
|
$userIds = User::where('status', 1)->toArray();
|
||||||
foreach ($userIds as $userId) {
|
foreach ($userIds as $userId) {
|
||||||
$status = Redis::hGet('user:init:check:'.$userId, 'status');
|
$status = Redis::hGet('user:check:sign'.$userId, 'status');
|
||||||
if ($status) {
|
if ($status) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user