<?php
/**
* 旺铺点餐模块小程序接口定义
*
* @author 奇偶猫源码社区
* @url zh_cjdianc
*/
ini_set("memory_limit", "500M");
defined('IN_IA') or exit('Access Denied');
class Zh_cjdiancModuleWxapp extends WeModuleWxapp {
public function getapi($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
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));
} else {
$good = pdo_get('cjdc_shopcar', array('good_id' => $_GPC['good_id'], 'store_id' => $_GPC['store_id'], 'user_id' => $_GPC['user_id'], 'combination_id' => $_GPC['combination_id'], 'son_id' => 0, 'type' => 2));
}
} else {
$good = pdo_get('cjdc_shopcar', array('good_id' => $_GPC['good_id'], 'store_id' => $_GPC['store_id'], 'user_id' => $_GPC['user_id'], 'combination_id' => $_GPC['combination_id'], 'type' => 1));
}
$combination = pdo_get('cjdc_spec_combination', array('id' => $_GPC['combination_id']));
$list = pdo_get('cjdc_goods', array('id' => $_GPC['good_id']));
$user = pdo_get('cjdc_user', array('id' => $_GPC['user_id']));
$system = pdo_get('cjdc_system', array('uniacid' => $_W['uniacid']));
if ($_GPC['combination_id']) {
if ($_GPC['type'] == 2) {
$money = $combination['dn_money'];
} else {
$money =
没有合适的资源?快使用搜索试试~ 我知道了~
叮咚-超级外卖餐饮小程序V6.2.8.zip
共1900个文件
php:462个
png:392个
html:330个
需积分: 11 11 下载量 72 浏览量
2020-03-05
11:06:17
上传
评论
收藏 8.84MB ZIP 举报
温馨提示
叮咚-超级外卖餐饮小程序,测试可以使用。叮咚-超级外卖餐饮小程序V6.2.8微信小程序 开源版本,具备功能齐全,前后端均有
资源详情
资源评论
资源推荐
收起资源包目录
叮咚-超级外卖餐饮小程序V6.2.8.zip (1900个子文件)
developer.cer 50B
ygcss.css 4KB
ygcss.css 4KB
ygcsslist.css 3KB
ygcsslist.css 3KB
phpunit.xml.dist 432B
config.php.example 239B
loading.gif 76KB
stick.gif 6KB
.gitignore 171B
adddishes.html 47KB
dladddishes.html 45KB
inorder.html 40KB
dlinorder.html 40KB
addstore.html 39KB
order.html 38KB
dispatch.html 35KB
abnormal.html 33KB
allgroupgoods.html 32KB
dishes2.html 31KB
dldishes2.html 31KB
index.html 28KB
dlindex.html 28KB
groupgoods.html 27KB
dlgroupgoods.html 26KB
settings.html 24KB
capitallist.html 23KB
gaikuangdata.html 21KB
orderinfo.html 21KB
dlinorderinfo.html 20KB
inorderinfo.html 20KB
orderinfo.html 20KB
fxlist.html 19KB
dnorderinfo.html 19KB
dlindnorder.html 18KB
indnorder.html 18KB
address.html 18KB
integral.html 18KB
dnorder.html 18KB
store.html 17KB
dlindnorderinfo.html 17KB
indnorderinfo.html 17KB
template.html 16KB
qggoodall.html 15KB
storeinfo.html 15KB
ydorder.html 15KB
dlinydorder.html 15KB
inydorder.html 15KB
analysis.html 15KB
fxset.html 15KB
fxorder.html 14KB
dlinydorderinfo.html 14KB
inydorderinfo.html 14KB
ydorderinfo.html 14KB
finance.html 14KB
header.html 14KB
header.html 14KB
dlstoreinfo.html 14KB
user.html 13KB
qggoods.html 13KB
indmorder.html 13KB
dlqggoods.html 13KB
dlinsms.html 13KB
insms.html 13KB
hyuser.html 12KB
dlfinance.html 12KB
grouporder.html 12KB
zjlist.html 12KB
dlnumber.html 12KB
number.html 12KB
dladdprint.html 12KB
dlyyzjlist.html 12KB
yyzjlist.html 12KB
rider.html 12KB
dlindmorder.html 12KB
dlzjlist.html 12KB
addprint.html 12KB
addad.html 12KB
addnav.html 11KB
rzcheckinfo.html 11KB
assess.html 11KB
dlcomment.html 11KB
comment.html 11KB
dladdaccount.html 11KB
header.html 11KB
mail.html 10KB
dlqgorder.html 10KB
ptzjlist.html 10KB
dlptzjlist.html 10KB
peisongset.html 10KB
jfgoods.html 10KB
dlqgzjlist.html 10KB
qgzjlist.html 10KB
qgorderall.html 10KB
dlgrouporder.html 10KB
dldmzjlist.html 10KB
dmzjlist.html 10KB
qgorder.html 10KB
dnzjlist.html 10KB
dmorder.html 10KB
共 1900 条
- 1
- 2
- 3
- 4
- 5
- 6
- 19
qq_27210333
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0