public function getSlideDetail() { $slideInfo = $this->getSlideInfo(); $attchmentModel = new AttachmentModel(); foreach ($slideInfo as $key => $value) { $attchmentModel->setId($value['attchment_id']); $attchmentPath = $attchmentModel->getAttchmentPath(); $slideInfo[$key]['path'] = $attchmentPath; } return $slideInfo; }
public function getGoodsInf() { $res = $this->where('id = ' . $this->goodsId)->find(); $pictureId = $res['focus_pictures']; if ($pictureId != null) { $attchmentId = explode(',', $pictureId); $attchmentModel = new AttachmentModel(); foreach ($attchmentId as $value) { $attchmentModel->setId($value); $relpath[] = $attchmentModel->getAttchmentPath(); } $res['picturePath'] = $relpath; } return $res; }
public function goodsList() { $name = '%' . $this->goodsName . '%'; $map['name'] = array('like', $name); $map['state'] = 1; $res = $this->where($map)->order('reorder desc')->page($this->page, $this->pageSize)->select(); $attachmentModel = new AttachmentModel(); foreach ($res as $key => $value) { $focusPictures = $value['focus_pictures']; $postion = strpos($focusPictures, ','); //第一个逗号出现的位置,如果不存在返回false if ($postion === false) { $attchmentId = $focusPictures; } else { $length = $postion + 1; //要截取的长度 $attchmentId = substr($focusPictures, 0, $length); } $attachmentModel->setId($attchmentId); $res[$key]['image_path'] = $attachmentModel->getAttchmentPath(); } return $res; }
private function _addConsignee($payId) { $this->relation->setPayId($payId); $consignee = $this->relation->getConsignee(); $attachment = new AttachmentModel(); $attachment->setId($consignee['customer_frontid']); $consignee['frontpath'] = $attachment->getAttchmentPath(); $attachment->setId($consignee['customer_backid']); $consignee['backpath'] = $attachment->getAttchmentPath(); return $consignee; }
public function orderManageDetailsAction() { $id = I('get.id'); $map[id] = $id; $order = M('order_form'); $a = M('order_goods'); $b = M('attachment'); $c = M('goods'); $res = $order->where($map)->find(); $map1[order_id] = $id; //取订单中的商品编号 $order_goods = $a->where($map1)->field('goods_id,quantity')->select(); //取商品的图片路径 $savepath = array(); $goods = array(); $result = array(); //拼接物品详情数组 foreach ($order_goods as $key => $value) { $map2[id] = $value[goods_id]; $goods[] = $c->where($map2)->field('name,purchasing_price,discribe,id')->find(); $pictures = $c->where($map2)->field('focus_pictures')->find(); $attach_id = explode(',', $pictures[focus_pictures]); $attachmodel = new AttachmentModel(); $attachmodel->setId($attach_id[0]); $src = $attachmodel->getAttchmentPath(); $result[$key][src] = $src; $result[$key][name] = $goods[$key][name]; $result[$key][id] = $goods[$key][id]; $result[$key][purchasing_price] = $goods[$key][purchasing_price]; $result[$key][discribe] = $goods[$key][discribe]; $result[$key][quantity] = $value[quantity]; } //为原产国与配送来源拼接空格 $res[procure_source1] == "" ?: ($res[procure_source1] = $res[procure_source1] . ' '); $res[procure_source2] == "" ?: ($res[procure_source2] = $res[procure_source2] . ' '); $res[procure_source3] == "" ?: ($res[procure_source3] = $res[procure_source3] . ' '); $res[origin_company1] == "" ?: ($res[origin_company1] = $res[origin_company1] . ' '); $res[origin_company2] == "" ?: ($res[origin_company2] = $res[origin_company2] . ' '); $res[origin_company3] == "" ?: ($res[origin_company3] = $res[origin_company3] . ' '); $this->assign('goods', $result); $this->assign('order', $res); $this->assign('detail', U('Goods/GoodsDetail/index') . '?goodsId='); $this->assign("YZBody", $this->fetch()); $this->display(YZ_TEMPLATE); }