/**
  * 修改物流单
  */
 public function logisticsEdit()
 {
     $this->V(['id' => ['egNum', null, true]]);
     $logisticsId = intval($_POST['id']);
     $rule = ['id' => [], 'logistics_number' => [], 'logistics_name' => []];
     $this->V($rule);
     $logistics = $this->table('logistics')->where(['id' => $logisticsId, 'is_on' => 1])->get(['id'], true);
     if (!$logistics) {
         $this->R('', 70009);
     }
     unset($rule['id']);
     foreach ($rule as $k => $v) {
         if (isset($_POST[$k])) {
             $data[$k] = $_POST[$k];
         }
     }
     $logistics = $this->table('logistics')->where(['id' => $logisticsId])->update($data);
     if (!$logistics) {
         $this->R('', 40001);
     }
     $dataA = array('logistics_number' => $data['logistics_number'], 'update_time' => time());
     //开启事务
     $this->table()->startTrans();
     $logistics = $this->table('logistics_data')->save($dataA);
     if (!$logistics) {
         $this->R('', 40001);
     }
     //向快递100发送订阅请求
     $express = new \System\lib\Express\Express();
     $post_data = $express->getJson($data['logistics_number']);
     $url = 'http://www.kuaidi100.com/poll';
     $o = "";
     foreach ($post_data as $k => $v) {
         $o .= "{$k}=" . urlencode($v) . "&";
         //默认UTF-8编码格
     }
     $post_data = substr($o, 0, -1);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_POST, 1);
     curl_setopt($ch, CURLOPT_HEADER, 0);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
     $p = curl_exec($ch);
     if ($p) {
         $this->table()->commit();
         //提交事务
     } else {
         $this->table()->rollback();
         //回滚事务
     }
     //$this->R();
 }