Пример #1
0
 public function add()
 {
     $initialLogic = new l\InitialLogic();
     $brandList = $initialLogic->getAllBrands();
     $salesList = $initialLogic->getAllSales();
     $brandName = I('brandName');
     $brandID = $brandList['Map'][$brandName];
     $salesName = I('salesName');
     $salesID = $salesList['Map'][$salesName];
     $break_pic = $_FILES['break_pics'];
     $bill_pic = $_FILES['billphoto'];
     $break_pics = null;
     $invoice_pic = null;
     if ($break_pic != '' && $break_pic != null) {
         $break_photo_name = "order/pic/breakphoto/" . uniqid() . strrchr($break_pic['name'], 46);
         $filepath = UploadBeforeOss($break_pic);
         $break_pics = C('OSS_FILE_PREFIX') . '/' . $break_photo_name;
         if (!ImgOssUpload($break_photo_name, $filepath)) {
             $data['status'] = 300;
             $data['message'] = '图片上传失败';
             $data['error_code'] = 10002;
             $this->ajaxReturn($data, 'JSON');
         }
     }
     if ($bill_pic != '' && $bill_pic != null) {
         $bill_photo_name = "order/pic/billphoto/" . uniqid() . strrchr($bill_pic['name'], 46);
         $filepath = UploadBeforeOss($bill_pic);
         $invoice_pic = C('OSS_FILE_PREFIX') . '/' . $bill_photo_name;
         if (!ImgOssUpload($bill_photo_name, $filepath)) {
             $data['status'] = 300;
             $data['message'] = '图片上传失败';
             $data['error_code'] = 10002;
             $this->ajaxReturn($data, 'JSON');
         }
     }
     $order['send_type'] = I('order_type');
     $order['appliance_id'] = I('appliance-father');
     $order['uappliance_id'] = I('appliance');
     $order['brand_id'] = $brandID;
     $order['servicetime'] = I('servicetime');
     $order['phone'] = I('customerPhone');
     $order['user_name'] = I('customerName');
     $order['address'] = I('prov') . "-" . I('city') . "-" . I('dist') . "-" . I('address') . "-" . I('doorNumber');
     $order['is_auto'] = I('pushMethod');
     $order['mer_only_code'] = I('merchant_code');
     $order['buy_time'] = I('buytime');
     $order['invoice'] = I('billNumber');
     $order['buy_mer_id'] = $salesID;
     $order['break_describe'] = I('break_describe');
     $order['invoice_pic'] = $invoice_pic;
     $order['break_pics'] = $break_pics;
     //$logdata = json_encode($order);
     //addErrorLog("Order","add","address",$logdata);
     $orderLogic = new l\OrderLogic();
     $result = $orderLogic->addOrder($order);
     $data['success'] = true;
     $data['status'] = $result['status'];
     $data['message'] = $result['message'];
     $this->ajaxReturn($data, 'JSON');
 }
Пример #2
0
 /**
  * 添加订单时获取品牌授权商户  
  * @return array
  */
 public function listBrandMerchant()
 {
     $brand_name = I('brand_name');
     $initialLogic = new l\InitialLogic();
     $brandList = $initialLogic->getAllBrands();
     $merchant['brand_id'] = $brandList['Map'][$brand_name];
     $merchantLogic = new l\MerchantLogic();
     //API 获取商户数据
     $merchant_data = $merchantLogic->getMerchantList($merchant, null, 0);
     $merchant_list = $merchant_data['datas'];
     //addErrorLog('appliance','loginc','current',$current);
     $this->assign('brandName', $brand_name);
     $this->assign('merchant_list', $merchant_list);
     $this->display();
 }