<?php
/**
* 旺铺点餐模块小程序接口定义
* @author 阿莫之家社区
* @url http://www.0766city.com/
*/
defined('IN_IA') or exit('Access Denied');
class Zh_diancModuleWxapp extends WeModuleWxapp {
//系统信息
public function doPageSystem() {
global $_W, $_GPC;
$res = pdo_get('wpdc_system', array('uniacid' => $_W['uniacid']));
echo json_encode($res);
}
//获取openid
public function doPageOpenid() {
global $_W, $_GPC;
$res = pdo_get('wpdc_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 doPageStoreLogin() {
global $_W, $_GPC;
$user = $_GPC['user'];
$password = md5($_GPC['password']);
$res = pdo_get('wpdc_seller', array('account' => $user, 'pwd' => $password, 'uniacid' => $_W['uniacid']));
if ($res) {
echo json_encode($res);
} else {
echo '2';
}
}
//商家信息
public function doPageStore() {
global $_W, $_GPC;
if ($_GPC['user_id']) {
$data['user_id'] = $_GPC['user_id'];
$data['store_id'] = $_GPC['id'];
$data['time'] = date("Y-m-d");
$list = pdo_get('wpdc_traffic', $data);
if (!$list) {
pdo_insert('wpdc_traffic', $data);
}
}
$res = pdo_get('wpdc_store', array('uniacid' => $_W['uniacid'], 'id' => $_GPC['id']));
if ($res['img']) {
if (strlen($res['img']) > 51) {
$res['img'] = explode(',', $res['img']);
} else {
$res['img'] = array(0 => $res['img']);
}
}
if ($res['yyzz']) {
if (strlen($res['yyzz']) > 51) {
$res['yyzz'] = explode(',', $res['yyzz']);
} else {
$res['yyzz'] = array(0 => $res['yyzz']);
}
}
if ($res['environment']) {
if (strlen($res['environment']) > 51) {
$res['environment'] = explode(',', $res['environment']);
} else {
$res['environment'] = array(0 => $res['environment']);
}
}
function video($video) {
$vid = trim(strrchr($video, '/'), '/');
$vid = substr($vid, 0, -5);
$json = file_get_contents("http://vv.video.qq.com/getinfo?vids=" . $vid . "&platform=101001&charge=0&otype=json");
// echo $json;die;
$json = substr($json, 13);
$json = substr($json, 0, -1);
$a = json_decode(html_entity_decode($json));
$sz = json_decode(json_encode($a), true);
// print_R($sz);die;
$url = $sz['vl']['vi']['0']['ul']['ui']['3']['url'];
$fn = $sz['vl']['vi']['0']['fn'];
$fvkey = $sz['vl']['vi']['0']['fvkey'];
$url = $url . $fn . '?vkey=' . $fvkey;
return $url;
}
$res['store_video'] = video($res['store_video']);
echo json_encode($res);
}
//登录用户信息
public function doPageLogin() {
global $_GPC, $_W;
$openid = $_GPC['openid'];
$res = pdo_get('wpdc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
if ($res) {
$user_id = $res['id'];
$data['openid'] = $_GPC['openid'];
if ($_GPC['img']) {
$data['img'] = $_GPC['img'];
$data['name'] = $_GPC['name'];
}
$res = pdo_update('wpdc_user', $data, array('id' => $user_id));
$user = pdo_get('wpdc_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('wpdc_user', $data);
$user = pdo_get('wpdc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
echo json_encode($user);
}
}
//菜品列表
public function doPageDishes() {
global $_W, $_GPC;
// $_GPC['dishes_type']=1;
$type = pdo_getall('wpdc_type', array('uniacid' => $_W['uniacid'], 'store_id' => $_GPC['id'], 'is_open' => 1), array(), '', 'order_by ASC');
$list = pdo_getall('wpdc_dishes', array('uniacid' => $_W['uniacid'], 'is_shelves' => 1, 'dishes_type !=' => $_GPC['dishes_type'], 'store_id' => $_GPC['id']), array(), '', 'sorting 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[] = array('id' => $list[$k]['id'], 'name' => $list[$k]['name'], 'img' => $list[$k]['img'], 'num' => $list[$k]['num'], 'money' => $list[$k]['money'], 'one' => $list[$k]['one'], 'signature' => $list[$k]['signature'], 'dishes_type' => $list[$k]['dishes_type'], 'xs_num' => $list[$k]['xs_num'], 'sit_ys_num' => $list[$k]['sit_ys_num'], 'wm_money' => $list[$k]['wm_money'], 'details' => $list[$k]['details'], 'box_fee' => $list[$k]['box_fee']);
}
}
$data2[] = array('id' => $type[$i]['id'], 'type_name' => $type[$i]['type_name'], 'goods' => $data);
}
echo json_encode($data2);
}
//菜品规格
public function doPageDishesGg() {
global $_W, $_GPC;
$res = pdo_getall('wpdc_spec', array('goods_id' => $_GPC['dishes_id']));
echo json_encode($res);
}
//菜品详情
public function doPageDishesInfo() {
global $_GPC, $_W;
$res = pdo_get('wpdc_dishes', array('id' => $_GPC['id']));
$res2 = pdo_getall('wpdc_spec', array('goods_id' => $_GPC['id']));
$data['dishes'] = $res;
$data['spec'] = $res2;
echo json_encode($data);
}
//url(七牛)
public function doPageUrl() {
global $_GPC, $_W;
echo $_W['attachurl'];
}
public function doPageUrl2() {
global $_GPC, $_W;
echo $_W['siteroot'];
}
//下订单
public function doPageAddOrder() {
global $_W, $_GPC;
if ($_GPC['type'] == 1) { //外卖
$data['user_id'] = $_GPC['user_id'];
$data['order_num'] = date('YmdHis', time()) . rand(1111, 9999);
$data['state'] = 1;
$data['time'] = date("Y-m-d H:i:s", time());
$data['time2'] = time();
$data['money'] = $_GPC['money'];
$data['preferential'] = $_GPC['preferential'];
$data['tel'] = $_GPC['tel'];
$data['name'] = $_GPC['name'];
$data['note'] = $_GPC['note']; //备注
$data['address'] = $_GPC['address'];
$data['type'] = $_GPC['type'];
$data['area'] = $_GPC['area'];
$data['lat'] = $_GPC['lat'];
没有合适的资源?快使用搜索试试~ 我知道了~
餐饮外卖小程序 9.5.0.zip
共2000个文件
php:2260个
png:844个
html:476个
需积分: 9 19 下载量 183 浏览量
2019-06-28
20:42:47
上传
评论 4
收藏 9.95MB ZIP 举报
温馨提示
某宝上叫卖2000一套的小程序源码“餐饮外卖小程序”很早以前收藏的,看他们卖的太过分了。免费发出来大家研究!
资源推荐
资源详情
资源评论
收起资源包目录
餐饮外卖小程序 9.5.0.zip (2000个子文件)
bootstrap.min.css 115KB
bootstrap.min.css 115KB
nv.d3.min.css 9KB
nv.d3.min.css 9KB
ygcss.css 3KB
ygcss.css 3KB
ygcsslist.css 3KB
ygcsslist.css 3KB
style.css 2KB
style.css 2KB
dashboard.html.dist 7KB
dashboard.html.dist 7KB
file.html.dist 3KB
file.html.dist 3KB
TestCaseMethod.tpl.dist 3KB
TestCaseMethod.tpl.dist 3KB
directory.html.dist 2KB
directory.html.dist 2KB
phpmd.xml.dist 1KB
phpmd.xml.dist 1KB
mocked_class.tpl.dist 1KB
mocked_class.tpl.dist 1KB
file_item.html.dist 871B
file_item.html.dist 871B
phpunit.xml.dist 836B
phpunit.xml.dist 836B
phpunit.xml.dist 831B
phpunit.xml.dist 831B
directory_item.html.dist 821B
directory_item.html.dist 821B
proxied_method.tpl.dist 716B
proxied_method.tpl.dist 716B
phpunit.xml.dist 681B
phpunit.xml.dist 681B
phpunit.xml.dist 677B
phpunit.xml.dist 677B
phpunit.xml.dist 661B
phpunit.xml.dist 661B
phpunit.xml.dist 658B
phpunit.xml.dist 658B
phpunit.xml.dist 654B
phpunit.xml.dist 654B
mocked_method.tpl.dist 644B
mocked_method.tpl.dist 644B
phpunit.xml.dist 635B
phpunit.xml.dist 635B
method_item.html.dist 632B
method_item.html.dist 632B
phpunit.xml.dist 619B
phpunit.xml.dist 619B
phpunit.xml.dist 619B
phpunit.xml.dist 619B
phpunit.xml.dist 446B
phpunit.xml.dist 446B
coverage_bar.html.dist 305B
coverage_bar.html.dist 305B
mocked_class_method.tpl.dist 237B
mocked_class_method.tpl.dist 237B
wsdl_class.tpl.dist 179B
wsdl_class.tpl.dist 179B
unmocked_clone.tpl.dist 159B
unmocked_clone.tpl.dist 159B
mocked_static_method.tpl.dist 151B
mocked_static_method.tpl.dist 151B
mocked_clone.tpl.dist 132B
mocked_clone.tpl.dist 132B
wsdl_method.tpl.dist 60B
wsdl_method.tpl.dist 60B
trait_class.tpl.dist 55B
trait_class.tpl.dist 55B
glyphicons-halflings-regular.eot 20KB
glyphicons-halflings-regular.eot 20KB
stick.gif 6KB
stick.gif 6KB
defaultpic.gif 6KB
defaultpic.gif 6KB
arrow.gif 185B
arrow.gif 185B
dishes2.html 29KB
dishes2.html 29KB
dldishes2.html 29KB
dldishes2.html 29KB
dlindex.html 29KB
dlindex.html 29KB
index.html 29KB
index.html 29KB
ydorder.html 27KB
ydorder.html 27KB
gaikuangdata.html 21KB
gaikuangdata.html 21KB
addstore.html 20KB
addstore.html 20KB
dlinorderinfo.html 20KB
dlinorderinfo.html 20KB
inorderinfo.html 20KB
inorderinfo.html 20KB
orderinfo.html 20KB
orderinfo.html 20KB
dnorder.html 19KB
dnorder.html 19KB
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
Bala大叔
- 粉丝: 45
- 资源: 56
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功