Commit 6c9a359f by biao

1111

parent d1535e5e
......@@ -46,6 +46,9 @@ define("WECHAT_AUTH_TOKEN","COMPASS");
define("WECHAT_PAY_MCHID","1371137902");
define("WECHAT_PAY_KEY","a1b2c3defghijKlmnopqrstuvwx4y5z6");
//DEBUG MODE
define("DEBUG_MODE", true);
//腾讯lbs
define("LBS_KEY","TMJBZ-MTX3G-MPFQT-INGZP-VQVTK-WLFM3");
define("LBS_SECRET","BYLkXP9bZaQhI1ELr6HWkHRuKm1YPU");
......
......@@ -12,6 +12,10 @@ $needCheck = ParamUtil::getRequestBoolean("needCheck", false);//圈子名称
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$province = ParamUtil::getRequestString("province");
$city = ParamUtil::getRequestString("city");
$district = ParamUtil::getRequestString("district");
$result = array();
//参数检查
......@@ -43,22 +47,6 @@ if($circleCount > 0) {
responseNG($result);
}
//调用腾讯LGS服务解析用户地址信息
$tmpUrl = '/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . LBS_SECRET;
$md5Str = md5($tmpUrl);
$lbsUrl = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . '&sig=' . $md5Str;
$lbsObj = file_get_contents($lbsUrl);
$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码
$lbsArray = get_object_vars($jsonObj);//转换成数组
$resultObj = $lbsArray['result'];
//地理位置获取正常的情况下设定。 156:中国代码
if($lbsArray['status'] == "0" && $resultObj->ad_info->nation_code==156) {
//保存到用户当前地理位置中
$province = $resultObj->address_component->province;
$city = $resultObj->address_component->city;
$district = $resultObj->address_component->district;
}
//建立圈子
$circleDat = new CircleDat();
$circleDat->title = $title;
......
......@@ -70,7 +70,7 @@ if($courseMediaDat->course_id == 0) {
if(!empty($tmpList)) {
foreach($tmpList as $tmp) {
$tmp->haveBuy = false;
if(!$tmp->is_free) {
if(!$tmp->is_free==false) {
//收费课程的情况下,判断用户是否已经购买本课程
$param = array();
$param['user_id'] = $userMst->id;
......
<?php
// 根据经纬度换取省市等信息
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_location_place.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$longitude = ParamUtil::getRequestString("longitude");//用户位置的经度
$latitude = ParamUtil::getRequestString("latitude");//用户位置的纬度
$result = array();
//用户所在【省市区】
//调用腾讯LGS服务解析用户地址信息
$tmpUrl = '/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . LBS_SECRET;
$md5Str = md5($tmpUrl);
$lbsUrl = 'https://apis.map.qq.com/ws/geocoder/v1?key=' . LBS_KEY . '&location=' . $latitude . ',' . $longitude . '&sig=' . $md5Str;
$lbsObj = file_get_contents($lbsUrl);
$jsonObj = json_decode($lbsObj); //对JSON格式的字符串进行编码
$lbsArray = get_object_vars($jsonObj);//转换成数组
if(isset($lbsArray['result'])) {
$resultObj = $lbsArray['result'];
//地理位置获取正常的情况下设定。 156:中国代码
if($lbsArray['status'] == "0" && $resultObj->ad_info->nation_code==156) {
//保存到用户当前地理位置中
$result["province"] = $resultObj->address_component->province;
$result["city"] = $resultObj->address_component->city;
$result["district"] = $resultObj->address_component->district;
}
} else {
$result["message"] = "参数错误!";
responseNG($result);
}
ErrorLogger::doOutput("Compass...ajax_get_location_place.php....End.", 0);
//返回结果
responseOK($result);
function responseNG($result) {
$result = array("status"=>"NG", "result"=>$result);
print json_encode($result);
exit;
}
function responseOK($result) {
$result = array("status"=>"OK", "result"=>$result);
print json_encode($result);
exit;
}
?>
\ No newline at end of file
<?php
// 根据课程id获取课程详细信息
require_once ("../user_include.inc");
ErrorLogger::doOutput("Compass...ajax_get_play_media_detail.php....Start.", 0);
//获取参数
$unionId = ParamUtil::getRequestString("unionId");
$mediaId = ParamUtil::getRequestNumber("mediaId", 0);
//参数检查
if(empty($unionId) || empty($mediaId)) {
$result["message"] = "参数错误!";
responseNG($result);
}
//判断用户是否存在
$param = array();
$param['unionid'] = $unionId;
$param['delete_flg'] = false;
$userMstList = UserMst::getList($param,'id','desc', 0, 1);
if(empty($userMstList)) {
$result["message"] = "用户不存在!";
responseNG($result);
}
$userMst = $userMstList[0];
$result = array();
//判断视频是否存在
$courseMediaDat = CourseMediaDat::getById($mediaId);
if(empty($courseMediaDat)) {
$result["message"] = "视频不存在!";
responseNG($result);
}
$courseMediaDat->haveBuy = false;
//付费会员、教育局领导、学校负责人、班级负责人可以免费观看
if($userMst->is_member || $userMst->role == 4 || $userMst->school_owner || $userMst->class_owner) {
$courseMediaDat->haveBuy = false;
} else {
//收费课程判断用户是否已经购买
if($courseMediaDat->is_free==false) {
//收费课程的情况下,判断用户是否已经购买本课程
$param = array();
$param['user_id'] = $userMst->id;
$param['media_id'] = $courseMediaDat->id;
$param['is_free'] = false;
$param['status'] = 'SUCCESS';
$param['delete_flg'] = false;
$userMstBuyList = UserMediaDat::getList($param, "id", "desc", 0, 1);
if(!empty($userMstBuyList)) {
$courseMediaDat->haveBuy = true;
}
}
}
//添加播放次数[观看次数+1]
$courseMediaDat->view_count++;
$courseMediaDat->save();
//添加用户播放记录
//添加用户观看记录(已经观看过则更新时间变成最后观看)
$param['user_id'] = $userMst->id;
$param['course_id'] = $courseMediaDat->course_id;
$param['media_id'] = $mediaId;
$param['delete_flg'] = false;
$tmpUserMediaDatList = UserMediaDat::getList($param,'id','desc', 0, 1);
if(empty($tmpUserMediaDatList)) {
//第一次观看则添加记录
$userMstMediaDat = new UserMediaDat();
$userMstMediaDat->user_id = $userMst->id;
$userMstMediaDat->course_id = $courseMediaDat->course_id;
$userMstMediaDat->media_id = $mediaId;
$userMstMediaDat->is_free = $courseMediaDat->is_free;
$userMstMediaDat->money = $courseMediaDat->price;
$userMstMediaDat->save();
} else {
//以前有观看记录则修改观看时间
$tmpUserMediaDatList[0]->registration_date = date("Y-m-d H:i:s");
$tmpUserMediaDatList[0]->save();
}
//接口返回数据
$result["courseMediaDat"] = $courseMediaDat;
ErrorLogger::doOutput("Compass...ajax_get_play_media_detail.php....End.", 0);
//返回结果
responseOK($result);
function responseNG($result) {
$result = array("status"=>"NG", "result"=>$result);
print json_encode($result);
exit;
}
function responseOK($result) {
$result = array("status"=>"OK", "result"=>$result);
print json_encode($result);
exit;
}
?>
\ No newline at end of file
......@@ -42,9 +42,11 @@ $userMst = $userList[0];
//志愿者活动
$param = array();
$param['province'] = $province;
$param['city'] = $city;
$param['district'] = $district;
if(DEBUG_MODE==false) {
$param['province'] = $province;
$param['city'] = $city;
$param['district'] = $district;
}
$param['status'] = "OK";
$param['delete_flg'] = false;
//社会用户和机构用户的时候,添加【是否允许社会人士参加】
......
{
"pages": [
"pages/my/my",
"pages/circle/circle",
"pages/index/index",
"pages/my/my",
"pages/familyEvent/familyEvent",
"pages/socialEvent/socialEvent",
"pages/checkJoinCircle/checkJoinCircle",
......@@ -12,7 +13,6 @@
"pages/donationDetail/donationDetail",
"pages/donationIndex/donationIndex",
"pages/userDonation/userDonation",
"pages/circle/circle",
"pages/searchCircle/searchCircle",
"pages/newCircleEvent/newCircleEvent",
"pages/circleDetails/circleDetails",
......@@ -80,6 +80,7 @@
},
"tabBar": {
"selectedColor": "#1296db",
"borderStyle":"white",
"list": [
{
"pagePath": "pages/index/index",
......
......@@ -43,6 +43,14 @@ video, live-player, live-pusher, open-data, web-view {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.listVolunteers>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
}
.activelist{
width: 92%;
......@@ -188,6 +196,14 @@ video, live-player, live-pusher, open-data, web-view {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.listPractice>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
}
.left_listPractice{
width: 30%;
......@@ -214,19 +230,26 @@ video, live-player, live-pusher, open-data, web-view {
color: #000;
}
.listPublicWelfare>view{
width: 94%;
width: 90%;
height: 110px;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
}
.listPublicWelfare>view>text{
display: block;
width: 90%;
height: 1px;
background: #f6f6f6;
margin: 0 auto;
}
.left_listPublicWelfare{
width: 30%;
height: 80px;
border-radius: 5px;
overflow: hidden;
margin-left: 15px;
position: relative;
}
.left_listPublicWelfare>image{
......@@ -241,7 +264,12 @@ video, live-player, live-pusher, open-data, web-view {
}
.right_listPublicWelfare>text{
display: block;
margin-top: 5px;
font-size: 12px;
}
.right_listPublicWelfare .activeTitle{
font-size: 13px;
font-weight: bold;
color: #000;
}
.right_listPublicWelfare>view{
height: 35px;
......@@ -260,11 +288,10 @@ video, live-player, live-pusher, open-data, web-view {
color: #666;
}
.conSwiper{
width: 92%;
width: 90%;
height: 40px;
margin: 20px auto;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
background: #f6f6f6;
......@@ -272,13 +299,21 @@ video, live-player, live-pusher, open-data, web-view {
box-sizing: border-box;
padding: 0 10px;
}
.conSwiper>image{
width: 20px;
height: 20px;
margin-right: 5px;
}
.conSwiper>view{
width: 60px;
flex: 1;
height: 25px;
background: #0D76ED;
color: #fff;
color: #F2A508;
font-size: 12px;
line-height: 25px;
text-align: center;
text-align: right;
border-radius: 5px;
}
.lookmore{
color: #599eff!important;
}
\ No newline at end of file
{
"usingComponents": {}
"usingComponents": {
},
"navigationBarBackgroundColor": "#5c5bf4"
}
\ No newline at end of file
<!--pages/index/index.wxml-->
<view class='indexBox'>
<view class="indexSwiper page-section-spacing swiper">
<swiper indicator-dots="{{false}}"
autoplay="true" interval="2000" duration="500">
<swiper-item>
<view class="indexHeader">
<view class='con_indexHeader'>
<image src='../../img/1.jpg'></image>
</swiper-item>
</swiper>
<!-- <image src='../../img/1.jpg'></image> -->
<text class='title' bindtap='authorize'>欢迎回来·{{roleTitle}}</text>
</view>
<van-grid>
<van-grid-item icon="../../img/1.png" text="志愿活动" bindtap="volunteers" />
<van-grid-item icon="../../img/2.png" text="社会实践" wx:if="{{showSocial}}" bindtap="socialEvent" />
<van-grid-item icon="../../img/2.png" text="亲子活动" wx:if="{{showFamily}}" bindtap="familyEvent" />
<van-grid-item icon="../../img/3.png" text="公益课堂" bindtap="mediaCourse" />
<van-grid-item icon="../../img/4.png" text="消息通知" wx:if="{{showNews}}" bindtap="news" />
<van-grid-item icon="../../img/4.png" text="区域管理" bindtap="area" wx:if="{{role==4}}" />
</van-grid>
</view>
<view class='title' bindtap='authorize'><image src='../../img/touxiang.png'></image>{{roleTitle}}欢迎回来</view>
</view>
<view class='girdList'>
<view bindtap="volunteers">
<image src='../../img/1.png'></image>
<view>志愿活动</view>
</view>
<view wx:if="{{showSocial}}" bindtap="socialEvent">
<image src='../../img/2.png'></image>
<view>社会实践</view>
</view>
<view wx:if="{{showFamily}}" bindtap="familyEvent">
<image src='../../img/2.png'></image>
<view>亲子活动</view>
</view>
<view bindtap="mediaCourse">
<image src='../../img/3.png'></image>
<view>公益课堂</view>
</view>
<view wx:if="{{showNews}}" bindtap="news">
<image src='../../img/4.png'></image>
<view>消息通知</view>
</view>
<view bindtap="area" wx:if="{{role==4}}">
<image src='../../img/4.png'></image>
<view>区域管理</view>
</view>
</view>
<view class='conSwiper'>
购买中国志愿者会员,公益视频免费看!<view bindtap='memberChange'>详情</view>
<image src='../../img/dongNews.png'></image>购买中国志愿者会员,公益视频免费看!<view bindtap='memberChange'>详情</view>
</view>
<view class='volunteers'>
<view class='topTitle'>
<view>
<view class='line'></view>
<view class='leftLine'></view>
<text>志愿者活动</text>
<view class='rightLine'></view>
</view>
<text class='lookmore' bindtap='moreVolunteers'>查看更多</text>
<text class='lookmore' bindtap='moreVolunteers'>更多</text>
</view>
<view class='listVolunteers'>
<view bindtap='volunteersEventDetail' wx:for="{{volunteerEventList}}" data-index='{{item.id}}' wx:key="{{index}}">
......@@ -44,6 +59,7 @@
<text>报名截止:{{item.enroll_time}}</text>
</view>
</view>
<text></text>
</view>
</view>
<!-- 社会实践 -->
......@@ -51,8 +67,9 @@
<view>
<view class='topTitle'>
<view>
<view class='line'></view>
<view class='leftLine'></view>
<text>社会实践</text>
<view class='rightLine'></view>
</view>
<!-- <text class='lookmore'>查看更多</text> -->
</view>
......@@ -68,6 +85,7 @@
</view>
<text>{{item.author}}</text>
</view>
<text></text>
</view>
</view>
</view>
......@@ -78,8 +96,9 @@
<view>
<view class='topTitle'>
<view>
<view class='line'></view>
<view class='leftLine'></view>
<text>亲子活动</text>
<view class='rightLine'></view>
</view>
<!-- <text class='lookmore'>查看更多</text> -->
</view>
......@@ -95,6 +114,7 @@
</view>
<text>{{item.author}}</text>
</view>
<text></text>
</view>
</view>
</view>
......@@ -103,8 +123,9 @@
<view class='publicWelfare'>
<view class='topTitle'>
<view>
<view class='line'></view>
<view class='leftLine'></view>
<text>公益课堂</text>
<view class='rightLine'></view>
</view>
<!-- <text class='lookmore'>查看更多</text> -->
</view>
......@@ -114,7 +135,7 @@
<image src='{{item.front_image}}'></image>
</view>
<view class='right_listPublicWelfare'>
<text>{{item.title}}</text>
<text class='activeTitle'>{{item.title}}</text>
<view>
<van-button type="default" size="mini">小学课堂</van-button>
<image src='../../img/kefu.png'></image>
......@@ -122,6 +143,7 @@
</view>
<text>主讲教师:{{item.teacher}}</text>
</view>
<text></text>
</view>
</view>
</view>
......
/* pages/index/index.wxss */
.indexBox{
/* padding-bottom: 50px; */
}
.indexSwiper{
.indexHeader{
position: relative;
width: 100%;
height: 150px;
border-radius: 0 0 10px 10px;
background: #7474e4;
background: linear-gradient(to bottom, #5c5bf4, #7474e4);
margin-bottom: 80px
}
.indexSwiper>swiper{
width: 100%;
}
.indexSwiper image{
width: 100%;
.con_indexHeader{
position: absolute;
bottom: -70px;
left: 0;
right: 0;
margin: auto;
width: 90%;
height: 150px;
background: #fff;
border-radius: 15px;
}
.con_indexHeader>image{
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: auto;
width: 95%;
height: 134px;
border-radius: 8px;
}
.title{
position: absolute;
top: 10px;
right: 10px;
left: 7%;
font-size: 13px;
display: flex;
align-items: center;
height: 50px;
color: #fff;
}
.title>image{
width: 40px;
height: 40px;
border-radius: 50%;
margin-right: 10px;
}
.girdList{
width: 90%;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
font-size: 12px;
}
.van-icon--image{
width: 1.6em!important;
height: 1.6em!important;
.girdList>view{
width: 25%;
height: 73px;
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
}
.girdList>view>image{
width: 42px;
height: 42px;
}
.girdList>view>view{
width: 100%;
text-align: center;
}
.topTitle{
width: 100%;
height: 30px;
display: flex;
justify-content: space-between;
align-items: center;
position: relative;
}
.topTitle>view{
display: flex;
align-items: center;
margin-left: 15px;
font-size: 14px;
width: 100%;
justify-content: center;
}
.topTitle>view>text{
margin: 0 10px;
font-size: 15px;
color: #000;
font-weight: bold;
}
.line{
width: 5px;
height: 20px;
background: #79B0D9;
margin-right: 5px;
.leftLine{
width: 18%;
height: 2px;
background: linear-gradient(to left, #599eff, #fff);
}
.rightLine{
width: 18%;
height: 2px;
background: linear-gradient(to right, #599eff, #fff);
}
.topTitle>text{
position: absolute;
top: 0;
bottom: 0;
right: 5%;
margin: auto;
font-size: 12px;
color: #666;
margin-right: 15px;
display: flex;
align-items: center;
}
.practice>view{
width: 100%;
}
// pages/newQuanzi/newQuanzi.js
var app = getApp();
import Notify from '../../dist/notify/notify';
var app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
value:'',
checked: false,
fuwuplace:''
title:'',
needCheck: false,
servicePlace:'',
},
/**
......@@ -18,7 +19,7 @@ Page({
var location = wx.getStorageSync('location');
var place = location.province + location.city + location.district
this.setData({
fuwuplace:place
servicePlace:place,
})
},
......@@ -37,63 +38,52 @@ Page({
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onChange(event) {
//获取圈子名称
onInputTitle(event) {
this.setData({
value:event.detail
title:event.detail
})
},
onChange1({ detail }) {
//获取是否需要入圈审核
onChangeNeedCheck({ detail }) {
// 需要手动对 checked 状态进行更新
this.setData({ checked: detail });
},
newQuanzijianli(){
this.circleNew1()
this.setData({
needCheck: detail
});
},
//提交数据
circleNew1(){
var that = this;
var config = wx.getStorageSync('config');
var jingweidu = wx.getStorageSync('jingweidu');
wx: wx.request({
var location = wx.getStorageSync('location');
if (that.data.title == null || that.data.title.trim() == "") {
Notify('请输入圈子名称')
return
}
if (location == null || location.latitude == null) {
Notify('请重新定位位置')
return
}
//提交数据
wx.request({
url: app.url + 'ajax_circle_new1.php',
data: {
unionId: config.unionId,
latitude: jingweidu.latitude,
longitude: jingweidu.longitude,
title: that.data.value,
needCheck: 1
latitude: location.latitude,
longitude: location.longitude,
province: location.province,
city: location.city,
district: location.district,
title: that.data.title,
needCheck: that.data.needCheck
},
header: { 'content-type': 'application/json' },
method: 'GET',
......@@ -101,19 +91,26 @@ Page({
success: function (res) {
console.log(res)
if (res.statusCode == 200) {
if (res.data.status == "OK") {
//获取新建圈子的id
var circleId = res.data.result.circleDat.id
//成功以后跳转到下一页面
wx.navigateTo({
url: '../newCircle2/newCircle2',
})
wx.setNavigationBarTitle({
title: '我的圈子'
url: '../newCircle2/newCircle2?circleId=' + circleId,
})
} else {
Notify(res.data.message)
return
}
}
},
fail: function (res) { },
complete: function (res) { },
})
},
dingwei(){
//重新定位
reLocation(){
var config = wx.getStorageSync('config');
var that = this;
wx.getLocation({
......@@ -122,16 +119,16 @@ Page({
// console.log(res);
var latitude = res.latitude;
var longitude = res.longitude;
let jingweidu = {
let location = {
latitude: res.latitude,
longitude: res.longitude
};
wx.setStorage({
key: 'jingweidu',
data: jingweidu,
key: 'location',
data: location,
})
wx: wx.request({
url: app.url + 'ajax_get_user_role.php',
wx.request({
url: app.url + 'ajax_get_location_place.php',
data: {
unionId: config.unionId,
latitude: latitude,
......@@ -141,15 +138,13 @@ Page({
method: 'GET',
dataType: 'json',
success: function (res) {
var place = res.data.result.province + res.data.result.city + res.data.result.district;
that.setData({
fuwuplace:place
servicePlace: res.data.result.province + res.data.result.city + res.data.result.district,
})
let location = {
province: res.data.result.province,
city: res.data.result.city,
district: res.data.result.district
}
//保存最新地理位置信息
location.province = res.data.result.province,
location.city = res.data.result.city,
location.district = res.data.result.district,
wx.setStorage({
key: 'location',
data: location,
......
{
"usingComponents": {}
"usingComponents": {},
"navigationBarTitleText": "创建圈子"
}
\ No newline at end of file
<!--pages/newQuanzi/newQuanzi.wxml-->
<view class='newQuanzi'>
<view class='top_newQuanzi'>
服务区域:{{fuwuplace}}
<van-button type="default" size='mini' bindtap='dingwei'>重新定位</van-button>
服务区域:{{servicePlace}}
<van-button type="default" size='mini' bindtap='reLocation'>重新定位</van-button>
</view>
<view class='newQuanziname'>
圈子名称:
<view>
<van-cell-group>
<van-field
value="{{ value }}"
value="{{ title }}"
placeholder="请输入圈子名称"
border="{{ false }}"
bind:change="onChange"
bind:change="onInputTitle"
/>
</van-cell-group>
</view>
</view>
<view class='shenghe'>
开启后成员加入需圈主审核<van-switch checked="{{ checked }}" bind:change="onChange1" size="16px" />
开启后成员加入需圈主审核<van-switch checked="{{ checked }}" bind:change="onChangeNeedCheck" size="16px" />
</view>
<view class='newQuanzijianli' bindtap='newQuanzijianli'>
<view class='newQuanzijianli' bindtap='circleNew1'>
建立
</view>
<van-notify id="van-notify" />
</view>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment