<?php
/**
* 派单o2o模块小程序接口定义
* 阿 莫 之 家 提 供!
* https://www.0 7 6 6c i t y.com
*
**/
defined('IN_IA') or exit('Access Denied');
class Hyb_o2oModuleWxapp extends WeModuleWxapp {
private function send_post($url, $post_data,$method='POST') {
$postdata = http_build_query($post_data);
$options = array(
'http' => array(
'method' => $method, //or GET
'header' => 'Content-type:application/x-www-form-urlencoded',
'content' => $postdata,
'timeout' => 15 * 60 // 超时时间(单位:s)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
return $result;
}
private function https_curl_json($url,$data,$type){
if($type=='json'){
$headers = array("Content-type: application/json;charset=UTF-8","Accept: application/json","Cache-Control: no-cache", "Pragma: no-cache");
$data=json_encode($data);
}
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1); // 发送一个常规的Post请求
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);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers );
$output = curl_exec($curl);
if (curl_errno($curl)) {
echo 'Errno'.curl_error($curl);//捕抓异常
}
curl_close($curl);
return $output;
}
private function api_notice_increment($url, $data){
$ch = curl_init();
// $header = "Accept-Charset: utf-8";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
//curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$tmpInfo = curl_exec($ch);
if (curl_errno($ch)) {
return false;
}else{
return $tmpInfo;
}
}
//获取用户信息
public function doPageTyMember() {
global $_GPC, $_W;
$uniacid = $_W['uniacid'];
$openid = $_REQUEST['openid'];
$item['u_name'] = json_encode($_REQUEST['u_name']);
$item['u_thumb'] = $_REQUEST['u_thumb'];
$item['uniacid'] = $uniacid;
//查询用户信息
$user = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_userinfo")." where uniacid=:uniacid and openid=:openid ",array(":openid"=>$openid,":uniacid"=>$uniacid));
// var_dump($_REQUEST['u_name']);exit();
$res = pdo_update('hyb_o2o_userinfo', $item, array('u_id' => $user['u_id']));
$message = 'success';
$errno = 0;
return $this->result($errno, $message, $item);
}
public function doPageGetUid() {
global $_GPC, $_W;
$uniacid = $_W['uniacid'];
$result = pdo_fetch('SELECT * FROM ' . tablename('hyb_o2o_parment') . " where `uniacid`='{$uniacid}'");
$APPID = $result['appid'];
$SECRET = $result['appsecret'];
$code = trim($_REQUEST['code']);
$url = "https://api.weixin.qq.com/sns/jscode2session?appid={$APPID}&secret={$SECRET}&js_code={$code}&grant_type=authorization_code";
$data['userinfo'] = json_decode($this->httpGet($url));
$openid = $data['userinfo']->openid;
$item['uniacid'] = $uniacid;
$item['openid'] = $openid;
$user = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_userinfo")." WHERE uniacid=:uniacid and openid=:openid",array(":uniacid"=>$uniacid,":openid"=>$openid));
if (empty($user)) {
pdo_insert('hyb_o2o_userinfo', $item);
}
$data['openid'] =$openid;
$message = '返回消息';
$errno = 0;
return $this->result($errno, $message, $data);
}
private function httpGet($url) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);
return $res;
}
//查询基本信息
public function doPageBase()
{
global $_W,$_GPC;
$uniacid = $_W['uniacid'];
$list = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_base")." where uniacid=:uniacid",array(":uniacid"=>$uniacid));
$list['thumb'] = unserialize($list['thumb']);
foreach ($list['thumb'] as &$value) {
$value = $_W['attachurl'].$value;
}
return $this->result(0,"success",$list);
}
//查询门店信息
public function doPageMendian()
{
global $_W,$_GPC;
$uniacid = $_W['uniacid'];
$list = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_mendian")." where uniacid=:uniacid",array(":uniacid"=>$uniacid));
//查询是否开启分销商
$fx = pdo_fetch("SELECT * FROM ".tablename("hyb_o2o_fenxiao")." where uniacid=:uniacid",array(":uniacid"=>$uniacid));
if (!empty($fx)) {
if ($fx['is_open']=="1") {
$list['fx'] = true;
}elseif ($fx['is_open']=="2") {
$list['fx'] = false;
}
}else{
$list['fx'] = false;
}
return $this->result(0,"success",$list);
}
//查询热门城市
public function doPageRemencity()
{
global $_W,$_GPC;
$uniacid = $_W['uniacid'];
$list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_city")." where uniacid=:uniacid and tuijian=1 and parentid=0",array(":uniacid"=>$uniacid));
return $this->result(0,"success",$list);
}
//查询全部城市
public function doPageQuanbucity()
{
global $_W,$_GPC;
$uniacid = $_W['uniacid'];
$list = pdo_fetchall("SELECT * FROM ".tablename("hyb_o2o_city")." where uniacid=:uniacid and parentid=0",array(":uniacid"=>$uniacid));
$list = $this->groupByInitials($list, 'name');
return $this->result(0,"success",$list);
}
/*
城市首字母大写分组
*/
public function groupByInitials(array $data, $targetKey = 'name')
{
$data = array_map(function ($item) use ($targetKey) {
return array_merge($item, [
'initials' => $this->getInitials($item[$targetKey]),
]);
}, $data);
$data = $this->sortInitials($data);
return $data;
}
/**
* 按字母排序
* @param array $data
* @return array
*/
public function sortInitials(array $data)
{
$sortData = [];
foreach ($data as $key => $value) {
$sortData[$value['initials']][] = $value;
}
ksort($sortData);
return $sortData;
}
/**
* 获取首字母
* @param string $str 汉字字符串
* @return string 首字母
*/
public function getInitials($str)
{
if (empty($str)) {return '';}
$fchar = ord($str{0});
if ($fchar >= ord('A') && $fchar <= ord('z')) {
return strtoupper($str{0});
}
$s1 = iconv('UTF-8', 'gb2312',
没有合适的资源?快使用搜索试试~ 我知道了~
派单O2O 13.1.76.zip
共786个文件
png:225个
js:123个
wxss:92个
需积分: 38 22 下载量 176 浏览量
2021-05-10
19:45:39
上传
评论 1
收藏 5.31MB ZIP 举报
温馨提示
派单O2O内部插件 都没办法使用 因为是一个插件一个授权的 目前市场上都没人能整下来 该应用的作者也一直在修复这应用的BUG 所以有二开需求的 可以拍下 如果是无基础的直接用源码运营的 建议购买正版
资源详情
资源评论
资源推荐
收起资源包目录
派单O2O 13.1.76.zip (786个子文件)
bootstrap.min.css 141KB
font-awesome.min.css 30KB
login.css 4KB
ygcss.css 3KB
ygcsslist.css 3KB
stick.gif 6KB
fuwu.html 57KB
dlfuwu.html 38KB
shangjia.html 33KB
ordermdfw.html 29KB
storejishi.html 28KB
dlordersm.html 25KB
dlorderdd.html 25KB
orderfwdd.html 21KB
ordersjfw.html 20KB
goods.html 20KB
new.html 20KB
orderfwsm.html 20KB
ordergoods.html 19KB
gaikuangdata.html 19KB
dlistoreyuangong.html 17KB
storeyuangong.html 17KB
order.html 17KB
orderjifen.html 16KB
dlindex.html 16KB
store.html 15KB
cunchu.html 15KB
dlstoreinfo.html 14KB
fuwutype.html 12KB
headers.html 12KB
header.html 12KB
city.html 11KB
header.html 11KB
user.html 10KB
dlpaidan.html 10KB
fxlist.html 9KB
jfgoods.html 9KB
mdqiangdan.html 9KB
login.html 8KB
fxset.html 8KB
admin.html 8KB
header-cms.html 7KB
dlyingxiaoyhq.html 7KB
youhuiquan.html 7KB
qiangdan.html 7KB
base.html 7KB
usertype.html 6KB
template.html 6KB
jfthumb.html 6KB
tixian.html 6KB
dlpingjia.html 6KB
pingjiagoods.html 6KB
pingjia.html 6KB
huodong.html 6KB
jftype.html 5KB
dltixian.html 5KB
questions.html 5KB
shangjiaruzhu.html 5KB
dlyingxiao.html 5KB
yingxiao.html 5KB
fxtx.html 5KB
countadd.html 5KB
gonggao.html 5KB
pay.html 5KB
account.html 4KB
addadmin.html 4KB
goodsstyle.html 4KB
jfsz.html 4KB
peiz.html 4KB
header-bases.html 3KB
header-base.html 3KB
header-base.html 3KB
czjl.html 2KB
header-gw.html 2KB
footer-gw.html 2KB
footer-cms.html 2KB
footer.html 1KB
footer.html 1KB
footer-base.html 549B
comhead.html 360B
common.html 262B
message.html 181B
footer-base.html 171B
oleread.inc 8KB
update_login_bg.jpg 2.72MB
9602x90.jpg 28KB
54b9140683202.jpg 22KB
icon.jpg 19KB
icon.jpg 19KB
20160620233959.jpg 19KB
nopic.jpg 10KB
common.min.js 833KB
ueditor.all.min.js 361KB
echarts.min.js 278KB
highcharts.js 146KB
district.js 83KB
wxcharts.js 39KB
city.js 36KB
bootstrap.min.js 36KB
showdown.js 36KB
共 786 条
- 1
- 2
- 3
- 4
- 5
- 6
- 8
songleon7
- 粉丝: 1
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0