<?php
defined("IN_IA") or exit("Access Denied");
global $xcmodule;
$xcmodule = "xc_train";
include_once IA_ROOT . "/addons/xc_train/common/function.php";
class Xc_trainModuleWxapp extends WeModuleWxapp
{
public function doPagePrize()
{
global $_GPC, $_W;
$uniacid = $_W["uniacid"];
if (!empty($_GPC["openid"])) {
if ($_GPC["openid"] == $_W["openid"]) {
return $this->result(1, "自己不能助力");
}
}
$active = pdo_get("xc_train_active", array("status" => 1, "uniacid" => $uniacid, "id" => $_GPC["id"]));
if ($active) {
if (intval($active["total"]) == intval($active["is_total"])) {
return $this->result(1, "活动已经结束了!");
} else {
require_once "../addons/" . $_GPC["m"] . "/resource/share/wxBizDataCrypt.php";
$appid = $_W["account"]["key"];
$sessionKey = $_SESSION["session_key"];
$encryptedData = $_GPC["encryptedData"];
$iv = $_GPC["iv"];
$pc = new WXBizDataCrypt($appid, $sessionKey);
$errCode = $pc->decryptData($encryptedData, $iv, $data);
if ($errCode == 0) {
$data = json_decode($data, true);
$opengid = $data["openGId"];
if (!empty($_GPC["openid"])) {
$prize = pdo_get("xc_train_prize", array("status" => -1, "type" => $active["type"], "cid" => $_GPC["id"], "openid" => $_GPC["openid"], "uniacid" => $uniacid));
} else {
$prize = pdo_get("xc_train_prize", array("status" => -1, "type" => $active["type"], "cid" => $_GPC["id"], "openid" => $_W["openid"], "uniacid" => $uniacid));
}
if ($prize) {
$prize["opengid"] = json_decode($prize["opengid"], true);
$common = -1;
$is_total = 0;
$i = 0;
while ($i < count($prize["opengid"])) {
if ($prize["opengid"][$i] == $opengid) {
$common = 1;
}
if (!empty($prize["opengid"][$i])) {
$is_total = $is_total + 1;
}
$i++;
}
if ($common == 1) {
if (!empty($_GPC["openid"])) {
return $this->result(1, "该群已助力");
} else {
return $this->result(1, "该群已分享");
}
} else {
$prize_bimg = '';
$condition["opengid"] = $prize["opengid"];
$condition["opengid"][intval($_GPC["share"]) - 1] = $opengid;
$condition["opengid"] = json_encode($condition["opengid"]);
if ($is_total + 1 == intval($active["share"])) {
if ($active["type"] == 1) {
$condition["status"] = 1;
$condition["prizetime"] = date("Y-m-d H:i:s");
$condition["prize"] = $active["prize"];
} else {
if ($active["type"] == 2) {
if (!empty($active["list"])) {
$id = array();
$list = json_decode($active["list"], true);
foreach ($list as $l) {
$id[] = $l["id"];
}
$gua = pdo_getall("xc_train_gua", array("status" => 1, "uniacid" => $uniacid, "id IN" => $id));
if ($gua) {
$total_times = 0;
foreach ($gua as &$g) {
$g["min"] = $total_times;
$total_times = intval($g["times"]) + $total_times;
$g["max"] = $total_times;
}
$num = rand(0, $total_times * 100);
$num = $num / 100;
foreach ($gua as $gg) {
if (floatval($gg["min"]) < floatval($num) && floatval($num) < floatval($gg["max"])) {
$condition["prize"] = $gg["name"];
$condition["pid"] = $gg["id"];
$prize_bimg = tomedia($gg["bimg"]);
}
}
}
}
}
}
}
if (!empty($_GPC["openid"])) {
$request = pdo_update("xc_train_prize", $condition, array("status" => -1, "cid" => $_GPC["id"], "openid" => $_GPC["openid"], "uniacid" => $uniacid, "type" => $active["type"]));
} else {
$request = pdo_update("xc_train_prize", $condition, array("status" => -1, "cid" => $_GPC["id"], "openid" => $_W["openid"], "uniacid" => $uniacid, "type" => $active["type"]));
}
if ($request) {
if (!empty($condition["status"])) {
pdo_update("xc_train_active", array("is_total" => intval($active["is_total"]) + 1), array("status" => 1, "uniacid" => $uniacid, "id" => $_GPC["id"]));
return $this->result(0, "分享成功", array("status" => 2, "opengid" => json_decode($condition["opengid"], true)));
} else {
$dddddd = array("status" => 1, "opengid" => json_decode($condition["opengid"], true));
if (!empty($prize_bimg)) {
$dddddd["bimg"] = $prize_bimg;
pdo_update("xc_train_active", array("is_total" => intval($active["is_total"]) + 1), array("status" => 1, "uniacid" => $uniacid, "id" => $_GPC["id"]));
}
return $this->result(0, "分享成功", $dddddd);
}
} else {
if (!empty($_GPC["openid"])) {
return $this->result(1, "助力失败");
} else {
return $this->result(1, "分享失败");
}
}
}
} else {
$condition["uniacid"] = $uniacid;
if (!empty($_GPC["openid"])) {
$condition["openid"] = $_GPC["openid"];
} else {
$condition["openid"] = $_W["openid"];
}
$condition["title"] = $active["name"];
$condit
没有合适的资源?快使用搜索试试~ 我知道了~
教育培训学校小程序v2.0.8全插件
共1614个文件
png:369个
html:328个
js:212个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 76 浏览量
2022-02-21
11:20:15
上传
评论
收藏 12.71MB ZIP 举报
温馨提示
教育培训学校小程序v2.0.8全插件
资源推荐
资源详情
资源评论
收起资源包目录
教育培训学校小程序v2.0.8全插件 (1614个子文件)
weui.css 362KB
style.css 129KB
style.css 129KB
bootstrap.min.css 118KB
custom.min.css 83KB
custom.css 82KB
custom.css 82KB
custom.min.css 81KB
font-awesome.min.css 30KB
select2-bootstrap.min.css 16KB
sweetalert2.css 15KB
select2.min.css 15KB
sweetalert2.min.css 10KB
sweetalert2.min.css 10KB
bootstrap-select.min.css 6KB
bootstrap-table.min.css 5KB
toast.min.css 4KB
style.css 4KB
poster.css 3KB
poster.css 3KB
poster.css 3KB
nprogress.min.css 1KB
switchery.min.css 682B
fontawesome-webfont.eot 59KB
loading.gif 30KB
loading.gif 30KB
xload1.gif 14KB
sweetalert2.min.js.gz 5KB
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
index.htm 305B
edit.html 63KB
edit.html 41KB
list.html 37KB
online.html 36KB
online.html 35KB
group.html 34KB
team.html 34KB
mall.html 34KB
move.html 33KB
edit.html 30KB
list.html 29KB
list.html 28KB
edit.html 28KB
withdraw.html 27KB
list.html 27KB
team.html 27KB
edit.html 27KB
edit.html 26KB
index.html 25KB
list.html 25KB
menu.html 24KB
list.html 24KB
edit.html 24KB
list.html 24KB
fen.html 24KB
order.html 24KB
score.html 24KB
edit.html 23KB
edit.html 23KB
record.html 23KB
line.html 23KB
list.html 23KB
share.html 23KB
record.html 23KB
sms.html 23KB
list.html 23KB
list.html 22KB
edit.html 22KB
list.html 22KB
list.html 22KB
edit.html 22KB
work_detail.html 21KB
sms.html 21KB
共 1614 条
- 1
- 2
- 3
- 4
- 5
- 6
- 17
资源评论
智慧浩海
- 粉丝: 1w+
- 资源: 5196
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功