本文整理汇总了PHP中getAttachmentUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP getAttachmentUrl函数的具体用法?PHP getAttachmentUrl怎么用?PHP getAttachmentUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAttachmentUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: one
public function one()
{
if (empty($this->user_session)) {
$referer = url('cart:one');
redirect(url('account:login', array('referer' => $referer)));
exit;
}
// 查出购物车里的产品
$cart_list = D('')->field('c.pigcms_id, c.store_id, c.product_id, c.pro_num, c.pro_price, c.sku_id, c.sku_data, p.name, p.image')->table(array('Product' => 'p', 'User_cart' => 'c'))->where("`p`.`product_id` = `c`.`product_id` AND c.uid = '" . $this->user_session['uid'] . "'")->select();
if (empty($cart_list)) {
//pigcms_tips('你的购物为空', '');
}
// 对产品按商铺进行分组
$cart_store_list = array();
$stort_id_list = array();
$total = 0;
$total_money = 0;
foreach ($cart_list as $cart) {
$cart['sku_data'] = unserialize($cart['sku_data']);
$cart['image'] = getAttachmentUrl($cart['image']);
$cart_store_list[$cart['store_id']][] = $cart;
$stort_id_list[$cart['store_id']] = $cart['store_id'];
$total += $cart['pro_num'];
$total_money += $cart['pro_num'] * $cart['pro_price'];
}
$store_name_list = M('Store')->getStoreName($stort_id_list);
$this->assign('cart_store_list', $cart_store_list);
$this->assign('store_name_list', $store_name_list);
$this->assign('total', $total);
$this->assign('total_money', $total_money);
$this->assign('step', 'one');
$this->display();
}
示例2: getProducts
public function getProducts($order_id)
{
$products = $this->db->query("SELECT p.product_id,p.name,p.image,op.pro_num,op.pro_price,op.sku_id,op.sku_data,op.comment,op.is_packaged,op.in_package_status,op.is_fx,op.original_product_id,op.is_present FROM " . option('system.DB_PREFIX') . "order_product op, " . option('system.DB_PREFIX') . "product p WHERE op.product_id = p.product_id AND op.order_id = '" . $order_id . "'");
foreach ($products as &$value) {
$value['image'] = getAttachmentUrl($value['image']);
}
return $products;
}
示例3: getFxProducts
public function getFxProducts($order_id)
{
$products = $this->db->query("SELECT p.product_id,p.name,fop.cost_price,p.image,fop.quantity,fop.price,fop.sku_id,fop.sku_data,fop.comment FROM " . option('system.DB_PREFIX') . "fx_order_product fop, " . option('system.DB_PREFIX') . "product p WHERE fop.product_id = p.product_id AND fop.fx_order_id = '" . $order_id . "'");
foreach ($products as &$tmp) {
$tmp['image'] = getAttachmentUrl($tmp['image']);
}
return $products;
}
示例4: getImages
/**
* @desc 获取商品图片
* @param $product_id
*/
public function getImages($product_id, $is_wap = false)
{
$images = $this->db->field('`image`')->where(array('product_id' => $product_id))->order('sort ASC')->select();
foreach ($images as &$value) {
$value['image'] = getAttachmentUrl($value['image']);
}
return $images;
}
示例5: getProductListByRid
/**
* 根据活动ID查寻出所有相关产品
*/
public function getProductListByRid($rid)
{
$db_prefix = option('system.DB_PREFIX');
$sql = "SELECT p.* FROM `" . $db_prefix . "reward_product` AS rp LEFT JOIN `" . $db_prefix . "product` AS p ON `rp`.`product_id` = `p`.`product_id` WHERE `rp`.`rid` = '" . $rid . "'";
$product_list = $this->db->query($sql);
foreach ($product_list as &$product) {
$product['image'] = getAttachmentUrl($product['image']);
}
return $product_list;
}
示例6: getProductListByPid
/**
* 根据赠品ID查寻出所有相关产品
*/
public function getProductListByPid($pid)
{
$db_prefix = option('system.DB_PREFIX');
$sql = "SELECT p.product_id, p.name, p.quantity, p.price, p.original_price, p.image, p.has_property FROM `" . $db_prefix . "present_product` AS pp LEFT JOIN `" . $db_prefix . "product` AS p ON `PP`.`product_id` = `p`.`product_id` WHERE `pp`.`pid` = '" . $pid . "' AND p.status = '1' AND p.quantity > 0";
$product_list = $this->db->query($sql);
foreach ($product_list as &$product) {
$product['image'] = getAttachmentUrl($product['image']);
}
return $product_list;
}
示例7: get_slider_by_key
public function get_slider_by_key($cat_key, $limit = 6)
{
if (empty($cat_key)) {
return false;
}
$adver_list = $this->db->table('Slider as s')->join('Slider_category sc On s.cat_id = sc.cat_id')->where('sc.cat_key=\'' . $cat_key . '\' and s.status=\'1\'')->limit($limit)->select();
$adverlist = array();
foreach ($adver_list as $key => $value) {
$adver_list[$key]['pic'] = getAttachmentUrl($value['pic']);
}
return $adver_list;
}
示例8: getSimpleList
/**
* 根据条件获到评论列表
* 当limit与offset都为0时,表示不行限制
* 当is_attachment为真时,需要查寻评论的图片列表,以及评论会员基本信息
*/
public function getSimpleList($limit = 0, $offset = 0, $order_by = '')
{
if (empty($order_by)) {
$order_by = "ca.id desc";
}
$where = "c.status=1 and c.has_image=1 and c.delete_flg=0 and c.type='PRODUCT'";
$group = 'c.relation_id';
$comment_list = $this->db->table("Comment as c")->join('Comment_attachment as ca ON ca.cid=c.id', 'LEFT')->where($where)->group($group)->limit($offset . ',' . $limit)->field("c.*,ca.file,ca.width,ca.height,c.relation_id")->select();
foreach ($comment_list as $k => $tmp) {
$comment_list[$k]['file'] = getAttachmentUrl($tmp['file']);
$comment_list[$k]['ilink'] = url_rewrite('goods:index', array('id' => $tmp['relation_id'])) . "#product_comment_image";
}
return $comment_list;
}
示例9: getList
public function getList($where)
{
$user_list = $this->where($where)->select();
$return_user_list = array();
foreach ($user_list as $tmp) {
if ($tmp['avatar']) {
$tmp['avatar'] = getAttachmentUrl($tmp['avatar']);
} else {
$tmp['avatar'] = getAttachmentUrl('images/touxiang.png', false);
}
$return_user_list[$tmp['uid']] = $tmp;
}
return $return_user_list;
}
示例10: getSellingCouponProduct
/**
* 根据优惠券商品 查找对应产品信息列表
* @param $where is string
* @param $orderbyfield 排序字段
* @param $orderbymethod 排序方式 ASC DESC
* @param $offset
* @param $limit
* @return array
*/
public function getSellingCouponProduct($where, $order_by_field, $order_by_method, $offset, $limit)
{
if (!empty($order_by_field) && !empty($order_by_method)) {
$order = $order_by_field . ' ' . strtoupper($order_by_method);
} else {
//默认排序
$order = 'p.sort DESC, p.product_id DESC';
}
$where = $where . " and p.status=1";
$products = $this->db->table("Coupon_to_product as cp")->join('Product as p ON cp.product_id=p.product_id', 'LEFT')->where($where)->order($order)->limit($offset . ',' . $limit)->field("p.*,cp.coupon_id")->select();
foreach ($products as &$tmp) {
$tmp['image'] = getAttachmentUrl($tmp['image']);
$tmp['link'] = url_rewrite('goods:index', array('id' => $tmp['product_id']));
}
return $products;
}
示例11: getAllCategory
public function getAllCategory($where = array())
{
$category_list = $this->db->where($where)->order('`parent_id` ASC,`order_by` DESC,`cat_id` ASC')->select();
$new_category_list = array();
foreach ($category_list as $value) {
if ($value['cat_pic']) {
$value['cat_pic'] = getAttachmentUrl($value['cat_pic']);
}
if (empty($value['parent_id'])) {
$new_category_list[$value['cat_id']] = $value;
} else {
$new_category_list[$value['parent_id']]['cat_list'][] = $value;
}
}
return $new_category_list;
}
示例12: get_adver_by_key
public function get_adver_by_key($cat_key, $limit = 3)
{
$database_adver_category = D('Adver_category');
$condition_adver_category['cat_key'] = $cat_key;
$now_adver_category = $database_adver_category->field('`cat_id`')->where($condition_adver_category)->find();
if ($now_adver_category) {
$condition_adver['cat_id'] = $now_adver_category['cat_id'];
$condition_adver['status'] = '1';
$adver_list = $this->field(true)->where($condition_adver)->order('`id` DESC')->limit($limit)->select();
foreach ($adver_list as $key => $value) {
$adver_list[$key]['pic'] = getAttachmentUrl($value['pic']);
}
return $adver_list;
} else {
return false;
}
}
示例13: getListByStoreId
public function getListByStoreId($store_id)
{
$condition = array('store_id' => $store_id, 'status' => 1);
switch ($_POST['type']) {
case 'list_image':
$condition['type'] = 0;
break;
case 'list_upload_image':
$condition['type'] = 0;
$condition['from'] = 0;
break;
case 'list_import_image':
$condition['type'] = 0;
$condition['from'] = 1;
break;
case 'list_collect_image':
$condition['type'] = 0;
$condition['from'] = 2;
break;
case 'list_voice':
$condition['type'] = 1;
break;
case 'list_upload_voice':
$condition['type'] = 1;
$condition['from'] = 0;
break;
case 'list_collect_voice':
$condition['type'] = 1;
$condition['from'] = 1;
break;
}
if ($_POST['txt']) {
$condition['name'] = array('like', '%' . $_POST['txt'] . '%');
}
$attachment_count = $this->db->where($condition)->count('pigcms_id');
import('source.class.user_page');
$p = new Page($attachment_count, 10);
$attachment_list = $this->db->where($condition)->order('`pigcms_id` DESC')->limit($p->firstRow . ',' . $p->listRows)->select();
foreach ($attachment_list as &$value) {
$value['file'] = getAttachmentUrl($value['file']);
}
$return['attachment_list'] = $attachment_list;
$return['page'] = $p->show();
return $return;
}
示例14: getListByIDList
public function getListByIDList($physical_id_list)
{
if (empty($physical_id_list) || !is_array($physical_id_list)) {
return array();
}
//$store_physical_list = $this->db->where(array('pigcms_id' => array('in', $physical_id_list)))->select();
$store_physical_list = D('')->field("`s`.`buyer_selffetch_name`, `sp`.*")->table(array('Store' => 's', 'Store_physical' => 'sp'))->where("`s`.`store_id` = `sp`.`store_id` AND `sp`.`pigcms_id` in (" . join(',', $physical_id_list) . ")")->select();
import('source.class.area');
$area_class = new area();
$return_data = array();
foreach ($store_physical_list as $value) {
$value['images_arr'] = explode(',', $value['images']);
foreach ($value['images_arr'] as &$image_value) {
$image_value = getAttachmentUrl($image_value);
}
$value['province_txt'] = $area_class->get_name($value['province']);
$value['city_txt'] = $area_class->get_name($value['city']);
$value['county_txt'] = $area_class->get_name($value['county']);
$return_data[$value['pigcms_id']] = $value;
}
return $return_data;
}
示例15: special_keyword
private function special_keyword($key, $data = array())
{
$return = array();
if ($key == '附近团购' || $key == '附近订餐') {
$dateline = time() - 3600 * 2;
if ($_lat = D("User__lat")->field(true)->where("`open_id`='{$data['FromUserName']}' AND `dateline`>'{$dateline}'")->find()) {
import('@.ORG.lat');
$lat_class = new lat();
$location2 = $lat_class->gpsToBaidu($_lat['lat'], $_lat['']);
//转换腾讯坐标到百度坐标
$x = $location2['lat'];
$y = $location2['lng'];
if ($key == '附近订餐') {
$meals = D("Merchant_store")->field("*, ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(({$x}*PI()/180-`lat`*PI()/180)/2),2)+COS({$x}*PI()/180)*COS(`lat`*PI()/180)*POW(SIN(({$y}*PI()/180-``*PI()/180)/2),2)))*1000) AS juli")->where('`have_meal`=1')->order("juli ASC")->limit("0, 10")->select();
$store_image_class = new store_image();
foreach ($meals as $meal) {
$images = $store_image_class->get_allImage_by_path($meal['pic_info']);
$meal['image'] = $images ? array_shift($images) : '';
$len = $meal['juli'] >= 1000 ? number_format($meal['juli'] / 1000, 1) . '千米' : $meal['juli'] . '米';
$return[] = array($meal['name'] . "[{$meal['adress']}]约{$len}", $meal['txt_info'], $meal['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Meal&a=menu&mer_id={$meal['mer_id']}&store_id={$meal['store_id']}");
}
} else {
$meals = D("Merchant_store")->field("*, ROUND(6378.138 * 2 * ASIN(SQRT(POW(SIN(({$x}*PI()/180-`lat`*PI()/180)/2),2)+COS({$x}*PI()/180)*COS(`lat`*PI()/180)*POW(SIN(({$y}*PI()/180-``*PI()/180)/2),2)))*1000) AS juli")->where('`have_group`=1')->order("juli ASC")->limit("0, 10")->select();
$store_image_class = new store_image();
foreach ($meals as $meal) {
$images = $store_image_class->get_allImage_by_path($meal['pic_info']);
$meal['image'] = $images ? array_shift($images) : '';
$len = $meal['juli'] >= 1000 ? number_format($meal['juli'] / 1000, 1) . '千米' : $meal['juli'] . '米';
$return[] = array($meal['name'] . "[{$meal['adress']}]约{$len}", $meal['txt_info'], $meal['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=shop&store_id={$meal['store_id']}");
}
}
}
if ($return) {
return array($return, 'news');
} else {
return array("主人【小猪猪】已经接收到你的指令请发送您的地理位置(对话框右下角点击+号,然后点击“位置”)给我哈", 'text');
}
}
if ($key == '交友') {
$return[] = array("交友约会", "结交一些朋友吃喝玩乐", $this->config['site_url'] . '/static/images/jiaoyou.jpg', $this->config['site_url'] . "/wap.php?c=Invitation&a=datelist");
return array($return, 'news');
}
$platform = D("Platform")->field(true)->where(array('key' => $key))->find();
if ($platform) {
$return[] = array($platform['title'], $platform['info'], getAttachmentUrl($platform['pic']), $platform['url']);
} else {
$keys = D("Keywords")->field(true)->where(array('keyword' => $key))->order('id DESC')->limit('0,9')->select();
$lotteryids = $mealids = $groupids = array();
foreach ($keys as $k) {
if ($k['third_type'] == 'group') {
$groupids[] = $k['third_id'];
} elseif ($k['third_type'] == 'Merchant_store') {
$mealids[] = $k['third_id'];
} elseif ($k['third_type'] == 'lottery') {
$lotteryids[] = $k['third_id'];
}
}
if ($groupids) {
$list = D("Group")->field(true)->where(array('group_id' => array('in', $groupids)))->select();
$group_image_class = new group_image();
foreach ($list as $li) {
$image = $group_image_class->get_image_by_path($li['pic'], 's');
$return[] = array($li['s_name'], $li['name'], $image, $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=detail&group_id={$li['group_id']}");
}
}
if ($mealids) {
$list = D("Merchant_store")->field(true)->where(array('store_id' => array('in', $mealids)))->select();
$store_image_class = new store_image();
foreach ($list as $now_store) {
$images = $store_image_class->get_allImage_by_path($now_store['pic_info']);
$now_store['image'] = $images ? array_shift($images) : '';
if ($now_store['have_meal']) {
$return[] = array($now_store['name'], $now_store['txt_info'], $now_store['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Meal&a=menu&mer_id={$now_store['mer_id']}&store_id={$now_store['store_id']}");
} else {
$return[] = array($now_store['name'], $now_store['txt_info'], $now_store['image'], $this->config['site_url'] . "/wap.php?g=Wap&c=Group&a=shop&store_id={$now_store['store_id']}");
}
}
}
if ($lotteryids) {
$lotterys = D("Lottery")->field(true)->where(array('id' => array('in', $lotteryids), 'statdate' => array('lt', time()), 'enddate' => array('gt', time())))->select();
foreach ($lotterys as $lottery) {
switch ($lottery['type']) {
case 1:
$return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Lottery&a=index&token={$lottery['token']}&id={$lottery['id']}");
break;
case 2:
$return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Guajiang&a=index&token={$lottery['token']}&id={$lottery['id']}");
break;
case 3:
$return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=Coupon&a=index&token={$lottery['token']}&id={$lottery['id']}");
break;
case 4:
$return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=LuckyFruit&a=index&token={$lottery['token']}&id={$lottery['id']}");
break;
case 5:
$return[] = array('[活动]' . $lottery['title'], $lottery['info'], $this->config['site_url'] . $lottery['starpicurl'], $this->config['site_url'] . "/wap.php?c=GoldenEgg&a=index&token={$lottery['token']}&id={$lottery['id']}");
break;
}
}
}
//.........这里部分代码省略.........