fix(queue): 优化消息格式和订单状态更新逻辑

-调整渠道余额监控预警消息格式,提高可读性
-优化卡密订单状态更新条件,确保仅处理已完成的订单
- 新增 test_dr 方法用于处理特定订单的卡密上传和状态更新
This commit is contained in:
2025-06-05 17:00:33 +08:00
parent b2b2fad0c5
commit d59f1b9346
3 changed files with 46 additions and 4 deletions

View File

@ -187,6 +187,48 @@ class Test extends Core
}
}
public function test_dr()
{
$data = Db::name('test_dr')->whereNotNull('order')->select()->toArray();
// $channelService = ChannelService::instance();
foreach ($data as $vo) {
$order = Db::name('merchant_order_history')->where(['merchant_order_id'=>$vo['order']])->find();
if(!$order){
continue;
}
$KamiService = KamiService::instance();
$response = json_decode($order['response'],true);
$cardno = $response['kami']['cardno'];
$cardpwd = $response['kami']['cardpwd'];
$expired = $response['kami']['expired'];
$value = $response['kami']['value'];
$where['id'] = $order['pid'];
$where['status'] = 1;
$channel_product = Db::name('channel_product')->where($where)->find();
$service_id = $channel_product['service_id'];
$kami_group_id = $order['cid'].'00'.$service_id;
$upkami = $KamiService->upKami($cardno, $cardpwd, $value, $expired,$kami_group_id);
// var_dump($upkami);die;
if($upkami){
Db::name('merchant_order_history')->where(['merchant_order_id'=>$vo['order']])->update(['status' => 3]);
Log::write('dr', 'dr', $vo['order']);#写入到日志里
Db::name('test_dr')->where('order', $vo['order'])->delete();//这个用like会不会太范了不会因为order是唯一只是怕空格影响
}else{
var_dump($vo);
}
}
}
public function jt()

View File

@ -68,7 +68,7 @@ class KamiOrderStatusStandardUp extends Command
if(empty($vo['channel_callback_msg'])){
if(isset($vo['response'])){
$callJson = $vo['response'];
if(isset($callJson) && is_string($callJson)) {
if(is_string($callJson)) {
$callArray = json_decode($callJson, true);
if(is_array($callArray)) {
if(isset($callArray['kami'])) {

View File

@ -103,9 +103,9 @@ class ChannelBalanceMonitor extends Command
}
if(!empty($tip_info)){
$errorMsg = "渠道余额监控预警<font color=\"warning\">".$count_sum ."列</font>,请相关同事注意。\n
>";
$errorMsg .= implode(">", $tip_info);
$errorMsg = "渠道余额监控预警<font color=\"warning\">".$count_sum ."列</font>,请相关同事注意。
\n >";
$errorMsg .= implode(">", $tip_info)."\n";
$RobotService->send_markdown($errorMsg,$key);
}