本文整理汇总了PHP中get_spec_image函数的典型用法代码示例。如果您正苦于以下问题:PHP get_spec_image函数的具体用法?PHP get_spec_image怎么用?PHP get_spec_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_spec_image函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$root = array();
$root['response_code'] = 1;
$id = intval($_REQUEST['id']);
$email = strim($GLOBALS['request']['email']);
// 用户名或邮箱
$pwd = strim($GLOBALS['request']['pwd']);
// 密码 // 检查用户,用户密码
$user = user_check($email, $pwd);
$user_id = intval($user['id']);
$deal_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $id . " and is_delete = 0 and (is_effect = 1 or (is_effect = 0 and user_id = " . $user_id . "))");
$deal_info = cache_deal_extra($deal_info);
$page_size = $GLOBALS['m_config']['page_size'];
$page = intval($_REQUEST['p']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$support_list = $GLOBALS['db']->getAll("select user_id,price from " . DB_PREFIX . "deal_support_log where deal_id = " . $id . " order by create_time desc limit " . $limit);
$support_count = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal_support_log where deal_id = " . $id);
$user_list = array();
$user_ids = array();
foreach ($support_list as $k => $v) {
if ($v['user_id']) {
$user_ids[] = $v['user_id'];
}
}
$user_ids = array_filter($user_ids);
if ($user_ids) {
$user_id_str = implode(',', array_filter($user_ids));
$user_list_array = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "user where id in (" . $user_id_str . ") ");
foreach ($user_list_array as $k => $v) {
foreach ($support_list as $k_support => $v_support) {
if ($v['id'] == $v_support['user_id']) {
$support_list[$k_support]['user_info'] = $v;
$support_list[$k_support]['user_info']["image"] = get_user_avatar_root($v["id"], "middle");
$support_list[$k_support]['user_info']["url"] = url_root("home", array("id" => $v["user_id"]));
}
}
}
}
$root['support_list'] = $support_list;
// -----------------------------------
$virtual_person = $GLOBALS['db']->getOne("select sum(virtual_person) from " . DB_PREFIX . "deal_item where deal_id=" . $id);
// 获得该项目下的子项目的所有信息
// $deal_item_list=$GLOBALS['db']->getAll("select * from
// ".DB_PREFIX."deal_item where deal_id=".$id);
$deal_item_list = $deal_info['deal_item_list'];
foreach ($deal_item_list as $k => $v) {
// 统计每个子项目真实+虚拟(人)
$deal_item_list[$k]['virtual_person'] = $v['virtual_person'] + $v['support_count'];
// 统计所有真实+虚拟(钱)
$deal_item_list[$k]['virtual_price'] = $v['price'] * $deal_item_list[$k]['virtual_person'];
// 支付该项花费的金额
$deal_item_list[$k]['total_price'] = $v['price'] + $v['delivery_fee'];
$deal_item_list[$k]['delivery_fee_format'] = number_price_format($v['delivery_fee']);
$deal_item_list[$k]['content'] = $v['description'];
foreach ($deal_item_list[$k]['images'] as $kk => $vv) {
$deal_item_list[$k]['images'][$kk]['image'] = get_abs_img_root(get_spec_image($vv['image'], 640, 240, 1));
}
}
$root['deal_item_list'] = $deal_item_list;
$root['person'] = $virtual_person + $deal_info['support_count'];
// -----------------------------------
if ($deal_info['user_id'] > 0) {
$deal_user_info = $GLOBALS['db']->getRow("select id,user_name,province,city,intro,login_time from " . DB_PREFIX . "user where id = " . $deal_info['user_id'] . " and is_effect = 1");
if ($deal_user_info == false) {
$deal_user_info = NULL;
}
$root['deal_user_info'] = $deal_user_info;
}
// $root['support_list'] = $support_list;
$root['page'] = array("page" => $page, "page_total" => ceil($support_count / $page_size), "page_size" => intval($page_size), 'total' => intval($support_count));
output($root);
}
示例2: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$root = array();
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$uid = intval($GLOBALS['request']['uid']);
$user_info = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . $uid . " and is_effect = 1 and is_delete = 0");
if (!$user_info) {
$root['info'] = "非法的会员";
output($root);
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
$image_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_image where user_id = " . $user_info['id'] . " and topic_id > 0 order by create_time desc limit " . $limit);
$image_total = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic_image where user_id = " . $user_info['id'] . " and topic_id > 0 ");
$images = array();
foreach ($image_list as $k => $v) {
$images[$k]['photo_id'] = $v['id'];
$images[$k]['share_id'] = $v['topic_id'];
$images[$k]['img'] = get_abs_img_root(get_spec_image($v['o_path'], 200, 0, 0));
$images[$k]['height'] = floor($v['height'] * (200 / $v['width']));
}
$root['page'] = array("page" => $page, "page_total" => ceil($image_total / PAGE_SIZE));
$root['item'] = $images;
$root['return'] = 1;
output($root);
}
示例3: index
public function index()
{
require_once APP_ROOT_PATH . 'app/Lib/deal.php';
/**
* has_attr: 0:无属性; 1:有属性
* 有商品属性在要购买时,要选择属性后,才能购买
* change_cart_request_server:
* 编辑购买车商品时,需要提交到服务器端,让服务器端通过一些判断返回一些信息回来(如:满多少钱,可以免运费等一些提示)
* 0:提交,1:不提交;
* image_attr_a_id_{$attr_a_id} 图片列表,可以根据属性ID值,来切换图片列表;默认为:0
* limit_num: 库存数量
*/
$id = intval($GLOBALS['request']['id']);
//商品ID
$item = get_deal($id);
$root = getGoodsArray($item);
$root['return'] = 1;
$root['attr'] = getAttrArray($id);
$images = array();
//image_attr_1_id_{$attr_1_id} 图片列表,可以根据属性ID值,来切换图片列表
$sql = "select img from " . DB_PREFIX . "deal_gallery where deal_id = " . intval($id);
$list = $GLOBALS['db']->getAll($sql);
$gallery = array();
$big_gallery = array();
foreach ($list as $k => $image) {
$gallery[] = get_abs_img_root(get_spec_image($image['img'], 320, 320, 0));
$big_gallery[] = get_abs_img_root(get_spec_image($image['img'], 0, 0, 0));
}
$root['gallery'] = $gallery;
$root['big_gallery'] = $big_gallery;
output($root);
}
示例4: index
public function index()
{
$root = array();
$root['response_code'] = 1;
$root['kf_phone'] = $GLOBALS['m_config']['kf_phone'];
//客服电话
$root['kf_email'] = $GLOBALS['m_config']['kf_email'];
//客服邮箱
//关于我们(填文章ID)
$root['about_info'] = intval($GLOBALS['m_config']['about_info']);
$root['version'] = VERSION;
//接口版本号int
$root['page_size'] = PAGE_SIZE;
//默认分页大小
$root['program_title'] = $GLOBALS['m_config']['program_title'];
$root['site_domain'] = str_replace("/mapi", "", SITE_DOMAIN . APP_ROOT);
//站点域名;
$root['site_domain'] = str_replace("http://", "", $root['site_domain']);
//站点域名;
$root['site_domain'] = str_replace("https://", "", $root['site_domain']);
//站点域名;
/*虚拟的累计项目总个数,支持总人数,项目支持总金额*/
$virtual_effect = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "deal where is_effect = 1 and is_delete=0");
$virtual_person = $GLOBALS['db']->getOne("select sum((support_count+virtual_person)) from " . DB_PREFIX . "deal_item");
$virtual_money = $GLOBALS['db']->getOne("select sum((support_count+virtual_person)*price) from " . DB_PREFIX . "deal_item");
$root['virtual_effect'] = $virtual_effect;
//项目总个数
$root['virtual_person'] = $virtual_person;
//累计支持人
$root['virtual_money'] = number_format($virtual_money, 2);
//筹资总金额
/*虚拟的累计项目总个数,支持总人数,项目支持总金额 结束*/
/*取6个推荐项目*/
$index_list = $GLOBALS['db']->getAll(" select * from " . DB_PREFIX . "deal where is_effect=1 and is_recommend=1 order by sort desc limit 0,6");
$deal_list = array();
$time = time();
foreach ($index_list as $k => $v) {
if ($v['image'] != '') {
$v['image'] = get_abs_img_root_wap(get_spec_image($v['image'], 900, 480, 1));
}
if ($v['start_time'] > $time) {
$tmp_start_day = ceil(($v['start_time'] - $time) / 86400);
$v['show'] = "还有" . $tmp_start_day . "天开始";
} elseif ($time > $v['end_time']) {
$v['show'] = "已过期";
} else {
$tmp_end_day = ceil(($v['end_time'] - $time) / 86400);
$v['show'] = "剩余" . $tmp_end_day . "天";
}
$deal_list[] = $v;
}
$GLOBALS['tmpl']->assign('deal_list', $deal_list);
/*取3个专题*/
$topic_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "zhuanti where state=1 order by sort desc limit 0,3");
//获取所有分类
$cates = getCateList();
$GLOBALS['tmpl']->assign('topic_list', $topic_list);
$GLOBALS['tmpl']->assign('cates', $cates);
$GLOBALS['tmpl']->display("index.html");
}
示例5: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
//分页
$page = $page == 0 ? 1 : $page;
$cate_id = intval($GLOBALS['request']['cate_id']);
$city_id = intval($GLOBALS['request']['city_id']);
$page_size = PAGE_SIZE;
$limit = ($page - 1) * $page_size . "," . $page_size;
/*输出分类*/
$bigcate_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "topic_group_cate where is_effect=1 order by sort asc");
if ($cate_id > 0) {
$cate_condition = " and cate_id = " . $cate_id;
}
$sql = " select * from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} order by sort desc limit " . $limit;
$sql_count = "select count(*) from " . DB_PREFIX . "topic_group where is_effect = 1 {$cate_condition} ";
$list = $GLOBALS['db']->getAll($sql);
$count = $GLOBALS['db']->getOne($sql_count);
foreach ($list as $k => $v) {
$list[$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 300, 181, 0));
}
$page_total = ceil($count / $page_size);
$root = array();
$root['bigcate_list'] = $bigcate_list;
$root['return'] = 1;
$root['email'] = $email;
$root['f_link_data'] = get_link_list();
$root['item'] = $list;
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / $page_size), "page_size" => $page_size);
$root['page_title'] = "小组";
output($root);
}
示例6: biz_register
public function biz_register()
{
global_run();
$msg = $this->upload("biz_register", true);
$msg['origin_img'] = $msg['url'];
$msg['url'] = get_spec_image($msg['url'], 88, 75, 1);
$msg['url_path'] = $msg['url'];
ajax_return($msg);
}
示例7: format_html_content_image
/**
* 按宽度格式化html内容中的图片
* @param unknown_type $content
* @param unknown_type $width
* @param unknown_type $height
*/
function format_html_content_image($content, $width, $height = 0)
{
$res = preg_match_all("/<img.*?src=[\"|\\']([^\"|\\']*)[\"|\\'][^>]*>/i", $content, $matches);
if ($res) {
foreach ($matches[0] as $k => $match) {
$old_path = $matches[1][$k];
if (preg_match("/\\.\\/public\\//i", $old_path)) {
$new_path = get_spec_image($matches[1][$k], $width, $height, 0);
$content = str_replace($match, "<img src='" . $new_path . "' lazy='true' />", $content);
}
}
}
return $content;
}
示例8: index
public function index()
{
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$root = array();
$root['page_title'] = '投诉列表';
$root['mana_page_title'] = '投诉列表';
//检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
//经理id
$root['return'] = 1;
if ($user_id > 0) {
$root['user_login_status'] = 1;
//配置分页参数
require_once APP_ROOT_PATH . "wap/lib/page.php";
$page_size = 10;
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$sql = "SELECT\n doc.`id` AS complain_id,\n doi.`number`,\n doc.`create_time`,\n d.`id` AS deal_id,\n d.`current_price` AS price,\n d.`sub_name` AS service_name,\n d.`img` AS service_icon,\n do.`create_time` AS order_create_time \n FROM\n " . DB_PREFIX . "deal_order_complain doc \n LEFT JOIN " . DB_PREFIX . "deal_order DO \n ON doc.`order_id` = do.`id` \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON do.`id` = doi.`order_id` \n LEFT JOIN " . DB_PREFIX . "deal d \n ON doi.`deal_id`=d.`id` \n WHERE do.`type` = 0 \n AND doc.`tech_id` IN \n (SELECT \n id \n FROM\n " . DB_PREFIX . "user fu \n WHERE fu.`p_id` = " . $user_id . " \n AND fu.`service_type_id` = 2 \n AND fu.`is_delete` = 0) GROUP BY doc.`id` ORDER BY doc.`create_time` DESC limit " . $limit;
$sql_count = "SELECT \n count(*) \n FROM\n " . DB_PREFIX . "deal_order_complain doc \n LEFT JOIN " . DB_PREFIX . "deal_order DO \n ON doc.`order_id` = do.`id` \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON do.`id` = doi.`order_id` \n LEFT JOIN " . DB_PREFIX . "deal d \n ON doi.`deal_id`=d.`id` \n WHERE do.`type` = 0 \n AND doc.`tech_id` IN \n (SELECT \n id \n FROM\n " . DB_PREFIX . "user fu \n WHERE fu.`p_id` = " . $user_id . " \n AND fu.`service_type_id` = 2 \n AND fu.`is_delete` = 0) GROUP BY doc.`id` ";
$complain_list = $GLOBALS['db']->getAll($sql);
foreach ($complain_list as $key => $value) {
$value['total_price'] = format_price($value['price'] * $value['number']);
$value['price'] = format_price($value['price']);
$value['service_icon'] = get_abs_img_root(get_spec_image($value['service_icon'], 360, 288, 0));
$value['order_create_time'] = date('Y-m-d H:i', $value['order_create_time']);
$value['complain_time'] = date('Y-m-d H:i', $value['complain_time']);
$complain_list[$key] = $value;
}
//配置分页
$count = $GLOBALS['db']->getOne($sql_count);
$page_total = ceil($count / $page_size);
$root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
$root['complain_list'] = $complain_list;
} else {
$root['user_login_status'] = 0;
}
$root['user'] = $user;
$root['city_name'] = $city_name;
output($root);
}
示例9: index
public function index()
{
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$root = array();
$root['page_title'] = '订单列表';
$root['mana_page_title'] = '订单列表';
//检查用户
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
$root['return'] = 1;
if ($user_id > 0) {
$root['user_login_status'] = 1;
//配置分页参数
require_once APP_ROOT_PATH . "wap/lib/page.php";
$page_size = 10;
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$sql = "SELECT \n d.`sub_name` AS deal_name,\n d.`current_price` AS deal_price,\n d.`id` AS deal_id,\n d.`icon`,\n o.`id` AS order_id,\n o.`total_price`,\n o.`create_time`,\n o.`is_get_bonus`,\n doi.`number` \n FROM\n " . DB_PREFIX . "deal_order o \n LEFT JOIN " . DB_PREFIX . "deal d \n ON o.`deal_ids` = d.`id` \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON o.`id` = doi.`order_id` \n WHERE TYPE = 0 \n AND technician_id IN \n (SELECT \n id \n FROM\n " . DB_PREFIX . "user \n WHERE p_id = " . $user_id . " \n AND service_type_id = 2 \n AND is_delete = 0 \n AND is_effect = 1) ORDER BY o.`create_time` DESC limit " . $limit;
$sql_count = "SELECT count(o.`id`) \n FROM\n " . DB_PREFIX . "deal_order o \n LEFT JOIN " . DB_PREFIX . "deal d \n ON o.`deal_ids` = d.`id` \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON o.`id` = doi.`order_id` \n WHERE TYPE = 0 \n AND technician_id IN \n (SELECT \n id \n FROM\n " . DB_PREFIX . "user \n WHERE p_id = " . $user_id . " \n AND service_type_id = 2 \n AND is_delete = 0 \n AND is_effect = 1)";
$order_list = $GLOBALS['db']->getAll($sql);
foreach ($order_list as $key => $value) {
$value['mana_fee'] = format_price($value['total_price'] * $user['manager_commission_fee_percent'] * 0.01);
$value['deal_price'] = format_price($value['deal_price']);
$value['total_price'] = format_price($value['total_price']);
$value['create_time'] = date('Y-m-d H:i', $value['create_time']);
$value['icon'] = get_abs_img_root(get_spec_image($value['icon'], 360, 288, 0));
$order_list[$key] = $value;
}
//配置分页
$count = $GLOBALS['db']->getOne($sql_count);
$page_total = ceil($count / $page_size);
$root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
$root['order_list'] = $order_list;
} else {
$root['user_login_status'] = 0;
}
$root['user'] = $user;
$root['city_name'] = $city_name;
output($root);
}
示例10: index
public function index()
{
$root = array();
$root['return'] = 1;
$cate_list = $GLOBALS['cache']->get("MOBILE_SHARECATE_CATELIST");
if ($cate_list === false) {
//取出标签分类
$cate_list_data = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "topic_tag_cate where showin_mobile = 1 order by sort desc");
$cate_list = array();
foreach ($cate_list_data as $k => $v) {
$cate_list[$k]['cate_id'] = $v['id'];
$cate_list[$k]['cate_name'] = $v['name'];
$cate_list[$k]['desc'] = $v['sub_name'] == '' ? $v['name'] : $v['sub_name'];
$cate_list[$k]['share_count'] = $GLOBALS['db']->getOne("select count(*) from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "topic_cate_link as l on l.topic_id = t.id where l.cate_id =" . $v['id']);
//查询分类下的分享
$img_tags_data = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic as t left join " . DB_PREFIX . "topic_cate_link as l on l.topic_id = t.id where l.cate_id =" . $v['id'] . " and is_recommend = 1 and has_image = 1 order by t.create_time desc limit 5");
$img_tags = array();
foreach ($img_tags_data as $kk => $vv) {
$img_tags[$kk]['share_id'] = $vv['id'];
$topic_tags = explode(" ", $vv['tags']);
$img_tags[$kk]['tag_name'] = trim($topic_tags[0]);
$image = $GLOBALS['db']->getOne("select o_path from " . DB_PREFIX . "topic_image where topic_id = " . $vv['id'] . " limit 1");
if ($kk == 0) {
$img_tags[$kk]['img'] = get_abs_img_root(get_spec_image($image, 320, 320, 1));
} else {
$img_tags[$kk]['img'] = get_abs_img_root(get_spec_image($image, 160, 160, 1));
}
}
$cate_list[$k]['img_tags'] = $img_tags;
//查询分类下的标签
$txt_tags_data = $GLOBALS['db']->getAll("select t.* from " . DB_PREFIX . "topic_tag as t left join " . DB_PREFIX . "topic_tag_cate_link as l on l.tag_id = t.id where l.cate_id =" . $v['id'] . " order by t.sort desc limit 11");
$txt_tags = array();
foreach ($txt_tags_data as $kk => $vv) {
$txt_tags[$kk]['tag_name'] = $vv['name'];
$txt_tags[$kk]['color'] = $vv['color'];
}
$cate_list[$k]['txt_tags'] = $txt_tags;
}
$GLOBALS['cache']->set("MOBILE_SHARECATE_CATELIST", $cate_list, CACHE_TIME);
}
$root['item'] = $cate_list;
output($root);
}
示例11: index
public function index()
{
require_once APP_ROOT_PATH . "system/libs/user.php";
$uid = intval($GLOBALS['request']['uid']);
if ($uid == 0) {
$email = strim($GLOBALS['request']['email']);
$pwd = strim($GLOBALS['request']['pwd']);
$result = do_login_user($email, $pwd);
$user_data = es_session::get('user_info');
$user_data['id'] = intval($user_data['id']);
$uid = $user_data['id'];
}
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$page_size = 20;
$limit = ($page - 1) * $page_size . "," . $page_size;
$root = array();
$root['return'] = 1;
$condition = " 1 = 1 ";
$sort = "";
$condition .= " and user_id = " . $uid . " and fav_id <> 0 ";
$sort .= " order by t.create_time desc ";
$sql = "select t.id,t.fav_id,t.origin_id from " . DB_PREFIX . "topic as t where " . $condition . $sort . " limit " . $limit;
$sql_total = "select count(*) from " . DB_PREFIX . "topic as t where " . $condition;
$total = $GLOBALS['db']->getOne($sql_total);
$result = $GLOBALS['db']->getAll($sql);
$share_list = array();
foreach ($result as $k => $v) {
$share_list[$k]['share_id'] = $v['fav_id'];
$image = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "topic_image where topic_id = " . $v['origin_id'] . " limit 1");
$share_list[$k]['img'] = get_abs_img_root(get_spec_image($image['o_path'], 200, 0, 0));
$share_list[$k]['height'] = floor($image['height'] * (200 / $image['width']));
}
$root['item'] = $share_list;
//分页
$page_info['page'] = $page;
$page_info['page_total'] = ceil($total / $page_size);
$root['page'] = $page_info;
output($root);
}
示例12: index
public function index()
{
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$root = array();
$root['page_title'] = '退款列表';
//检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
//经理id
$root['return'] = 1;
if ($user_id > 0) {
$root['user_login_status'] = 1;
//配置分页参数
require_once APP_ROOT_PATH . "wap/lib/page.php";
$page_size = 10;
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$limit = ($page - 1) * $page_size . "," . $page_size;
$sql = "SELECT \n d.`sub_name` AS service_name,\n d.`icon` AS service_icon,\n d.`id` AS deal_id,\n do.`order_sn`,\n do.`create_time`,\n do.`refund_status`,\n do.`id` AS order_id \n FROM\n " . DB_PREFIX . "deal_order DO \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON do.`id` = doi.`order_id` \n LEFT JOIN " . DB_PREFIX . "deal d \n ON doi.`deal_id` = d.`id` \n WHERE do.`pay_status` = 2 \n AND do.`user_id` = " . $user_id . " \n GROUP BY do.`id` \n ORDER BY do.`create_time` limit " . $limit;
$sql_count = "SELECT \n count(*) \n FROM\n " . DB_PREFIX . "deal_order DO \n LEFT JOIN " . DB_PREFIX . "deal_order_item doi \n ON do.`id` = doi.`order_id` \n LEFT JOIN " . DB_PREFIX . "deal d \n ON doi.`deal_id` = d.`id` \n WHERE do.`pay_status` = 2 \n AND do.`user_id` = " . $user_id . " \n GROUP BY do.`id` ";
$refund_list = $GLOBALS['db']->getAll($sql);
foreach ($refund_list as $key => $value) {
$value['service_icon'] = get_abs_img_root(get_spec_image($value['service_icon'], 360, 288, 0));
$value['create_time'] = date('Y-m-d H:i:s', $value['create_time']);
$refund_list[$key] = $value;
}
//配置分页
$count = $GLOBALS['db']->getOne($sql_count);
$page_total = ceil($count / $page_size);
$root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
$root['refund_list'] = $refund_list;
} else {
$root['user_login_status'] = 0;
}
$root['user'] = $user;
$root['city_name'] = $city_name;
output($root);
}
示例13: get_user_lever_icon
/**
* $user_level_id 会员等级id
* $is_cut 是否要裁切 默认不裁切
* $width 图片宽度
* $height 图片高度
* $width,$height 都不传输入或都为零,默认是16px*17px
* */
function get_user_lever_icon($user_level_id, $is_cut = false, $width = 0, $height = 0)
{
$width = intval($width);
$height = intval($height);
$user_level = load_auto_cache("user_level");
$user_level_icon = $user_level[$user_level_id]['icon'];
if ($is_cut) {
if ($width <= 0 && $height <= 0) {
return get_spec_image($user_level_icon, 16, 17);
} else {
return get_spec_image($user_level_icon, $width, $height);
}
} else {
return $user_level_icon;
}
}
示例14: index
public function index()
{
//print_r($GLOBALS['request']);
//检查用户,用户密码
$user = $GLOBALS['user_info'];
$user_id = intval($user['id']);
$id = intval($GLOBALS['request']['id']);
$city_id = intval($GLOBALS['request']['city_id']);
$act_2 = $GLOBALS['request']['act_2'];
//子操作 空:没子操作; dz:设置打折提醒
if ($act_2 != '' && $user_id == 0) {
$root['act_2'] = $act_2;
$root['user_login_status'] = 0;
//用户登陆状态:1:成功登陆;0:未成功登陆
output($root);
}
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$sql = "select a.id,a.name,a.avg_point,a.address,a.api_address,a.supplier_id,a.tel,a.dp_count,a.avg_point,a.supplier_id as brand_id,a.brief,a.preview as logo,a.xpoint,a.ypoint,a.route,a.youhui_count,a.event_count,(select count(*) from " . DB_PREFIX . "supplier_location_dp as dp where dp.supplier_location_id = a.id and dp.status = 1) as comment_count, c.name as city_name, \n\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((a.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((a.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (a.xpoint * {$pi}) / 180 ) ) * {$r}) as distance \n\t\t from " . DB_PREFIX . "supplier_location as a " . " left outer join " . DB_PREFIX . "deal_city as c on c.id = a.city_id " . "where a.id = {$id} ";
//file_put_contents(APP_ROOT_PATH. "sjmapi/log/sql_".strftime("%Y%m%d%H%M%S",time()).".txt",$sql);
$list = $GLOBALS['db']->getRow($sql);
$root = m_merchantItem($list);
//is_auto_order 1:手机自主下单;消费者(在手机端上)可以直接给该门店支付金额
$sql = "select is_auto_order from " . DB_PREFIX . "supplier_location where id = " . $id;
$is_auto_order = $GLOBALS['db']->getOne($sql);
$root['is_auto_order'] = intval($is_auto_order);
//$root['is_auto_order'] = 0;
//其它门店
$sql = "select a.id,a.name,a.avg_point,a.address,a.api_address,a.supplier_id,a.tel,a.dp_count,a.avg_point,a.supplier_id as brand_id,a.brief,a.preview as logo,a.xpoint,a.ypoint,a.route,a.youhui_count,a.event_count,(select count(*) from " . DB_PREFIX . "supplier_location_dp as dp where dp.supplier_location_id = a.id and dp.status = 1) as comment_count, c.name as city_name,\n\t\t(ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((a.ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((a.ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (a.xpoint * {$pi}) / 180 ) ) * {$r}) as distance\n\t\tfrom " . DB_PREFIX . "supplier_location as a " . " left outer join " . DB_PREFIX . "deal_city as c on c.id = a.city_id " . "where a.id != {$id} and a.supplier_id =" . intval($root['supplier_id']);
//$root['ss'] = $sql;
$other_supplier_location = $GLOBALS['db']->getAll($sql);
if ($other_supplier_location === false) {
$root['other_supplier_location'] = array();
} else {
foreach ($other_supplier_location as $k => $v) {
$other_supplier_location[$k]['logo'] = get_abs_img_root($v['logo']);
}
$root['other_supplier_location'] = $other_supplier_location;
}
/*门店团购*/
$time = get_gmtime();
$t_where = "where b.location_id=" . $list['id'] . " and a.is_shop=0 and a.is_effect=1 and a.is_delete=0 and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0)) and a.buy_status <> 2";
$g_where = "where b.location_id=" . $list['id'] . " and a.is_shop=1 and a.is_effect=1 and a.is_delete=0 and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0)) and a.buy_status <> 2";
$y_where = "where a.is_effect = 1 and b.location_id=" . $list['id'] . " and ((" . $time . ">= a.begin_time or a.begin_time = 0) and (" . $time . "< a.end_time or a.end_time = 0))";
if ($city_id == 0) {
require_once APP_ROOT_PATH . "system/model/city.php";
$city = City::locate_city();
$city_id = $city['id'];
}
if ($city_id > 0) {
$ids = load_auto_cache("deal_city_belone_ids", array("city_id" => $city_id));
if ($ids) {
$t_where .= " and a.city_id in (" . implode(",", $ids) . ")";
$g_where .= " and a.city_id in (" . implode(",", $ids) . ")";
$y_where .= " and a.city_id in (" . implode(",", $ids) . ")";
}
}
$tuan_list = $GLOBALS['db']->getAll("select a.brief,a.auto_order,a.id,a.name,a.sub_name,a.origin_price,a.current_price,a.img,a.buy_count,a.discount from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $t_where . " order by a.sort desc,a.id desc");
$tuan_count = $GLOBALS['db']->getOne("select count(a.id) from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $t_where . "");
foreach ($tuan_list as $k => $v) {
$tuan_list[$k]['origin_price'] = round($v['origin_price'], 2);
$tuan_list[$k]['current_price'] = round($v['current_price'], 2);
if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
//手动折扣
$tuan_list[$k]['save_price'] = round($v['origin_price'] - $v['current_price'], 2);
} else {
$tuan_list[$k]['save_price'] = round($v['origin_price'] * ((10 - $v['discount']) / 10), 2);
}
if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
$tuan_list[$k]['discount'] = round($v['current_price'] / $v['origin_price'] * 10, 2);
}
$tuan_list[$k]['discount'] = round($tuan_list[$k]['discount'], 2);
$tuan_list[$k]['img'] = get_abs_img_root(get_spec_image($v['img'], 140, 85, 0));
if (empty($v['brief'])) {
$tuan_list[$k]['brief'] = $v['name'];
$tuan_list[$k]['name'] = $v['sub_name'];
}
}
if ($tuan_list === false) {
$root['tuan_list'] = array();
} else {
$root['tuan_list'] = $tuan_list;
}
$root['tuan_count'] = $tuan_count;
/*门店商品*/
$goods_list = $GLOBALS['db']->getAll("select a.brief,a.id,a.is_hot,a.name,a.sub_name,a.origin_price,a.current_price,a.img,a.buy_count,a.discount from " . DB_PREFIX . "deal as a left join " . DB_PREFIX . "deal_location_link as b on b.deal_id=a.id " . $g_where . " order by a.sort desc,a.id desc");
foreach ($goods_list as $k => $v) {
$goods_list[$k]['origin_price'] = round($v['origin_price'], 2);
$goods_list[$k]['current_price'] = round($v['current_price'], 2);
if ($v['origin_price'] > 0 && floatval($v['discount']) == 0) {
//手动折扣
$goods_list[$k]['save_price'] = round($v['origin_price'] - $v['current_price'], 2);
} else {
$goods_list[$k]['save_price'] = round($v['origin_price'] * ((10 - $v['discount']) / 10), 2);
//.........这里部分代码省略.........
示例15: index
public function index()
{
$page = intval($GLOBALS['request']['page']);
if ($page == 0) {
$page = 1;
}
$cate_id = intval($GLOBALS['request']['cate_id']);
$city_id = intval($GLOBALS['request']['city_id']);
$city_name = strim($GLOBALS['request']['city_name']);
//城市名称
$ytop = $latitude_top = floatval($GLOBALS['request']['latitude_top']);
//最上边纬线值 ypoint
$ybottom = $latitude_bottom = floatval($GLOBALS['request']['latitude_bottom']);
//最下边纬线值 ypoint
$xleft = $longitude_left = floatval($GLOBALS['request']['longitude_left']);
//最左边经度值 xpoint
$xright = $longitude_right = floatval($GLOBALS['request']['longitude_right']);
//最右边经度值 xpoint
$ypoint = $m_latitude = doubleval($GLOBALS['request']['m_latitude']);
//ypoint
$xpoint = $m_longitude = doubleval($GLOBALS['request']['m_longitude']);
//xpoint
if ($GLOBALS['request']['from'] == "wap") {
/*输出分类*/
$bigcate_list = $GLOBALS['db']->getAll("select id,name from " . DB_PREFIX . "event_cate where is_effect=1 order by sort");
/*输出商圈*/
$all_quan_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "area where city_id=" . $city_id . "");
$quan_list = array();
$quan_sub_list = array();
$quan_list[0]['id'] = 0;
$quan_list[0]['name'] = '全城';
$quan_list[0]['quan_sub'][0]['id'] = 0;
$quan_list[0]['quan_sub'][0]['pid'] = 0;
$quan_list[0]['quan_sub'][0]['name'] = '全城';
foreach ($all_quan_list as $k => $v) {
if ($v['pid'] == 0) {
$quan_list[] = $v;
}
if ($v['pid'] > 0) {
$quan_sub_list[$v['pid']][] = $v;
}
}
foreach ($quan_list as $k => $v) {
if ($v['name'] != "全城") {
if ($quan_sub_list[$v['id']] == null || $quan_sub_list[$v['id']] == '') {
$quan_list[$k]['quan_sub'] = array();
} else {
$quan_list[$k]['quan_sub'] = $quan_sub_list[$v['id']];
}
}
}
$root[quan_list] = $quan_list;
}
$keyword = strim($GLOBALS['request']['keyword']);
if ($xpoint > 0) {
$pi = 3.14159265;
//圆周率
$r = 6378137;
//地球平均半径(米)
$field_append = ", (ACOS(SIN(({$ypoint} * {$pi}) / 180 ) *SIN((ypoint * {$pi}) / 180 ) +COS(({$ypoint} * {$pi}) / 180 ) * COS((ypoint * {$pi}) / 180 ) *COS(({$xpoint} * {$pi}) / 180 - (xpoint * {$pi}) / 180 ) ) * {$r}) as distance ";
if ($ybottom != 0 && $ytop != 0 && $xleft != 0 && $xright != 0) {
$where = " ypoint > {$ybottom} and ypoint < {$ytop} and xpoint > {$xleft} and xpoint < {$xright} ";
}
$order = " distance asc,is_recommend desc,sort desc,id desc";
} else {
$field_append = $where = $order = "";
}
$limit = ($page - 1) * PAGE_SIZE . "," . PAGE_SIZE;
if ($keyword) {
$kws_div = div_str($keyword);
foreach ($kws_div as $k => $item) {
$kw[$k] = str_to_unicode_string($item);
}
$ukeyword = implode(" ", $kw);
$where .= " (match(name_match) against('" . $ukeyword . "' IN BOOLEAN MODE) or name like '%" . $keyword . "%') ";
}
$res = m_search_event_list($limit, $cate_id, $city_id, $where, $order, $field_append);
$pattern = "/<img([^>]*)\\/>/i";
$replacement = "<img width=300 \$1 />";
foreach ($res['list'] as $k => $v) {
if ($v['ypoint'] == '') {
$res['list'][$k]['ypoint'] = 0;
}
if ($v['xpoint'] == '') {
$res['list'][$k]['xpoint'] = 0;
}
$res['list'][$k]['icon'] = get_abs_img_root(get_spec_image($v['icon'], 140, 85, 0));
$res['list'][$k]['distance'] = round($v['distance']);
$res['list'][$k]['date_time'] = pass_date($v['submit_begin_time']);
$res['list'][$k]['event_begin_time'] = to_date($v['event_begin_time'], 'Y-m-d');
$res['list'][$k]['event_end_time'] = to_date($v['event_end_time'], 'Y-m-d');
$res['list'][$k]['submit_end_time'] = to_date($v['submit_end_time'], 'Y-m-d');
$res['list'][$k]['submit_begin_time'] = to_date($v['submit_begin_time'], 'Y-m-d');
$res['list'][$k]['content'] = preg_replace($pattern, $replacement, get_abs_img_root($v['content']));
}
$root = array();
$root['bigcate_list'] = $bigcate_list;
$root['return'] = 1;
$root['item'] = $res['list'];
$root['page'] = array("page" => $page, "page_total" => ceil($res['count'] / PAGE_SIZE), "page_size" => PAGE_SIZE);
//.........这里部分代码省略.........