<?php
/**
* 易福网www.efwww.com
*/
defined('IN_IA') or exit('Access Denied');
define("YPUK_TCHK", "ypuk_tchk");
define("YPUK_TCHK_RES", "../addons/" . YPUK_TCHK . "/");
require_once IA_ROOT . "/addons/" . YPUK_TCHK . "/dbconfig.class.php";
class Ypuk_TchkModuleWxapp extends WeModuleWxapp
{
public static $PANICBUY_STATUS_WKS = 0;
//未开始
public static $PANICBUY_STATUS_ZC = 1;
//正常
public static $PANICBUY_STATUS_JS = 2;
//结束
public static $PANICBUY_STATUS_XD = 3;
//已下单
public static $PANICBUY_STATUS_GM = 4;
//等待发货
public static $PANICBUY_STATUS_YFH = 5;
//已发货
public static $PANICBUY_STATUS_YWC = 6;
//已完成
public static $PANICBUY_STATUS_YGQ = 7;
//已过期
public static $KJ_STATUS_WKS = 0;
//未开始
public static $KJ_STATUS_ZC = 1;
//正常
public static $KJ_STATUS_JS = 2;
//结束
public static $KJ_STATUS_XD = 3;
//已下单
public static $KJ_STATUS_GM = 4;
//等待发货
public static $KJ_STATUS_YFH = 5;
//已发货
public static $KJ_STATUS_YWC = 6;
//已完成
public static $KJ_STATUS_YGQ = 7;
//已过期
public static $KJ_STATUS_YTK = 9;
//已退款
public static $DEFAULT_AVATAR = '../../resource/images/default_avatar.png';
public static $DEFAULT_CARD = '../../resource/images/default_card.jpg';
public static $DEFAULT_BUINESS_LOGO = '../../resource/images/default_buiness_logo.jpg';
public static $DEFAULT_APPLY_ICON = '../../resource/images/apply_icon.png';
public static $DEFAULT_BUINESSTOP_BANNER = '../../resource/images/default_buinesstop_banner.jpg';
public static $DEFAULT_AllCAT_ICON = '../../resource/images/default_allcat_icon.png';
public static $SERVER_VERSION = '8.1.1';
public static $STATUS_WKS = 0;
//未开始
public static $STATUS_ZC = 1;
//正常
public static $STATUS_JS = 2;
//结束
public $Setting;
public $attachment_root;
public function doPageBuinessList()
{
global $_GPC, $_W;
$message = '成功';
load()->model('mc');
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$mod = $_GPC['type'];
$sort = $_GPC['sort'];
$ulat = $_GPC['ulat'];
$ulng = $_GPC['ulng'];
$searchkey = $_GPC['searchkey'];
$where = ' ';
if($mod == 'now')
{
$where .= ' AND ((starttime<'.TIMESTAMP.' AND endtime>'.TIMESTAMP.') OR discounttime=0)';
}
if($mod == 'ready')
{
$where .= ' AND starttime>'.TIMESTAMP.' AND endtime>'.TIMESTAMP.'';
}
if($sort == 'default' || $sort == '')
{
$orderby = ' ORDER BY sort ASC ';
}
if($sort == 'score' )
{
$orderby = ' ORDER BY score DESC ';
}
if(!empty($searchkey) && $searchkey !='')
{
$where .= "AND ((business_name like '%{$searchkey}
%') or (intro like '%{$searchkey}
%') or (business_address like '%{$searchkey}
%'))";
}
if($_GPC['catid'] && $_GPC['catid'] != 0)
{
$where .= ' AND catid='.$_GPC['catid'];
}
if($_GPC['regionid'] && $_GPC['regionid'] != 0)
{
$where .= ' AND regionid='.$_GPC['regionid'];
}
if($_GPC['recommend'] == 1)
{
$where .= ' AND recommend=1';
}
if($sort == 'distance')
{
$list = pdo_fetchall("SELECT *,(POWER(MOD(ABS(business_longitude - '{$ulng}
'),360),2) + POWER(ABS(business_latitude - '{$ulat}
'),2)) AS distance FROM " . tablename(DBCONFIG::$TABLE_TCHK_BUINESS) . " WHERE weid='{$_W['acid']}
'".$where." ORDER BY distance asc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
}
else
{
$list = pdo_fetchall("SELECT * FROM " . tablename(DBCONFIG::$TABLE_TCHK_BUINESS) . " WHERE weid='{$_W['acid']}
'".$where." ".$orderby." LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
}
foreach($list as $key=>$val)
{
$discount_list = pdo_fetchall("SELECT * FROM " . tablename(DBCONFIG::$TABLE_TCHK_DISCOUNT) . " WHERE weid='{$_W['acid']}
' AND businessid='{$val['id']}
' ORDER BY id DESC");
if($discount_list)
{
foreach($discount_list as $key2=>$val2)
{
if($val2['allow_cardid'] != 0)
{
$card = pdo_fetch("SELECT * FROM " . tablename(DBCONFIG::$TABLE_TCHK_CARD) . " WHERE weid='{$_W['acid']}
' AND id='{$val2['allow_cardid']}
'");
$discount_list[$key2]['cardname'] = $card['name'];
}
else
{
$discount_list[$key2]['cardname'] = '';
}
}
}
$list[$key]['discount_list'] = $discount_list;
if(!empty($ulat) && !empty($ulng) && !empty($val['business_latitude']) && !empty($val['business_longitude']))
{
$distance= $this->getdistance($ulat,$ulng,$val['business_latitude'],$val['business_longitude'],'K');
$list[$key]['distance']= round($distance,2);
}
else
{
$list[$key]['distance'] = 'nodata';
}
if($val['discounttime'] == 1)
{
if (TIMESTAMP < $val['starttime'])
{
$list[$key]['status'] = $this::$STATUS_WKS;
}
elseif(TIMESTAMP > $val['endtime'])
{
$list[$key]['status'] = $this::$STATUS_JS;
}
else
{
$list[$key]['status'] = $this::$STATUS_ZC;
}
$list[$key]['starttime'] = date('m月d日',$val['starttime']);
$list[$key]['endtime'] = date('m月d日',$val['endtime']);
}
$list[$key]['price'] = floatval($val['price']);
if(!empty($val['score']))
{
$list[$key]['score'] = $val['score'];
}
else
{
$list[$key]['score'] = '5.0';
}
if(empty($val['logo']))
{
$list[$key]['logo'] = $this::$DEFAULT_BUINESS_LOGO;
}
else
{
$list[$key]['logo'] = tomedia($val['logo']);
}
$list[$key]['hideDiscount'] = true;
}
if($_GPC['page'] == 1)
{
$usercard = $this->findUserCard($_GPC['uid']);
if(!empty($usercard))
{
$result['card'] = $usercard;
}
else
{
$result['card'] = 'nocard';
}
$setting = pdo_fetch("SELECT cardname FROM ".tablename(DBCONFIG::$TABLE_TCHK_SETTING)." WHERE weid='{$_W['acid']}
'");
if(!empty($setting['cardname']))
{
$result['cardname'] = $setting['cardname'];
}
else
{
$result['cardname'] = '黑卡';
}
}
$result['list'] = $list;
if(empty($_GPC['version']) || $_GPC['version'] < '2.4')
{
$result = $list;
}
return $this->result(0, $message, $result);
}
public function doPageBuinessTopList()
{
global $_GPC, $_W;
$message = '成功';
$id= $_GPC['id'];
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$ulat = $_GPC['ulat'];
$ulng = $_GPC['ulng'];
$businessTopInfo = pdo_fetch("SELECT * FROM " . tablename(DBCONFIG::$TABLE_TCHK_BUSINESSTOP) . " WHERE weid='{$_W['acid']}
' AND id='{$id}
'");
if(empty($businessTopInfo['banner']))
{
$businessTopInfo['banner'] = $this::$DEFAULT_BUINESSTOP_BANNER;
}
else
{
$businessTopInfo['banner'] = tomedia($businessTopInfo['banner']);
}
$list = pdo_fetchall("SELECT businessid,sort,intro FROM " . tablename(DBCONFIG::$TABLE_TCHK_BUSINESSTOP_BIND) . " WHERE weid='{$_W['acid']}
' AND topid='{$id}
' LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
if(!empty($list))
{
foreach($list as $key=>$val)
{
$buiness = pdo_fetch("SELECT * FROM".tablename(DBCONFIG::$TABLE_TCHK_BUINESS)."WHERE weid='{$_W['acid']}
' AND id='{$val['businessid']}
'");
$buiness['discount_list'] = pdo_fetchall("SELECT * FROM " . tablename(DBCONFIG::$TABLE_TCHK_DISCOUNT) . " WHERE weid='{$_W['acid']}
' AND businessid='{$val['businessid']}
' ORDER BY id DESC");
if(!empty($ulat) && !empty($ulng) && !empty($buiness['business_latitude']) && !empty($buiness['business_longitude']))
{
$distance= $this->getdistance($ulat,$ulng,$buiness['business_latitude'],$buiness['business_longitude'],'K');
$buiness['distance']= round($distance,2);
}
else
{
$buiness['distance'] = 'nodata';
}
if($buiness['discounttime'] == 1)
{
if (TIMESTAMP < $buiness['starttime'])
{
$buiness['status'] = $this::$STATUS_WKS;
}
elseif(TIMESTAMP > $buiness['endtime'])
{
$buiness['status'] = $this::$STATUS_JS;
}
else
{
$buiness['status'] = $this::$STATUS_ZC;
}
$buiness['starttime'] = date('m月d日',$buiness['starttime']);
$buiness['endtime'] = date('m月d日',$buiness['endtime']);
}
$buiness['price'] = floatval($buiness['price']);
if(!empty($buiness['score']))
{
$buiness['score'] = $buiness['score'];
}
else
{
$buiness['score'] = '5.0';
}
if(empty($buiness['logo']))
{
$buiness['logo'] = $this::$DEFAULT_BUINESS_LOGO;
}
else
{
$buiness['logo'] = tomedia($buiness['logo']);
}
$list[$key]['business'] = $buiness;
}
}
$result['list'] = $list;
if($_GPC['page'] == 1)
{
$result['buinesstopInfo'] = $businessTopInfo;
}
return $this->result(0, $message, $result);
}
public fu
没有合适的资源?快使用搜索试试~ 我知道了~
同城黑卡小程序 ypuk_tchk 8.2.0 安装更新一体包.rar

共495个文件
png:123个
js:78个
wxss:76个

需积分: 5 44 浏览量
2023-06-08
17:05:45
上传
评论
收藏 3.1MB RAR 举报
温馨提示
版权声明: 本资源仅供学习参考,不得进行任何商业用途!
资源推荐
资源详情
资源评论











收起资源包目录





































































































共 495 条
- 1
- 2
- 3
- 4
- 5
资源评论


2301_78600126
- 粉丝: 1
- 资源: 686
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


安全验证
文档复制为VIP权益,开通VIP直接复制
