Example #1
0
 /**
  * 上传签收图片
  *
  */
 private function uploadImg()
 {
     $this->create();
     //上传签收信息 convert(money,a.cubage)
     $model = new AirwaybillModel();
     $sql = "SELECT top 100 d.id, w.orderno, w.company, a.dno, d.businessNo\n\t\t          FROM airwaybill a INNER JOIN web_order w ON a.weborder = w.id INNER JOIN web_orderdetail d ON w.orderno = d.orderno\n\t\t         WHERE d.synupsign = 0 and d.synupsigncount < 3";
     $rs = $model->query($sql);
     if ($rs) {
         for ($i = 0; $i < count($rs); $i++) {
             $data['orderno'] = $rs[$i]['orderno'];
             $data['dno'] = $rs[$i]['dno'];
             $data['businessNo'] = $rs[$i]['businessNo'];
             $data['company'] = $rs[$i]['company'];
             //太经常访问,国药服务器会崩溃的,休息下再说
             $this->sleep4awhile();
             //upload 签收
             $result = $this->sendToSPLImage($data);
             if ($result === 404) {
                 return;
             } else {
                 if ($result === -100) {
                     $this->addLog("the img file was not existed!");
                     continue;
                 } else {
                     if ($result) {
                         $model->execute("update web_orderdetail set synupsign = 1 where id =" . $rs[$i]["id"]);
                     }
                 }
             }
             //上传次数
             $model->execute("update web_orderdetail set synupsigncount = synupsigncount +1 where id =" . $rs[$i]["id"]);
         }
     }
 }