Commit 0df4d2a0 by 刘海龙

Merge branch 'master' of http://132.232.91.252:9999/ice/eduline

parents ad7704be 5c86af7d
...@@ -155,6 +155,14 @@ class PassportModel extends Model ...@@ -155,6 +155,14 @@ class PassportModel extends Model
} }
} }
public function wxLogin($uid)
{
$user = model('User')->where(['uid' => $uid])->find();
// 记录登录日志,首次登录判断
$this->rel = D('LoginRecord')->where("uid = " . $uid)->field('locktime')->find();
$this->_recordLogin($uid, true);
}
/** /**
* 根据标示符(email或uid)和未加密的密码获取本地用户(密码为null时不参与验证) * 根据标示符(email或uid)和未加密的密码获取本地用户(密码为null时不参与验证)
* @param string $login 标示符内容(为数字时:标示符类型为uid,其他:标示符类型为email) * @param string $login 标示符内容(为数字时:标示符类型为uid,其他:标示符类型为email)
...@@ -429,7 +437,11 @@ class PassportModel extends Model ...@@ -429,7 +437,11 @@ class PassportModel extends Model
return $user; return $user;
} else { } else {
return $user['uid'] > 0 ? $this->_recordLogin($user['uid'], $is_remember_me) : false; if ($user['uid'] > 0) {
$this->_recordLogin($user['uid'], $is_remember_me);
return $user;
}
return false;
} }
} }
......
...@@ -24,22 +24,44 @@ class MessageAction extends Action ...@@ -24,22 +24,44 @@ class MessageAction extends Action
* @return void * @return void
*/ */
public function index() { public function index() {
$and_uid = $_GET['and_uid'] ? :''; // $and_uid = $_GET['and_uid'] ? :'';
//
// $dao = model('Message');
// $list = $dao->getMessageListByUid($this->mid, array(MessageModel::ONE_ON_ONE_CHAT, MessageModel::MULTIPLAYER_CHAT), $and_uid);
//
// $this->assign($list);
// if(isAjax()){
// Response::create(['status'=>1,'data'=>['html'=>$this->fetch('index_w3g_ajax')]],'json')->code(200)->send();exit;
// }
// // 设置信息已读(在右上角提示去掉),
// $dao->setMessageIsRead(t($POST['id']), $this->mid, 1);
// $this->setTitle('我的私信');
// $userInfo = model('User')->getUserInfo($this->mid);
//
// $this->setKeywords($userInfo['uname'].'的私信');
// $this->display();
$dao = model('Message'); $map['uid'] = $this->mid;
$list = $dao->getMessageListByUid($this->mid, array(MessageModel::ONE_ON_ONE_CHAT, MessageModel::MULTIPLAYER_CHAT), $and_uid); $map['node'] = ['neq', 'live_notify'];
$list = D('notify_message')->where($map)->order('ctime desc')->findpage(20);
foreach($list['data'] as $k=>&$v){
if($appname !='public'){
$list['data'][$k]['app'] = model('App')->getAppByName($v['appname']);
}
if($v['node'] == 'live_notify' && strpos($v['body'],"{SITE_URL}")){
$v['body'] = str_replace("{SITE_URL}", SITE_URL, $v['body']);
}
}
unset($v);
model('Notify')->setRead($this->mid);
$this->assign($list); $this->assign('list',$list);
if(isAjax()){ if(isAjax()){
Response::create(['status'=>1,'data'=>['html'=>$this->fetch('index_w3g_ajax')]],'json')->code(200)->send();exit; Response::create(['status'=>1,'data'=>['html'=>$this->fetch('mynotify_w3g_ajax')]],'json')->code(200)->send();exit;
} }
// 设置信息已读(在右上角提示去掉), $this->setTitle('系统消息');
$dao->setMessageIsRead(t($POST['id']), $this->mid, 1); $this->setKeywords('系统消息');
$this->setTitle('我的私信'); $this->display('mynotify');
$userInfo = model('User')->getUserInfo($this->mid);
$this->setKeywords($userInfo['uname'].'的私信');
$this->display();
} }
/** /**
......
...@@ -48,7 +48,14 @@ class PassportAction extends CommonAction ...@@ -48,7 +48,14 @@ class PassportAction extends CommonAction
public function wxLogin($openid) public function wxLogin($openid)
{ {
$uid = M('user_openid')->where(['open_id' => $openid, 'type' => 1])->getField('uid');
if (!$uid) {
return;
}
$this->passport->wxLogin($uid);
if (model('Passport')->isLogged()) {
U('classroom/Index/index', '', true); //dengjb 个人中心
}
} }
/** /**
...@@ -86,7 +93,7 @@ class PassportAction extends CommonAction ...@@ -86,7 +93,7 @@ class PassportAction extends CommonAction
// 微信登录 // 微信登录
$openid = ''; $openid = '';
/**
$ua = $_SERVER['HTTP_USER_AGENT']; $ua = $_SERVER['HTTP_USER_AGENT'];
if (strpos($ua, 'MicroMessenger') == false && strpos($ua, 'Windows Phone') == false) { if (strpos($ua, 'MicroMessenger') == false && strpos($ua, 'Windows Phone') == false) {
...@@ -108,7 +115,7 @@ class PassportAction extends CommonAction ...@@ -108,7 +115,7 @@ class PassportAction extends CommonAction
$this->wxLogin($openid); $this->wxLogin($openid);
} }
} }
**/
$this->assign('openid', $openid); $this->assign('openid', $openid);
// $this->assign('login_bg', $login_bg); // $this->assign('login_bg', $login_bg);
$this->assign('this_mhm_id', $this_mhm_id); $this->assign('this_mhm_id', $this_mhm_id);
...@@ -162,6 +169,15 @@ class PassportAction extends CommonAction ...@@ -162,6 +169,15 @@ class PassportAction extends CommonAction
$status = 1; $status = 1;
$info = $this->passport->getSuccess(); $info = $this->passport->getSuccess();
//$data = ($GLOBALS['ts']['site']['home_url'])?$GLOBALS['ts']['site']['home_url']:0; //$data = ($GLOBALS['ts']['site']['home_url'])?$GLOBALS['ts']['site']['home_url']:0;
if ($openid) {
$open = ['type' => 1, 'uid' => $result['uid']];
if (M('user_openid')->where($open)->find()) {
M('user_openid')->where($open)->delete();
}
$open['open_id'] = $openid;
M('user_openid')->add($open);
}
$data = U('classroom/Index/index'); $data = U('classroom/Index/index');
} }
......
<include file="__THEME__/public_header_w3g" /> <include file="__THEME__/public_header_w3g" />
<script src="__THEMEW3G__/js/flexible.js"></script> <script src="__THEMEW3G__/js/flexible.js"></script>
<link rel="stylesheet" href="__APP__/css/index_w3g.css"> <link rel="stylesheet" href="__APP__/css/index_w3g.css">
<style type="text/css">
.navbar .tab-item.is-selected::after { background: none; }
.navbar .tab-item.is-selected { color: #333; }
</style>
<div class="bar-nav"> <div class="bar-nav">
<a href="{:U('home/User/index')}" class="bar-btn eduline-v4 v4-iconfont-houtui"></a> <a href="{:U('home/User/index')}" class="bar-btn eduline-v4 v4-iconfont-houtui"></a>
<div class="bar-title">我的消息</div> <div class="bar-title">我的消息</div>
......
...@@ -902,6 +902,8 @@ class PayAction extends CommonAction ...@@ -902,6 +902,8 @@ class PayAction extends CommonAction
$url = U("home/User/credit"); $url = U("home/User/credit");
}elseif($status_info['type'] == 2){ }elseif($status_info['type'] == 2){
$url = U("home/User/account"); $url = U("home/User/account");
}elseif($status_info['type'] == 1){
$url = U("home/Home/exams");
}else{ }else{
$url = U("home/User/recharge"); $url = U("home/User/recharge");
} }
......
...@@ -100,7 +100,10 @@ ...@@ -100,7 +100,10 @@
<if condition="$vo['price'] eq 0 or $vo['is_buy'] eq 1"> <if condition="$vo['price'] eq 0 or $vo['is_buy'] eq 1">
<div @click="onStart({$vo['exams_paper_id']})" class="home_button_green layout_center">开始做题</div> <div @click="onStart({$vo['exams_paper_id']})" class="home_button_green layout_center">开始做题</div>
<else /> <else />
<!--
<div @click="onPay({$vo['exams_paper_id']})" class="home_button_orange layout_center">¥{$vo['price']}</div> <div @click="onPay({$vo['exams_paper_id']})" class="home_button_orange layout_center">¥{$vo['price']}</div>
-->
<div @click="onStart({$vo['exams_paper_id']})" class="home_button_orange layout_center">预览</div>
</if> </if>
</div> </div>
<div class="layout_h_b" style="margin-top: 0.5rem;"> <div class="layout_h_b" style="margin-top: 0.5rem;">
...@@ -200,12 +203,11 @@ ...@@ -200,12 +203,11 @@
} }
}, },
onDownload: function (isBuy, price, path) { onDownload: function (isBuy, price, path) {
if ( (isBuy || price == 0) && path ) { if ( path ) {
window.location.href = path; window.location.href = path;
} }
}, },
onPay: function(id) { onPay: function(id) {
console.log("Id = " + id)
if (MID <= 0) { if (MID <= 0) {
ui.confirm('请先登录', { ui.confirm('请先登录', {
yes: function() { yes: function() {
......
...@@ -178,7 +178,16 @@ class AdminPaperAction extends AdministratorAction ...@@ -178,7 +178,16 @@ class AdminPaperAction extends AdministratorAction
if (!empty($attache_ids)) { if (!empty($attache_ids)) {
$attache_id = array_pop(array_filter($attache_ids)); $attache_id = array_pop(array_filter($attache_ids));
} }
$attache2_id = '';
$attache2_ids = explode('|', $_POST['attachment2_ids']);
if (!empty($attache2_ids)) {
$attache2_id = array_pop(array_filter($attache2_ids));
}
$data['attachment'] = $attache_id; $data['attachment'] = $attache_id;
$data['attachment2'] = $attache2_id;
$data['reply_time'] = intval($_POST['reply_time']); $data['reply_time'] = intval($_POST['reply_time']);
$data['exams_module_id'] = intval($_POST['exams_module_id']); $data['exams_module_id'] = intval($_POST['exams_module_id']);
$data['exams_paper_title'] = t($_POST['exams_paper_title']); $data['exams_paper_title'] = t($_POST['exams_paper_title']);
...@@ -203,7 +212,7 @@ class AdminPaperAction extends AdministratorAction ...@@ -203,7 +212,7 @@ class AdminPaperAction extends AdministratorAction
} }
exit; exit;
} }
$this->pageKeyList = ['exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time', 'exams_limit','best', 'is_rand', 'start_time', 'end_time', 'assembly_type', 'is_screen','attachment', 'price', 'show_user_group', 'sort', 'description']; $this->pageKeyList = ['exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time', 'exams_limit','best', 'is_rand', 'start_time', 'end_time', 'assembly_type', 'is_screen','attachment2', 'attachment', 'price', 'show_user_group', 'sort', 'description'];
$this->notEmpty = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time']; $this->notEmpty = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time'];
ob_start(); ob_start();
echo W('CategoryLevel', array('table' => 'exams_subject', 'id' => 'exams_subject_id')); echo W('CategoryLevel', array('table' => 'exams_subject', 'id' => 'exams_subject_id'));
...@@ -302,6 +311,12 @@ class AdminPaperAction extends AdministratorAction ...@@ -302,6 +311,12 @@ class AdminPaperAction extends AdministratorAction
$attache_id = array_pop(array_filter($attache_ids)); $attache_id = array_pop(array_filter($attache_ids));
} }
$attache2_id = '';
$attache2_ids = explode('|', $_POST['attachment2_ids']);
if (!empty($attache2_ids)) {
$attache2_id = array_pop(array_filter($attache2_ids));
}
$data['exams_subject_id'] = end($subjectArr); $data['exams_subject_id'] = end($subjectArr);
$data['description'] = t($_POST['description']); $data['description'] = t($_POST['description']);
$data['level'] = intval($_POST['level']); $data['level'] = intval($_POST['level']);
...@@ -322,6 +337,7 @@ class AdminPaperAction extends AdministratorAction ...@@ -322,6 +337,7 @@ class AdminPaperAction extends AdministratorAction
$data['best'] = isset($_POST['best']) ? intval($_POST['best']) : 0; $data['best'] = isset($_POST['best']) ? intval($_POST['best']) : 0;
$data['price'] = t($_POST['price']); $data['price'] = t($_POST['price']);
$data['attachment'] = $attache_id; $data['attachment'] = $attache_id;
$data['attachment2'] = $attache2_id;
if (M('exams_paper')->where(['exams_paper_id' => $paper_id])->save($data)) { if (M('exams_paper')->where(['exams_paper_id' => $paper_id])->save($data)) {
$this->success('编辑成功'); $this->success('编辑成功');
...@@ -337,7 +353,7 @@ class AdminPaperAction extends AdministratorAction ...@@ -337,7 +353,7 @@ class AdminPaperAction extends AdministratorAction
$this->error("未找到编辑的试卷"); $this->error("未找到编辑的试卷");
} }
$this->pageTab[] = array('title' => '编辑', 'tabHash' => 'edit', 'url' => U('exams/AdminPaper/edit', ['paper_id' => $paper_id])); $this->pageTab[] = array('title' => '编辑', 'tabHash' => 'edit', 'url' => U('exams/AdminPaper/edit', ['paper_id' => $paper_id]));
$this->pageKeyList = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time', 'exams_limit', 'best', 'is_rand', 'start_time', 'end_time', 'assembly_type', 'is_screen','attachment', 'price', 'show_user_group', 'sort', 'description']; $this->pageKeyList = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time', 'exams_limit', 'best', 'is_rand', 'start_time', 'end_time', 'assembly_type', 'is_screen','attachment2', 'attachment', 'price', 'show_user_group', 'sort', 'description'];
$this->notEmpty = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time']; $this->notEmpty = ['exams_paper_id', 'exams_subject_id', 'exams_module_id', 'level', 'exams_paper_title', 'reply_time'];
ob_start(); ob_start();
echo W('CategoryLevel', array('table' => 'exams_subject', 'id' => 'exams_subject_id', 'default' => $paper['paper_subject_fullpath'])); echo W('CategoryLevel', array('table' => 'exams_subject', 'id' => 'exams_subject_id', 'default' => $paper['paper_subject_fullpath']));
......
...@@ -337,6 +337,12 @@ class IndexAction extends Action ...@@ -337,6 +337,12 @@ class IndexAction extends Action
// 是否收藏 // 是否收藏
$paper['iscollect'] = D('ZyCollection', 'classroom')->isCollect($paper_id, 'exams_paper', intval($this->mid)); $paper['iscollect'] = D('ZyCollection', 'classroom')->isCollect($paper_id, 'exams_paper', intval($this->mid));
$limit = 0;
if (!$paper['is_buy']) {
$limit = 3;
}
$this->assign('limit', $limit);
$this->assign('paper', $paper); $this->assign('paper', $paper);
// 是否练习模式 // 是否练习模式
$this->assign('isPractice', ($_GET['joinType'] == 1) ? 1 : 2); $this->assign('isPractice', ($_GET['joinType'] == 1) ? 1 : 2);
......
...@@ -81,7 +81,7 @@ class ExamsPaperModel extends Model ...@@ -81,7 +81,7 @@ class ExamsPaperModel extends Model
$data[$key]['exams_module_title'] = $this->getModuleTitleAttr($v['exams_module_id']); $data[$key]['exams_module_title'] = $this->getModuleTitleAttr($v['exams_module_id']);
$data[$key]['level_title'] = $this->getLevelTitle($v['level']); $data[$key]['level_title'] = $this->getLevelTitle($v['level']);
$data[$key]['is_buy'] = $this->isBuy($v['exams_paper_id'], $this->mid); $data[$key]['is_buy'] = $this->isBuy($v['exams_paper_id'], $this->mid);
$data[$key]['attach'] = ''; $data[$key]['attach'] = $this->getAttachPathByAttachId($v['attachment2']);
if ($data[$key]['is_buy'] || $v['price'] == 0) { if ($data[$key]['is_buy'] || $v['price'] == 0) {
$data[$key]['attach'] = $this->getAttachPathByAttachId($v['attachment']); $data[$key]['attach'] = $this->getAttachPathByAttachId($v['attachment']);
} }
...@@ -163,7 +163,6 @@ class ExamsPaperModel extends Model ...@@ -163,7 +163,6 @@ class ExamsPaperModel extends Model
* @return [type] [description] * @return [type] [description]
*/ */
public function getPaperById($paper_id = 0,$is_need = 0) //,$challenge_again = 0 public function getPaperById($paper_id = 0,$is_need = 0) //,$challenge_again = 0
{ {
$map['exams_paper_id'] = $paper_id; $map['exams_paper_id'] = $paper_id;
// $challenge_again && $map['is_del'] = 0; // $challenge_again && $map['is_del'] = 0;
......
...@@ -282,6 +282,10 @@ ...@@ -282,6 +282,10 @@
var isCollect = "{$paper['iscollect']}" > 0 ? 1 : 0; var isCollect = "{$paper['iscollect']}" > 0 ? 1 : 0;
var limit = parseInt("{$limit}");
var id = "{$paper.exams_paper_id}";
var payUrl = "{:U('exams/index/getPayUrl')}";
function changeCollect() { function changeCollect() {
if (isCollect) { if (isCollect) {
isCollect = 0; isCollect = 0;
...@@ -333,4 +337,7 @@ ...@@ -333,4 +337,7 @@
iscollect(isCollect); iscollect(isCollect);
}); });
</script> </script>
...@@ -51,11 +51,50 @@ $(function() { ...@@ -51,11 +51,50 @@ $(function() {
}); });
// 下一题 // 下一题
$(".next_question,.go_question").click(function() { $(".next_question,.go_question").click(function() {
if ($(this).hasClass("go_question")) { if ($(this).hasClass("go_question")) {
var question_num = parseInt($(this).data("question_num")); var question_num = parseInt($(this).data("question_num"));
} else { } else {
var question_num = parseInt($(this).data("question_num")) + 1; var question_num = parseInt($(this).data("question_num")) + 1;
} }
if (limit > 0 && question_num >= limit) {
let page = $("#ex" + question_num + ' .next');
page.unbind('click');
page.attr({'style': 'background:rgba(245,166,35,1);'});
page.text('去支付');
page.bind("click", function () {
if (MID <= 0) {
ui.confirm('请先登录', {
yes: function() {
window.location.href = "{:U('basic/Passport/login')}";
}
})
return
}
$.ajax({
type: "POST",
url: payUrl,
data: {
paper_id: id,
},
dataType: "json",
success: function(res) {
var res = getResponseData(res)
if (res.status == 1) {
window.location.href = res.data
} else {
ui.error(res.message)
}
}
})
});
}
console.log(limit, question_num);
$(".answer-card").hide(); $(".answer-card").hide();
if ($("#ex" + question_num).length > 0) { if ($("#ex" + question_num).length > 0) {
$("#ex" + question_num).show().siblings().hide(); $("#ex" + question_num).show().siblings().hide();
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
</div> </div>
<div class="layout_h_b" style="margin-top: 0.5rem;"> <div class="layout_h_b" style="margin-top: 0.5rem;">
<span class="text_14_600 color_FF3B3B">¥{{item.price}}</span> <span class="text_14_600 color_FF3B3B">¥{{item.price}}</span>
<van-image src="__THEME__/img/down_load_icon.png" width="13" height="16" ></van-image> <van-image @click="onDownload(item)" src="__THEME__/img/down_load_icon.png" width="13" height="16" ></van-image>
</div> </div>
<div class="home_divider divider"></div> <div class="home_divider divider"></div>
</div> </div>
...@@ -238,7 +238,6 @@ ...@@ -238,7 +238,6 @@
} }
}, },
onPay: function(id) { onPay: function(id) {
console.log("Id = " + id)
if (MID <= 0) { if (MID <= 0) {
ui.confirm('请先登录', { ui.confirm('请先登录', {
yes: function() { yes: function() {
...@@ -318,7 +317,8 @@ ...@@ -318,7 +317,8 @@
id: r.exams_paper_id, id: r.exams_paper_id,
title: r.exams_paper_title, title: r.exams_paper_title,
price: r.price, price: r.price,
is_buy: r.is_buy is_buy: r.is_buy,
attach: r.attach
} }
}) })
opt.page = result.nowPage opt.page = result.nowPage
...@@ -354,6 +354,11 @@ ...@@ -354,6 +354,11 @@
}) })
} }
}, },
onDownload: function (item) {
if (item.attach) {
window.location.href = item.attach;
}
}
} }
}) })
......
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