<?php
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));
}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']));
if($_GPC['combination_id']){
$kc=$combination['number'];
}else{
$kc=$list['inventory'];
}
if(!$_GPC['combination_id'] and $list['restrict_num']>0 and $good['num']==$list['restrict_num']){
echo '超出购买限制!';
}else{
if(($_GPC['num']+$good['num'])>$kc){
echo '超出库存!';
}else{
if($good){
$data['num']=$_GPC['num']+$good['num'];
$res=pdo_update('cjdc_shopcar',$data,array('id'=>$good['id']));
}else{
if($_GPC['type']==2){
$data['type']=$_GPC['type'];
}
if($_GPC['son_id']){
$data['son_id']=$_GPC['son_id'];
$data['dr_id']=$_GPC['dr_id'];
}
$data['good_id']=$_GPC['good_id'];
$data['store_id']=$_GPC['store_id'];
$data['user_id']=$_GPC['user_id'];
$data['box_money']=$_GPC['box_money'];
$data['num']=$_GPC['num'];
$data['spec']=$_GPC['spec'];
$data['money']=$_GPC['money'];
$data['combination_id']=$_GPC['combination_id'];
$res=pdo_insert('cjdc_shopcar',$data);
}
if($res){
echo '1';
}else{
echo '2';
}
没有合适的资源?快使用搜索试试~ 我知道了~
志汇超级外卖小程序 zh_cjdianc 5.7.5全开源版安装更新一体包.rar
共1332个文件
php:309个
html:287个
png:284个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 33 浏览量
2021-09-28
13:55:17
上传
评论
收藏 5.32MB RAR 举报
温馨提示
志汇超级外卖小程序 zh_cjdianc 5.7.5全开源版安装更新一体包.rar
资源推荐
资源详情
资源评论
收起资源包目录
志汇超级外卖小程序 zh_cjdianc 5.7.5全开源版安装更新一体包.rar (1332个子文件)
developer.cer 50B
ygcss.css 3KB
ygcsslist.css 3KB
loading.gif 76KB
stick.gif 6KB
adddishes.html 46KB
dladddishes.html 45KB
addstore.html 34KB
allgroupgoods.html 32KB
dldishes2.html 31KB
dishes2.html 31KB
dlinorder.html 31KB
dlindex.html 28KB
index.html 28KB
groupgoods.html 27KB
inorder.html 27KB
order.html 27KB
dlgroupgoods.html 26KB
gaikuangdata.html 21KB
orderinfo.html 20KB
dlinorderinfo.html 19KB
inorderinfo.html 19KB
fxlist.html 19KB
settings.html 18KB
store.html 18KB
integral.html 17KB
dlindnorder.html 16KB
dnorder.html 16KB
indnorder.html 16KB
dlindnorderinfo.html 16KB
indnorderinfo.html 16KB
dnorderinfo.html 16KB
qggoodall.html 15KB
storeinfo.html 15KB
analysis.html 15KB
dlinydorder.html 15KB
inydorder.html 15KB
ydorder.html 14KB
fxset.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
finance.html 12KB
dlnumber.html 12KB
zjlist.html 12KB
dlzjlist.html 12KB
number.html 12KB
grouporder.html 12KB
dladdprint.html 12KB
dlyyzjlist.html 12KB
yyzjlist.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
qgzjlist.html 10KB
peisongset.html 10KB
dldnzjlist.html 10KB
dldmzjlist.html 10KB
dnzjlist.html 10KB
qgorder.html 10KB
dmzjlist.html 10KB
dlgrouporder.html 10KB
insms.html 10KB
table.html 10KB
dmorder.html 10KB
dlfinance.html 10KB
dltableorder.html 9KB
tableorder.html 9KB
addqggoods.html 9KB
dlgrouporderinfo.html 9KB
ruzhuinfo.html 9KB
txlist.html 9KB
dlservice.html 9KB
service.html 9KB
grouporderinfo.html 9KB
dlpeisongset.html 9KB
ad.html 9KB
共 1332 条
- 1
- 2
- 3
- 4
- 5
- 6
- 14
资源评论
等天晴i
- 粉丝: 3526
- 资源: 10万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功