zealerChina 1 năm trước cách đây
mục cha
commit
e4c84cf485

+ 6 - 0
application/admin/controller/Produceorder.php

@@ -316,6 +316,12 @@ class Produceorder extends Backend
                 }
                 }
                 $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']);
                 $row['create_time'] = date('Y-m-d H:i:s', $row['create_time']);
                 $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
                 $row['update_time'] = date('Y-m-d H:i:s', $row['update_time']);
+                $row['produce_status_name'] =  $row['produce_status'] == 1 ? '已开户' : '未开户';
+                $row['produce_activation_name'] = $row['produce_activation'] == 1 ? '已激活' : '未激活';
+                $row['produce_is_recharge_name'] = $row['produce_is_recharge'] == 1 ? '已首充' : '未首充';
+                $row['is_arrearage_name'] = $row['is_arrearage'] == 1 ? '已欠费' : '未欠费';
+                $row['logistics_numbers'] = $row['logistics_numbers'] ?: '';
+                $row['first_amount'] = $row['first_amount'] ?: '';
             }
             }
 
 
             $extend=[];
             $extend=[];

+ 2 - 2
application/admin/view/produce/add.html

@@ -152,12 +152,12 @@
             <input id="c-api_goods_id"  class="form-control" name="row[api_goods_id]" type="text" value="">
             <input id="c-api_goods_id"  class="form-control" name="row[api_goods_id]" type="text" value="">
         </div>
         </div>
     </div> -->
     </div> -->
-    <!-- <div class="form-group">
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Message_channel_code')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Message_channel_code')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
             <input id="c-message_channel_code" class="form-control" name="row[message_channel_code]" type="text">
             <input id="c-message_channel_code" class="form-control" name="row[message_channel_code]" type="text">
         </div>
         </div>
-    </div> -->
+    </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">

+ 2 - 2
application/admin/view/produce/edit.html

@@ -184,12 +184,12 @@
             <input id="c-contact_code" class="form-control" name="row[contact_code]" type="text" value="{$row.contact_code|htmlentities}">
             <input id="c-contact_code" class="form-control" name="row[contact_code]" type="text" value="{$row.contact_code|htmlentities}">
         </div>
         </div>
     </div> -->
     </div> -->
-    <!-- <div class="form-group">
+    <div class="form-group">
         <label class="control-label col-xs-12 col-sm-2">{:__('Message_channel_code')}:</label>
         <label class="control-label col-xs-12 col-sm-2">{:__('Message_channel_code')}:</label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">
             <input id="c-message_channel_code" class="form-control" name="row[message_channel_code]" type="text" value="{$row.message_channel_code|htmlentities}">
             <input id="c-message_channel_code" class="form-control" name="row[message_channel_code]" type="text" value="{$row.message_channel_code|htmlentities}">
         </div>
         </div>
-    </div> -->
+    </div>
     <div class="form-group layer-footer">
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-2"></label>
         <label class="control-label col-xs-12 col-sm-2"></label>
         <div class="col-xs-12 col-sm-8">
         <div class="col-xs-12 col-sm-8">

+ 9 - 5
application/admin/view/produceorder/detail.html

@@ -23,7 +23,7 @@ td:first-child {
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('外部订单号')}:</td>
         <td>{:__('外部订单号')}:</td>
-        <td>{$row['order_no']}</td>
+        <td>{$row['out_order_no']}</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('上游单号')}:</td>
         <td>{:__('上游单号')}:</td>
@@ -48,7 +48,7 @@ td:first-child {
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('收货人')}:</td>
         <td>{:__('收货人')}:</td>
-        <td>{$row['name']}</td>
+        <td>{$row['address_name']}</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('分销商')}:</td>
         <td>{:__('分销商')}:</td>
@@ -60,7 +60,11 @@ td:first-child {
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('订单状态')}:</td>
         <td>{:__('订单状态')}:</td>
-        <td></td>
+        <td>{$row['state_name']}</td>
+    </tr>
+    <tr>
+        <td>{:__('证件姓名')}:</td>
+        <td>{$row['name']}</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('证件号码')}:</td>
         <td>{:__('证件号码')}:</td>
