feat(order): 添加携号转网检测前端显示功能
- 在订单信息页面增加号码状态数据表格,显示携转状态、原运营商、现运营商等信息 - 在订单控制器中添加携号转网检测逻辑,解析订单参数并获取运营商信息- 新增 ChannelOrderStatusMonitor 类,用于监控渠道订单问题
This commit is contained in:
parent
21e4c1e37a
commit
991222546d
@ -613,6 +613,29 @@ class Order extends Controller
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#携号转网检测,手机号检测:
|
||||||
|
if(str_contains($data['param'], 'mobile') && (str_contains($data['param'], 'old_product') ||str_contains($data['param'], 'dhcz_mnp') || str_contains($data['param'], 'mnp_isp_array'))){
|
||||||
|
$param_data = json_decode($data['param'],true);
|
||||||
|
$isp_name = [
|
||||||
|
1=>'移动',
|
||||||
|
2=>'联通',
|
||||||
|
3=>'电信',
|
||||||
|
];
|
||||||
|
|
||||||
|
$old_product = $this->app->db->name('ServiceInfo')->where('key',$param_data['old_product'])->field('name')->find();
|
||||||
|
$data['mobile_status_array'] = [
|
||||||
|
'old_product'=>$old_product['name']??$param_data['old_product']??'',
|
||||||
|
'old_isp'=>$isp_name[$param_data['mnp_isp_array']['old_isp']??0] ?? '',
|
||||||
|
'new_isp'=>$isp_name[$param_data['mnp_isp_array']['new_isp']??0] ?? '',
|
||||||
|
];
|
||||||
|
if($data['mobile_status_array']['old_isp'] == $data['mobile_status_array']['new_isp']){
|
||||||
|
$data['mobile_status_array']['is_mnp'] = '未携转';
|
||||||
|
}else{
|
||||||
|
$data['mobile_status_array']['is_mnp'] = '已携转';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# 手动扣款
|
# 手动扣款
|
||||||
@ -1293,7 +1316,6 @@ class Order extends Controller
|
|||||||
} else {
|
} else {
|
||||||
$this->error('请上传文件');
|
$this->error('请上传文件');
|
||||||
}
|
}
|
||||||
// var_dump($data);die;
|
|
||||||
|
|
||||||
if (str_contains($data['file']['name'], '.xls')) {
|
if (str_contains($data['file']['name'], '.xls')) {
|
||||||
$file = 'card/order_card.xlsx';
|
$file = 'card/order_card.xlsx';
|
||||||
|
@ -141,6 +141,38 @@
|
|||||||
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
{if isset($vo.mobile_status_array) && $vo.mobile_status_array}
|
||||||
|
<table class="layui-table" lay-skin="line">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width:20%;">号码状态数据</th>
|
||||||
|
<th class='text-left nowrap' width="100%"></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">号码</span></td>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">{$vo.account|default=''}</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">携转状态</span></td>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">{$vo.mobile_status_array.is_mnp|default=''}</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">原运营商</span></td>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">{$vo.mobile_status_array.old_isp|default=''}</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">现运营商</span></td>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">{$vo.mobile_status_array.new_isp|default=''}</span></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">原送入产品编码</span></td>
|
||||||
|
<td class='text-left nowrap'><span class="color-desc">{$vo.mobile_status_array.old_product|default=''}</span></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{/if}
|
||||||
{if $vo.kami}
|
{if $vo.kami}
|
||||||
<table class="layui-table" lay-skin="line">
|
<table class="layui-table" lay-skin="line">
|
||||||
<thead>
|
<thead>
|
||||||
|
@ -33,6 +33,7 @@ class ChannelBalanceMonitor extends Command
|
|||||||
ini_set('memory_limit', '1024M');
|
ini_set('memory_limit', '1024M');
|
||||||
$this->redis();
|
$this->redis();
|
||||||
|
|
||||||
|
#避免反复查询已经固定的Channel数据,此处应该引入redis 缓存数据
|
||||||
$channelService = ChannelService::instance();
|
$channelService = ChannelService::instance();
|
||||||
$RobotService = new WxWorkBot($this->app);
|
$RobotService = new WxWorkBot($this->app);
|
||||||
$channelList = $channelService->db()->where(['status'=>1])->whereLike('other_data','%Monitor_Balance_status%')->select()->toArray();
|
$channelList = $channelService->db()->where(['status'=>1])->whereLike('other_data','%Monitor_Balance_status%')->select()->toArray();
|
||||||
|
132
app/queue/command/monitor/ChannelOrderStatusMonitor.php
Normal file
132
app/queue/command/monitor/ChannelOrderStatusMonitor.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\queue\command\monitor;
|
||||||
|
|
||||||
|
use app\channel\service\ChannelService;
|
||||||
|
use app\gateway\service\RedisService;
|
||||||
|
use app\robot\controller\WxWorkBot;
|
||||||
|
use think\admin\Command;
|
||||||
|
use think\console\Input;
|
||||||
|
use think\console\Output;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道订单问题监控预警
|
||||||
|
* Class ChannelOrderStatusMonitor
|
||||||
|
* @package app\data\command
|
||||||
|
*/
|
||||||
|
class ChannelOrderStatusMonitor extends Command
|
||||||
|
{
|
||||||
|
protected $redis = false;
|
||||||
|
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('xQueue:ChannelOrderStatusMonitor')->setDescription('[ 监控系统 ] 渠道订单问题监控预警');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Input $input
|
||||||
|
* @param Output $output
|
||||||
|
* @throws \think\admin\Exception
|
||||||
|
*/
|
||||||
|
protected function execute(Input $input, Output $output)
|
||||||
|
{
|
||||||
|
ini_set('memory_limit', '1024M');
|
||||||
|
$this->redis();
|
||||||
|
|
||||||
|
$channelService = ChannelService::instance();
|
||||||
|
$RobotService = new WxWorkBot($this->app);
|
||||||
|
|
||||||
|
$channelList = $channelService->db()->where(['status'=>1])->whereLike('other_data','%Monitor_OrderStatus_status%')->select()->toArray();
|
||||||
|
if(!$channelList) $this->setQueueSuccess("未找到支持监控余额的渠道");
|
||||||
|
|
||||||
|
$channelList_num = count($channelList);
|
||||||
|
$count_sum = 0;
|
||||||
|
|
||||||
|
$day = date('Y-m-d', strtotime('-1 day'));
|
||||||
|
|
||||||
|
$tip_info=[];
|
||||||
|
$key = '41b42bd4-c9f9-4617-9531-0a358dd97a82';
|
||||||
|
|
||||||
|
|
||||||
|
foreach($channelList as $channel) {
|
||||||
|
$other_param = json_decode($channel['other_data'],true);
|
||||||
|
if(!$other_param){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$Monitor_Balance = $other_param['Monitor_Balance'] ?? null;
|
||||||
|
if(!$Monitor_Balance){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try{
|
||||||
|
$account_data = $channelService->call('account', $channel['id'], $day);
|
||||||
|
|
||||||
|
if (is_array($account_data) && isset($account_data['account'])) {
|
||||||
|
$balance = $account_data['account'];
|
||||||
|
if( $balance <= $Monitor_Balance){
|
||||||
|
|
||||||
|
if(!$this->redis->get('Check_channel_account-'.$channel['id'])){
|
||||||
|
$count_sum ++;
|
||||||
|
$this->redis->set('Check_channel_account-'.$channel['id'],1);
|
||||||
|
$tip_info[] = $channel['name']."<font color=\"comment\">余额不足,只剩下</font>:<font color=\"info\">".$balance."</font>";
|
||||||
|
|
||||||
|
}
|
||||||
|
$Monitor_Balance_TOP = $other_param['Monitor_Balance_TOP'] ?? null;
|
||||||
|
if($Monitor_Balance_TOP && $balance <= $Monitor_Balance_TOP){
|
||||||
|
if(!$this->redis->get('Check_channel_account_TOP-'.$channel['id'])){
|
||||||
|
$count_sum ++;
|
||||||
|
$this->redis->set('Check_channel_account_TOP-'.$channel['id'],1);
|
||||||
|
$tip_info[] = $channel['name']."<font color=\"comment\">余额不足,只剩下</font>:<font color=\"info\">".$balance."</font>";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if($this->redis->get('Check_channel_account-'.$channel['id'])){
|
||||||
|
$count_sum ++;
|
||||||
|
|
||||||
|
$this->redis->delete('Check_channel_account-'.$channel['id']);
|
||||||
|
$tip_info[] = $channel['name']."<font color=\"comment\">余额已经恢复,现在余额为</font>:<font color=\"info\">".$balance."</font>";
|
||||||
|
}
|
||||||
|
if($this->redis->get('Check_channel_account_TOP-'.$channel['id'])){
|
||||||
|
$this->redis->delete('Check_channel_account_TOP-'.$channel['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch (\Exception $e){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($tip_info)){
|
||||||
|
$errorMsg = "渠道余额监控预警<font color=\"warning\">".$count_sum ."列</font>,请相关同事注意。\n
|
||||||
|
>";
|
||||||
|
$errorMsg .= implode(">", $tip_info);
|
||||||
|
$RobotService->send_markdown($errorMsg,$key);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->setQueueSuccess("共处理 {$channelList_num} 个渠道, 完成{$count_sum} 个查询处理!");
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function redis()
|
||||||
|
{
|
||||||
|
if (!$this->redis) {
|
||||||
|
$this->redis = RedisService::getInstance();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user