<?php
/**
* 志汇-同城微圈小程序模块小程序接口定义
*
* @author 易-福-网* @url
//tid3
*/
defined('IN_IA') or exit('Access Denied');
class Zh_tcwqModuleWxapp extends WeModuleWxapp {
//获取openid
public function doPageOpenid() {
global $_W, $_GPC;
$res = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
$code = $_GPC['code'];
$appid = $res['appid'];
$secret = $res['appsecret'];
$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('zhtc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
if ($openid and $openid != 'undefined') {
if ($res) {
$user_id = $res['id'];
if ($_GPC['openid']) {
$data['openid'] = $_GPC['openid'];
}
if ($_GPC['img']) {
$data['img'] = $_GPC['img'];
}
if ($_GPC['name']) {
$data['name'] = $_GPC['name'];
}
$res = pdo_update('zhtc_user', $data, array('id' => $user_id));
$user = pdo_get('zhtc_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['time'] = time();
$res2 = pdo_insert('zhtc_user', $data);
$user = pdo_get('zhtc_user', array('openid' => $openid, 'uniacid' => $_W['uniacid']));
echo json_encode($user);
}
}
}
//轮播图
public function doPageAd() {
global $_GPC, $_W;
$where = " where uniacid=:uniacid and status=1";
if ($_GPC['cityname']) {
$where .= " and (cityname LIKE concat('%', :name,'%') or cityname='全国版')";
$data[':name'] = $_GPC['cityname'];
}
$data[':uniacid'] = $_W['uniacid'];
$sql = "select * from " . tablename('zhtc_ad') . $where . " order by orderby asc";
$res = pdo_fetchall($sql, $data);
echo json_encode($res);
}
public function doPageUrl() {
global $_GPC, $_W;
echo $_W['attachurl'];
}
//url
public function doPageUrl2() {
global $_W, $_GPC;
echo $_W['siteroot'];
}
//主分类
public function doPageType() {
global $_GPC, $_W;
$res = pdo_getall('zhtc_type', array('uniacid' => $_W['uniacid'], 'state' => 1), array(), '', 'num asc');
echo json_encode($res);
}
//子分类
public function doPageType2() {
global $_GPC, $_W;
$res = pdo_getall('zhtc_type2', array('type_id' => $_GPC['id']), array(), '', 'num asc');
echo json_encode($res);
}
//发帖
public function doPagePosting() {
global $_GPC, $_W;
$system = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
// $data['details']=base64_encode($_GPC['details']);//帖子内容
$data['details'] = $_GPC['details']; //帖子内容
$data['img'] = $_GPC['img']; //帖子图片
$data['user_id'] = $_GPC['user_id']; //用户id
$data['user_name'] = $_GPC['user_name']; //姓名
$data['user_tel'] = $_GPC['user_tel']; //电话
$data['type2_id'] = $_GPC['type2_id']; //子分类id
$data['type_id'] = $_GPC['type_id']; //主分类id
$data['money'] = $_GPC['money']; //价格
$data['top_type'] = $_GPC['type']; //置顶类型
$data['address'] = $_GPC['address']; //帖子地址
$data['store_id'] = $_GPC['store_id'];
$data['cityname'] = $_GPC['cityname'];
$data['code'] = time() . $_GPC['user_id'];
$data['lat'] = $_GPC['lat'];
$data['lng'] = $_GPC['lng'];
if ($_GPC['type']) {
$data['top'] = 1;
} else {
$data['top'] = 2;
}
$data['time'] = time();
$data['uniacid'] = $_W['uniacid'];
if ($_GPC['money'] <= 0) {
if ($system['tz_audit'] == 2) {
$data['sh_time'] = time();
if ($_GPC['type'] == 1) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60;
} elseif ($_GPC['type'] == 2) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60 * 7;
} elseif ($_GPC['type'] == 3) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60 * 30;
}
$data['state'] = 2;
} else {
$data['state'] = 1;
}
} else {
if ($system['tz_audit'] == 2) {
$data['sh_time'] = time();
if ($_GPC['type'] == 1) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60;
} elseif ($_GPC['type'] == 2) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60 * 7;
} elseif ($_GPC['type'] == 3) {
$data['dq_time'] = $data['sh_time'] + 24 * 60 * 60 * 30;
}
$data['state'] = 2;
} else {
$data['state'] = 1;
}
}
$data['hb_money'] = $_GPC['hb_money']; //红包金额
$data['hb_num'] = $_GPC['hb_num']; //红包个数
$data['hb_type'] = $_GPC['hb_type']; //红包类型1.普通 2.口令
$data['hb_keyword'] = $_GPC['hb_keyword']; //红包口令
$data['hb_random'] = $_GPC['hb_random']; //随机1.是 2否
if ($_GPC['hb_random'] == 1) {
function sendRandBonus($total = 0, $count = 3) {
$input = range(0.01, $total, 0.01);
if ($count > 1) {
$rand_keys = (array) array_rand($input, $count - 1);
$last = 0;
foreach ($rand_keys as $i => $key) {
$current = $input[$key] - $last;
$items[] = $current;
$last = $input[$key];
}
}
$items[] = $total - array_sum($items);
return $items;
}
$hong = json_encode(sendRandBonus($_GPC['hb_money'], $_GPC['hb_num']));
$data['hong'] = $hong;
}
$res = pdo_insert('zhtc_information', $data);
$tz_id = pdo_insertid();
$post_id = pdo_insertid();
$a = json_decode(html_entity_decode($_GPC['sz']));
$sz = json_decode(json_encode($a), true);
// print_r($sz);die;
if ($res) {
for ($i = 0; $i < count($sz); $i++) {
$data2['label_id'] = $sz[$i]['label_id'];
$data2['information_id'] = $post_id;
$res2 = pdo_insert('zhtc_mylabel', $data2);
}
if ($system['tz_audit'] == 2) {
file_get_contents("" . $_W['siteroot'] . "app/index.php?i=" . $_W['uniacid'] . "&c=entry&a=wxapp&do=AddScore&m=zh_tcwq&user_id=" . $_GPC['user_id']); //加积分
}
//echo '1';
echo $tz_id;
} else {
echo '2';
}
}
//发帖加积分
public function doPageAddScore() {
global $_GPC, $_W;
$user_id = $_GPC['user_id'];
$system = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
if ($system['is_jf'] == 1 and $system['integral'] > 0) {
$res = pdo_update('zhtc_user', array('total_score +=' => $system['integral']), array('id' => $user_id));
if ($res) {
$data3['score'] = $system['integral'];
$data3['user_id'] = $user_id;
$data3['note'] = '发帖';
$data3['type'] = 1;
$data3['cerated_time'] = date('Y-m-d H:i:s');
$data3['uniacid'] = $_W['uniacid']; //小程序id
pdo_insert('zhtc_integral', $data3); //添加积分明细
}
}
}
//修改帖子
public function doPageUpdPost() {
global $_GPC, $_W;
$system = pdo_get('zhtc_system', array('uniacid' => $_W['uniacid']));
$tz = pdo_get('zhtc_information', array('id' => $_GPC['id']));
if ($tz['details'] != $_GPC['details']) {
$data['details'] = $_GPC['details']; //帖子内容
}
if ($tz['img'] != $_GPC['img']) {
$data['img'] = $_GPC['img']; //帖子图片
}
if ($tz['user_name'] != $_GPC['user_name']) {
$data['user_name'] = $_GPC['user_name']; //姓名
}
if ($tz['user_tel'] != $_GPC['user_tel']) {
$data['user_tel'] = $_GPC['user_tel']; //电话
}
if ($tz['address'] != $_GPC['address']) {
$data['address'] = $_GPC['address']; //帖�
没有合适的资源?快使用搜索试试~ 我知道了~
叮咚同城微圈小程序11.4.2.zip
共1500个文件
png:344个
php:290个
html:276个
需积分: 15 3 下载量 8 浏览量
2021-01-23
16:24:00
上传
评论
收藏 5.51MB ZIP 举报
温馨提示
叮咚同城微圈小程序
资源推荐
资源详情
资源评论
收起资源包目录
叮咚同城微圈小程序11.4.2.zip (1500个子文件)
developer.cer 50B
ygcss.css 4KB
ygcsslist.css 4KB
hongbao.gif 20KB
red_animation_two.gif 9KB
stick.gif 6KB
red_animation_one.gif 5KB
loading.gif 4KB
gif.gif 2KB
phone1.gif 2KB
groupgoods.html 32KB
fenlei.html 30KB
storeinfo.html 29KB
sjgroupgoods.html 28KB
storeinfo2.html 25KB
yellowtype.html 21KB
store.html 21KB
information.html 20KB
instoreinfo2.html 19KB
dlinstoreinfo2.html 19KB
sjstoreinfo.html 18KB
integral.html 18KB
storetype.html 18KB
dlinstoreinfo.html 17KB
instoreinfo.html 17KB
qggoodall.html 17KB
settings.html 15KB
user2.html 15KB
coupon.html 14KB
powers.html 14KB
goods.html 14KB
sjqggoodall.html 14KB
yellowstore.html 14KB
inindex.html 14KB
activity.html 14KB
start.html 13KB
ininformation.html 13KB
dlininformation.html 13KB
addinquiry.html 13KB
header.html 13KB
dlinactivity.html 13KB
inactivity.html 13KB
ad.html 13KB
carinfo.html 13KB
dlinaddad.html 12KB
type.html 12KB
dlinstore.html 12KB
instore.html 12KB
dlincarinfo.html 12KB
sjcoupon.html 12KB
incarinfo.html 12KB
sjstatistics.html 11KB
storecheck.html 11KB
sjgoods.html 11KB
dlinyellowstore.html 11KB
fxlist.html 11KB
addbottom.html 11KB
orderinfo.html 11KB
informationinfo.html 11KB
tzcheck.html 11KB
jfgoods.html 11KB
zxcheckmanager.html 11KB
xsdata.html 11KB
inyellowstore.html 11KB
addad.html 11KB
header.html 11KB
sjorderinfo.html 11KB
addactivity.html 10KB
dlinaddactivity.html 10KB
index.html 10KB
addyellowstore.html 10KB
grouporder.html 10KB
storetypead.html 10KB
dlininformationinfo.html 10KB
inquiry.html 10KB
ininformationinfo.html 10KB
inad.html 10KB
sjgrouporder.html 10KB
inaddactivity.html 10KB
nav.html 10KB
addnav.html 10KB
dlinad.html 10KB
template.html 10KB
dlinzxcheckmanager.html 10KB
zxtype.html 10KB
inzxcheckmanager.html 10KB
inaddad.html 9KB
addzhanghao.html 9KB
countadd.html 9KB
addsjaccount.html 9KB
login.html 9KB
yellowstoreinfo.html 9KB
inaddyellowstore.html 9KB
dlinaddyellowstore.html 9KB
videotype.html 9KB
grouporderinfo.html 9KB
inyellowstoreinfo.html 9KB
dlinyellowstoreinfo.html 9KB
ddgl.html 9KB
sjgrouporderinfo.html 9KB
共 1500 条
- 1
- 2
- 3
- 4
- 5
- 6
- 15
资源评论
qq_31654353
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功