@@ -97,11 +101,11 @@ td:first-child {
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('iccid')}:</td>
         <td>{:__('iccid')}:</td>
-        <td></td>
+        <td>{$row['iccid']}</td>
     </tr>
     </tr>
     <tr>
     <tr>
         <td>{:__('商品名称')}:</td>
         <td>{:__('商品名称')}:</td>
-        <td>{$produce['name'] ?? ''}</td>
+        <td>{$produce['local_code'] ?? ''}</td>
     </tr>
     </tr>
 </table>
 </table>
 <table class="table table-striped table-bordered table-hover table-nowrap" width="50%">
 <table class="table table-striped table-bordered table-hover table-nowrap" width="50%">

+ 17 - 6
application/common/command/ZopOrderMsgCommand.php

@@ -1,8 +1,10 @@
 <?php
 <?php
 namespace app\common\command;
 namespace app\common\command;
 
 
+use app\common\model\Produce;
 use app\common\service\ZopOrderService;
 use app\common\service\ZopOrderService;
 use app\service\EsMobileService;
 use app\service\EsMobileService;
+use Exception;
 use think\console\Command;
 use think\console\Command;
 use think\console\Input;
 use think\console\Input;
 use think\console\Output;
 use think\console\Output;
@@ -17,12 +19,21 @@ class ZopOrderMsgCommand extends Command
     protected function execute(Input $input, Output $output)
     protected function execute(Input $input, Output $output)
     {
     {
         $this->output->info("开始获取联通订单消息");
         $this->output->info("开始获取联通订单消息");
-
-        $result = ZopOrderService::orderMsg();
-        if ($result['code'] == 0) {
-            $this->output->info("获取联通订单消息成功");
-        } else {
-            $this->output->info("获取联通订单消息失败: " . $result['message']);
+        // 获取所有商品信息中的消息渠道编码
+        $messageChannelCodes = Produce::where('message_channel_code', 'not null')->column('message_channel_code');
+        foreach ($messageChannelCodes as $messageChannelCode) {
+            try {
+                $result = ZopOrderService::orderMsg($messageChannelCode);
+                if ($result['code'] == 0) {
+                    $this->output->info("获取联通订单消息成功");
+                } else {
+                    $this->output->info("获取联通订单消息失败: " . $result['message']);
+                }
+            } catch (Exception $e) {
+                $this->output->info("获取联通订单消息失败: " . $e->getMessage());
+            }
         }
         }
+
+        $this->output->info("获取联通订单消息完成");
     }
     }
 }
 }

+ 26 - 4
application/common/service/ZopOrderService.php

