<?php
/**
* 旺铺点餐模块小程序接口定义
*
* @author 武汉志汇科技
* @url zh_cjdianc
*/
ini_set("memory_limit", "500M");
defined('IN_IA') or exit('Access Denied');
class Zh_cjdiancModuleWxapp extends WeModuleWxapp
{
public function doPageSystem()
{
global $_W, $_GPC;
$res = pdo_get('cjdc_system', array('uniacid' => $_W['uniacid']));
if ($res['gs_img']) {
if (strpos($res['gs_img'], ',')) {
$res['gs_img'] = explode(',', $res['gs_img']);
} else {
$res['gs_img'] = array(
0 => $res['gs_img']
);
}
}
$res['attachurl'] = $_W['attachurl'];
echo json_encode($res);
}
//url(七牛)
public function doPageUrl()
{
global $_GPC, $_W;
echo $_W['attachurl'];
}
//获取openid
public function doPageOpenid()
{
global $_W, $_GPC;
$res = pdo_get('cjdc_system', array('uniacid' => $_W['uniacid']));
$code = $_GPC['code'];
$appid = $res['appid'];
$secret = $res['appsecret'];
// echo $appid;die;
$url = "https://api.weixin.qq.com/sns/jscode2session?appid=" . $appid . "&secret=" . $secret . "&js_code=" . $code . "&grant_type=authorization_code";
function httpRequest($url, $data = null)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, FALSE);
if (!empty($data)) {
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
//执行
$output = curl_exec($curl);
curl_close($curl);
return $output;
}
$res = httpRequest($url);
print_r($res);
}
//登录用户信息
public function doPageLogin()
{
global $_GPC, $_W;
$openid = $_GPC['openid'];
$res = pdo_get('cjdc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
if ($res) {
$user_id = $res['id'];
if ($_GPC['img']) {
$data['img'] = $_GPC['img'];
}
if ($_GPC['name']) {
$data['name'] = $_GPC['name'];
}
if ($_GPC['openid']) {
$data['openid'] = $_GPC['openid'];
}
$res = pdo_update('cjdc_user', $data, array('id' => $user_id));
$user = pdo_get('cjdc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
echo json_encode($user);
} else {
$data['openid'] = $_GPC['openid'];
$data['img'] = $_GPC['img'];
$data['name'] = $_GPC['name'];
$data['uniacid'] = $_W['uniacid'];
$data['join_time'] = time();
$res2 = pdo_insert('cjdc_user', $data);
$user = pdo_get('cjdc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
echo json_encode($user);
}
}
//通过用户id请求用户信息
public function doPageUserInfo()
{
global $_W, $_GPC;
$res = pdo_get('cjdc_user', array('id' => $_GPC['user_id']));
echo json_encode($res);
}
//分类列表
public function doPageDishesType()
{
global $_W, $_GPC;
$type = pdo_getall('cjdc_type', array('uniacid' => $_W['uniacid'], 'store_id' => $_GPC['store_id'], 'is_open' => 1), array(), '', 'order_by ASC');
// $list=pdo_getall('cjdc_goods',array('uniacid'=>$_W['uniacid'],'is_show'=>1,'type='=>$_GPC['type'],'store_id'=>$_GPC['id']),array(),'','sorting ASC');
$data = array();
for ($i = 0; $i < count($type); $i++) {
$list = pdo_getall('cjdc_goods', array('uniacid' => $_W['uniacid'], 'is_show' => 1, 'type !=' => $_GPC['type'], 'type_id' => $type[$i]['id'], 'store_id' => $_GPC['store_id']), array(), '', 'num ASC');
if ($list) {
$data[] = array(
'id' => $type[$i]['id'],
'type_name' => $type[$i]['type_name'],
'good' => array()
);
}
}
echo json_encode($data);
}
//分类下菜品
public function doPageDishes()
{
global $_W, $_GPC;
$res = pdo_getall('cjdc_goods', array('type_id' => $_GPC['type_id'], 'is_show' => 1, 'type !=' => $_GPC['type']), array(), '', array('num asc'));
echo json_encode($res);
}
//菜品列表
public function doPageDishesList()
{
global $_W, $_GPC;
// $type = pdo_getall('cjdc_type', array('uniacid' => $_W['uniacid'], 'store_id' => $_GPC['store_id'], 'is_open' => 1), array(), '', 'order_by ASC');
$sql = " select * from" . tablename('cjdc_type') . " where uniacid={$_W['uniacid']} and store_id={$_GPC['store_id']} and is_open=1 and id in(select type_id from" . tablename('cjdc_goods') . " where uniacid={$_W['uniacid']} and is_show=1 and type !={$_GPC['type']} and store_id={$_GPC['store_id']}) order by order_by asc";
$type = pdo_fetchall($sql);
$list = pdo_getall('cjdc_goods', array('uniacid' => $_W['uniacid'], 'is_show' => 1, 'type !=' => $_GPC['type'], 'store_id' => $_GPC['store_id']), array(), '', 'num ASC');
$data2 = array();
for ($i = 0; $i < count($type); $i++) {
$data = array();
for ($k = 0; $k < count($list); $k++) {
if ($type[$i]['id'] == $list[$k]['type_id']) {
$data[] = $list[$k];
}
}
$data2[] = array('id' => $type[$i]['id'], 'type_name' => $type[$i]['type_name'], 'good' => $data);
}
echo json_encode($data2);
}
//商品详情
public function doPageGoodInfo()
{
global $_W, $_GPC;
$good = pdo_get('cjdc_goods', array('id' => $_GPC['good_id'], 'uniacid' => $_W['uniacid']));
$spec = pdo_getall('cjdc_spec', array('good_id' => $_GPC['good_id'], 'uniacid' => $_W['uniacid']), array(), '', 'num asc');
$specval = pdo_getall('cjdc_spec_val', array('uniacid' => $_W['uniacid']), array(), '', 'num asc');
$data2 = array();
for ($i = 0; $i < count($spec); $i++) {
$data = array();
for ($k = 0; $k < count($specval); $k++) {
if ($spec[$i]['id'] == $specval[$k]['spec_id']) {
$data[] = array(
'spec_val_id' => $specval[$k]['id'],
'spec_val_name' => $specval[$k]['name'],
'spec_val_num' => $specval[$k]['num']
);
}
}
$data2[] = array(
'spec_id' => $spec[$i]['id'],
'spec_name' => $spec[$i]['name'],
'spec_num' => $spec[$i]['num'],
'spec_val' => $data
);
}
$good['spec'] = $data2;
echo json_encode($good);
}
//规格组合
public function doPageGgZh()
{
global $_W, $_GPC;
$res = pdo_get('cjdc_spec_combination', array('combination' => $_GPC['combination'], 'good_id' => $_GPC['good_id']));
$good = pdo_get('cjdc_goods', array('id' => $_GPC['good_id']));
$res['box_money'] = $good['box_money'];
echo json_encode($res);
}
//添加购物车
public function doPageAddCar()
{
global $_W, $_GPC;
if ($_GPC['type'] == 2) {
if ($_GPC['son_id']) {
$good = pdo_get('cjdc_shopcar', array('good_id' => $_GPC['good_id'], 'store_id' => $_GPC['store_id'], 'son_id' => $_GPC['son_id'], 'dr_id' => $_GPC['dr_id'], 'user_id' => $_GPC['user_id'], 'combination_id' => $_GPC['combination_id'], 'type' => 2));
} els
没有合适的资源?快使用搜索试试~ 我知道了~
志汇超级外卖餐饮小程序 zh_cjdianc 5.8.0安装更新一体包.rar
共1430个文件
php:322个
png:310个
html:298个
需积分: 5 0 下载量 105 浏览量
2023-06-09
10:46:31
上传
评论
收藏 7.22MB RAR 举报
温馨提示
本资料仅供学习参考
资源推荐
资源详情
资源评论
收起资源包目录
志汇超级外卖餐饮小程序 zh_cjdianc 5.8.0安装更新一体包.rar (1430个子文件)
developer.cer 50B
ygcss.css 3KB
ygcsslist.css 3KB
ed8a568f97105f888cc924516b3b058b.gif 1.01MB
loading.gif 76KB
stick.gif 6KB
jsfw.gif 2KB
aqyw.gif 2KB
kcpx.gif 2KB
baxg.gif 1KB
dh03.gif 1KB
zdms.gif 1KB
1.gif 1KB
wlwy.gif 1KB
yjcp.gif 1KB
gzhxg.gif 1KB
dh01.gif 1KB
qtlx.gif 1KB
pthd.gif 1KB
dh04.gif 1KB
dh05.gif 1KB
dh02.gif 1002B
gywm.gif 985B
fxzx.gif 813B
sjqy.gif 678B
adddishes.html 46KB
dladddishes.html 45KB
addstore.html 35KB
dlinorder.html 33KB
allgroupgoods.html 32KB
dldishes2.html 31KB
dishes2.html 31KB
inorder.html 29KB
order.html 28KB
dlindex.html 28KB
index.html 28KB
groupgoods.html 27KB
dlgroupgoods.html 26KB
gaikuangdata.html 21KB
orderinfo.html 20KB
settings.html 19KB
dlinorderinfo.html 19KB
inorderinfo.html 19KB
fxlist.html 19KB
store.html 18KB
integral.html 17KB
dlindnorder.html 17KB
dnorder.html 17KB
indnorder.html 17KB
dlindnorderinfo.html 16KB
indnorderinfo.html 16KB
dnorderinfo.html 16KB
qggoodall.html 15KB
storeinfo.html 15KB
analysis.html 15KB
fxset.html 15KB
dlinydorder.html 15KB
inydorder.html 15KB
ydorder.html 14KB
dlinanalysis.html 14KB
inanalysis.html 14KB
dlinydorderinfo.html 14KB
ydorderinfo.html 14KB
inydorderinfo.html 14KB
header.html 14KB
dlstoreinfo.html 14KB
qggoods.html 13KB
dlqggoods.html 13KB
user.html 13KB
fxorder.html 13KB
indmorder.html 13KB
hyuser.html 12KB
dlfinance.html 12KB
finance.html 12KB
zjlist.html 12KB
dlnumber.html 12KB
number.html 12KB
grouporder.html 12KB
dladdprint.html 12KB
dlyyzjlist.html 12KB
yyzjlist.html 12KB
dlzjlist.html 12KB
addprint.html 12KB
template.html 12KB
dlindmorder.html 12KB
addad.html 11KB
rzcheckinfo.html 11KB
addnav.html 11KB
assess.html 11KB
dlcomment.html 11KB
comment.html 11KB
dladdaccount.html 11KB
header.html 11KB
mail.html 10KB
dlqgorder.html 10KB
dlptzjlist.html 10KB
jfgoods.html 10KB
ptzjlist.html 10KB
dlqgzjlist.html 10KB
qgorderall.html 10KB
共 1430 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
资源评论
2301_78600126
- 粉丝: 1
- 资源: 686
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功