@@ -11,6 +11,16 @@ use app\common\model\Produce;
  */
  */
 class ZopOrderService extends ZopBaseService
 class ZopOrderService extends ZopBaseService
 {
 {
+    const PUSH_STATE = [
+        '1' => '激活',
+        '2' => '退单(激活前)',
+        '3' => '转套餐',
+        '4' => '销户(激活后)',
+        '6' => '首充数据同步',
+        'C1' => '开户完成',
+        'E0' => '发货',
+    ];
+
     /**
     /**
      * 推送订单到联通商城
      * 推送订单到联通商城
      *
      *
@@ -570,9 +580,9 @@ class ZopOrderService extends ZopBaseService
      *
      *
      * @return void
      * @return void
      */
      */
-    public static function orderMsg($type = 4)
+    public static function orderMsg($messageChannelCode = '', $type = 4)
     {
     {
-        $messageChannelCode = config('site.message_channel_code');
+        // $messageChannelCode = config('site.message_channel_code');
         if (empty($messageChannelCode)) {
         if (empty($messageChannelCode)) {
             common_log('获取订单消息请求失败: 消息渠道编码为空');
             common_log('获取订单消息请求失败: 消息渠道编码为空');
 
 
@@ -581,7 +591,7 @@ class ZopOrderService extends ZopBaseService
 
 
         $url = '/link/king/card/msg/get/v1';
         $url = '/link/king/card/msg/get/v1';
         $data = [
         $data = [
-            'msgChannel' => config('site.message_channel_code'),
+            'msgChannel' => $messageChannelCode,
             'type' => $type,
             'type' => $type,
         ];
         ];
 
 
@@ -606,6 +616,7 @@ class ZopOrderService extends ZopBaseService
         }
         }
 
 
         $delMsgIds = [];
         $delMsgIds = [];
+        $delMsgVal = [];
         foreach ($body as $val) {
         foreach ($body as $val) {
             // 根据返回信息, 更新订单状态
             // 根据返回信息, 更新订单状态
             $orderNo = $val['order'] ?? '';
             $orderNo = $val['order'] ?? '';
@@ -620,6 +631,10 @@ class ZopOrderService extends ZopBaseService
                 continue;
                 continue;
             }
             }
 
 
+            $order->state = $state;
+            $order->state_name = self::PUSH_STATE[$state] ?? '';
+            $order->save();
+
             if ($state == 1) {
             if ($state == 1) {
                 // 激活
                 // 激活
                 $order->produce_activation = 1;
                 $order->produce_activation = 1;
@@ -629,6 +644,7 @@ class ZopOrderService extends ZopBaseService
                 $amount = $val['lgtsId'] ?? 0;
                 $amount = $val['lgtsId'] ?? 0;
                 $order->produce_is_recharge = 1;
                 $order->produce_is_recharge = 1;
                 $order->first_amount = $amount;
                 $order->first_amount = $amount;
+                $order->first_time = date('Y-m-d H:i:s');
                 $order->save();
                 $order->save();
             } else if ($state == 'C1') {
             } else if ($state == 'C1') {
                 // 开户
                 // 开户
@@ -641,11 +657,17 @@ class ZopOrderService extends ZopBaseService
             }
             }
 
 
             $delMsgIds[] = $id;
             $delMsgIds[] = $id;
+            $delMsgVal[] = $val;
         }
         }
 
 
         $delMsgIds = implode(',', $delMsgIds);
         $delMsgIds = implode(',', $delMsgIds);
 
 
-        self::delOrderMsg($delMsgIds, $type);
+        if (!empty($delMsgIds)) {
+            common_log('删除订单消息ID: ' . $delMsgIds);
+            common_log('删除消息内容: ' . json_encode($delMsgVal, JSON_UNESCAPED_UNICODE));
+
+            self::delOrderMsg($delMsgIds, $type);
+        }
     }
     }
 
 
     /**
     /**

+ 2 - 1
application/extra/upload.php

@@ -13,7 +13,8 @@ return [
     /**
     /**
      * 文件保存格式
      * 文件保存格式
      */
      */
-    'savekey'   => '/uploads/{year}{mon}{day}/{filemd5}_{uid}{.suffix}',
+    // 'savekey'   => '/uploads/{year}{mon}{day}/{filemd5}_{uid}{.suffix}',
+    'savekey'   => '/uploads/{year}{mon}{day}/{filename}{.suffix}',
     /**
     /**
      * 最大可上传大小
      * 最大可上传大小
      */
      */

+ 16 - 20
public/assets/js/backend/produceorder.js

@@ -123,23 +123,19 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','clipboard'],
                     // {field: 'id', title: __('ID'),operate:false,},
                     // {field: 'id', title: __('ID'),operate:false,},
                     {field: 'order_no', title: __('订单号'),visible:false,operate: 'like'},
                     {field: 'order_no', title: __('订单号'),visible:false,operate: 'like'},
                     {field: 'out_order_no', title: __('外部订单号'),visible:false,operate: 'like'},
                     {field: 'out_order_no', title: __('外部订单号'),visible:false,operate: 'like'},
-                    // {field: 'logistics_numbers', title: __('支付单号'),visible: false,operate: '='},
-                    // {field: 'pay_type', title: __('支付方式'),searchList: payType,visible: false, operate: is_proxy_operate},
-                    {field: 'produce_id', title: __('商品名称'),visible: false,operate: 'LIKE', addClass: 'selectpage', extend: "data-source='produce/index' data-field='name'"},
+                    {field: 'produce_id', title: __('商品名称'),visible: false,operate: 'LIKE', addClass: 'selectpage', extend: "data-source='produce/index' data-field='local_code'"},
                     {field: 'is_arrearage', title: __('是否欠费'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
                     {field: 'is_arrearage', title: __('是否欠费'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
                     {field: 'produce_activation', title: __('是否激活'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
                     {field: 'produce_activation', title: __('是否激活'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
                     {field: 'produce_is_recharge', title: __('是否首充'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
                     {field: 'produce_is_recharge', title: __('是否首充'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
-                    {field: 'flag', title: __('旗帜'), searchList: {"#FF0000":'红色',"#FFFF00":'黄色',"#00FF33":'绿色',"#0033FF":'蓝色',"#9900FF":'紫色',"#00CCFF":'青色'},visible: false}, 
-                    {field: 'supplier', title: __('分销商'),visible: false,operate: 'LIKE'},
+                    {field: 'flag', title: __('旗帜'), searchList: {"#FF0000":'红色',"#FFFF00":'黄色',"#00FF33":'绿色',"#0033FF":'蓝色',"#9900FF":'紫色',"#00CCFF":'青色'},visible: false},
                     {field: 'no', title: __('生产号码'),visible: false,operate: 'LIKE'},
                     {field: 'no', title: __('生产号码'),visible: false,operate: 'LIKE'},
                     {field: 'phone', title: __('收货人手机'),visible: false,operate: 'LIKE'},
                     {field: 'phone', title: __('收货人手机'),visible: false,operate: 'LIKE'},
-                    {field: 'name', title: __('收货人'),visible: false,operate: 'LIKE'},
-                    {field: 'id_no', title: __('收货人身份证'),visible: false,operate: "like"},
-                    {field: 'is_auto', title: __('是否是自动订单'),visible: false},
-                    {field: 'no', title: __('订单来源'),visible: false,operate: 'LIKE'},
-                    {field: 'no', title: __('外部订单号'),visible: false,operate: 'LIKE'},
-                    {field: 'no', title: __('商品编码'),visible: false,operate: 'LIKE'},
-                    {field: 'create_time', title: __('订单生成时间'),visible: false,operate: 'LIKE'},
+                    {field: 'address_name', title: __('收货人'),visible: false,operate: 'LIKE'},
+                    {field: 'id_no', title: __('身份证'),visible: false,operate: "like"},
+                    {field: 'is_auto', title: __('是否首充'), searchList: {"1":__('是'),"0":__('否')},visible: false}, 
+                    {field: 'platform_source', title: __('订单来源'),visible: false,operate: 'LIKE'},
+                    {field: 'create_time', title: __('订单生成时间'),visible: false,operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, type: 'datetime'},
+                    {field: 'state', title: __('订单状态'),visible: false, searchList: {'1':'激活','2':'退单(激活前)','3':'转套餐','4':'销户','6':'首充数据同步','C1':'开户完成','E0':'发货'},operate: 'LIKE'},
                     // {field: 'no', title: __('订单更新时间'),visible: false,operate: 'LIKE'},
                     // {field: 'no', title: __('订单更新时间'),visible: false,operate: 'LIKE'},
                     {field: 'order_no', title: __('订单信息'),operate: false,formatter(_,order){
                     {field: 'order_no', title: __('订单信息'),operate: false,formatter(_,order){
                             let a=[]
                             let a=[]
@@ -190,10 +186,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','clipboard'],
                         },width:'20%',valign:'top',align:'left'},
                         },width:'20%',valign:'top',align:'left'},
                     {field: 'create_time', title: __('订单状态'),operate: false,formatter(_,order){
                     {field: 'create_time', title: __('订单状态'),operate: false,formatter(_,order){
                             let a=[]
                             let a=[]
-                            a.push(`<div class="btn-order_link" data-link="${order.name}">订单状态:</div>`)
-                            a.push(`<div class="btn-order_link" data-link="${order.phone}">激活状态:</div>`)
-                            a.push(`<div class="btn-order_link" data-link="${order.address}">是否首充:</div>`)
-                            a.push(`<div>首充金额:</div>`)
+                            a.push(`<div class="btn-order_link" data-link="${order.state_name}">订单状态:${order.state_name}</div>`)
+                            a.push(`<div class="btn-order_link" data-link="${order.produce_activation_name}">激活状态:${order.produce_activation_name}</div>`)
+                            a.push(`<div class="btn-order_link" data-link="${order.produce_is_recharge_name}">是否首充:${order.produce_is_recharge_name}</div>`)
+                            a.push(`<div>首充金额:${order.first_amount}</div>`)
                             a.push(`<div>创建时间:${order.create_time}</div>`)
                             a.push(`<div>创建时间:${order.create_time}</div>`)
                             a.push(`<div>更新时间:${order.update_time}</div>`)
                             a.push(`<div>更新时间:${order.update_time}</div>`)
                             // a.push(`<a class="btn btn-link btn-click-show-open" style="color: #00a2ff;" data-id="${order.id}" data-open="${order.open_uploaded}">查看资料</a>`)
                             // a.push(`<a class="btn btn-link btn-click-show-open" style="color: #00a2ff;" data-id="${order.id}" data-open="${order.open_uploaded}">查看资料</a>`)
@@ -202,9 +198,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','clipboard'],
                     {field: 'create_time', title: __('生产信息'),operate: false,formatter(_,order){
                     {field: 'create_time', title: __('生产信息'),operate: false,formatter(_,order){
                             let a=[]
                             let a=[]
                             a.push(`<div class="btn-order_link" data-link="${order.no}">生产号码:${order.no}</div>`)
                             a.push(`<div class="btn-order_link" data-link="${order.no}">生产号码:${order.no}</div>`)
-                            a.push(`<div class="btn-order_link" data-link="${order.phone}">订单来源:</div>`)
-                            a.push(`<div class="btn-order_link" data-link="${order.address}">物流名称:</div>`)
-                            a.push(`<div>物流单号:</div>`)
+                            a.push(`<div class="btn-order_link" data-link="${order.platform_source}">订单来源:${order.platform_source}</div>`)
+                            a.push(`<div class="btn-order_link" data-link="${order.logistics_numbers}">物流名称:</div>`)
+                            a.push(`<div>物流单号:${order.logistics_numbers}</div>`)
                             a.push(`<div>物流状态:</div>`)
                             a.push(`<div>物流状态:</div>`)
                             // a.push(`<a class="btn btn-link btn-click-show-open" style="color: #00a2ff;" data-id="${order.id}" data-open="${order.open_uploaded}">查看资料</a>`)
                             // a.push(`<a class="btn btn-link btn-click-show-open" style="color: #00a2ff;" data-id="${order.id}" data-open="${order.open_uploaded}">查看资料</a>`)
                             return `<div style="max-width: 200px;text-align: left;" class="break-words">${a.join('')}</div>`
                             return `<div style="max-width: 200px;text-align: left;" class="break-words">${a.join('')}</div>`
@@ -219,7 +215,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','clipboard'],
                     {field: 'failure_reason', title: __('失败原因'), operate: false,align:'left', class: 'autocontent', formatter: Table.api.formatter.content},
                     {field: 'failure_reason', title: __('失败原因'), operate: false,align:'left', class: 'autocontent', formatter: Table.api.formatter.content},
                     // {field: 'title', title: __('Title'), operate: 'LIKE',align:'left', class: 'autocontent', formatter: Table.api.formatter.content},
                     // {field: 'title', title: __('Title'), operate: 'LIKE',align:'left', class: 'autocontent', formatter: Table.api.formatter.content},
                     // {field: 'remark', title: '失败原因&备注',formatter: Table.api.formatter.datetime,addClass:'datetimerange',operate: 'range'},
                     // {field: 'remark', title: '失败原因&备注',formatter: Table.api.formatter.datetime,addClass:'datetimerange',operate: 'range'},
-                    {field: 'trans_no', title: __('Trans_no'),visible: false,operate: "like"},
+                    {field: 'logistics_numbers', title: __('物流单号'),visible: false,operate: "like"},
                     {
                     {
                         field: 'operate',
                         field: 'operate',
                         title: __('Operate'),
                         title: __('Operate'),