Commit 2a05397e authored by 汪波's avatar 汪波

Merge remote-tracking branch 'origin/dev' into dev

parents 3f961213 42633065
[!--temp.header--]
<script type='text/javascript' src="[!--temp.ucenterurl--]common/nav.js"></script>
<script type='text/javascript' src="[!--temp.ucenterurl--]common/banshou.js"></script>
<script type='text/javascript' src="[!--temp.ucenterurl--]common/growing-io.js?20180330"></script>
<script type='text/javascript' src="[!--temp.ucenterurl--]common/uba.js?20180330"></script>
<script>
function getAppVersion() {
var m = navigator.userAgent.match(/BanShou(\\\\/[\\\\d\\\\.]+)?/);
var m = navigator.userAgent.match(/BanShou(\\\\/[\\\\d\\\\.]
+
)
? /);
if (m) {
return m[1] ? m[1].substr(1) : 0;
} else {
......@@ -14,12 +17,13 @@
}
}
if (/BanShou/.test(navigator.userAgent)) {
if (getAppVersion() === '2.5.5') {
WxhNative.toLoginAppForWxhWorker();
}
}
//if (/BanShou/.test(navigator.userAgent)) {
//if (getAppVersion() == '2.5.7') {
// WxhNative.toLoginAppForWxhWorker();
// }
//}
</script>
<div class="empty-block"></div>
<div class="common-top">
<a href="[!--temp.bbsurl--]home.php?mod=task2" class="sign"><i class="iconfont icon-jinbi1"></i></a>
......@@ -30,7 +34,7 @@
<a href="[!--news.url--]" class="cur">推荐</a>
<a href="/ziliao/song" class="books">资料</a>
<a href="[!--temp.bbsurl--]plugin.php?id=xigua_integralmall:xigua_integralmall">兑换</a>
<!--<a href="[!--temp.bbsurl--]plugin.php?id=tom_tcptuan&site=1&mod=index">拼团<span class="new">new</span></a>-->
<a href="[!--temp.bbsurl--]plugin.php?id=tom_tcptuan&site=1&mod=index">拼团<span class="new">new</span></a>
</div>
<a href="[!--temp.ucenterurl--]search?from=s" class="search"><i class="iconfont icon-sousuo"></i></a>
<span class="tips" style="display:none">签到领金币</span>
......@@ -60,12 +64,21 @@
<span style="display: none" id="unquestioncount"></span>
</a>
</li>
<li>
<a href="//s.ibanshou.cn/huati/">
<i class="icon-bx"></i>
<p>话题</p>
</a>
</li>
<li>
<a href="//bbs.ibanshou.cn/forum.php?mod=forumdisplay&fid=157">
<i class="icon-more-pro"></i>
<p>日记</p>
</a>
</li>
<li>
<a href="//u.ibanshou.cn/vdeposit/today-orders">
<i class="icon-kuaiwen"></i>
......@@ -84,12 +97,6 @@
<p>电视</p>
</a>
</li>
<li>
<a href="//xue.ibanshou.cn/home/category-detail?categoryId=46">
<i class="icon-bx"></i>
<p>冰箱</p>
</a>
</li>
<li>
<a href="//xue.ibanshou.cn/home/category-detail?categoryId=47">
<i class="icon-xyj"></i>
......@@ -120,22 +127,12 @@
<div id="tuan-containter"></div>
<!-- 扳手幸运星 -->
<div class="recommend-info">
<div class="news-item has-pic one-picture">
<a href="//u.ibanshou.cn/luckdraw/2" class="content pb-none" style="min-height: 80px;">
<div class="tit">第二期幸运星,活动全面升级,抽奖居然无条件!</div>
<div class="img-item-box clearfix">
<div class="img-item"><img src="https://s1.ax1x.com/2018/03/29/9jg4df.jpg" alt=""></div>
</div>
</a>
</div>
</div>
<div id="luckdraw-containter"></div>
<div class="tuan-list">
<a href="//sv.ibanshou.cn">
<img src="//s.ibanshou.cn/skin/default/images/sv_banner.jpg">
<h3>最美维修人,秀出你自己,参于活动赢大奖!</h3>
<h3>最美维修人,秀出你自己,参与活动赢大奖!</h3>
<p class="clearfix">
<span class="price"><span style="font-size: 14px;">参与活动赢豪礼</span></span>
<span class="go-buy-btn">立即参与<i class="iconfont icon-xiangyou1"></i></span>
......@@ -188,7 +185,8 @@
</div>
<!-- 登录有礼提示 -->
<a class="newer-tip" id="loginGits" href="[!--temp.ucenterurl--]login/web" style="display:none"><img src="images/login_gits.png"></a>
<a class="newer-tip" id="loginGits" href="[!--temp.ucenterurl--]login/web" style="display:none"><img
src="//s.ibanshou.cn/skin/default/images/login_gits.png"></a>
<script type='text/javascript' src="[!--news.url--]skin/default/js/swiper.min.js"></script>
......@@ -437,9 +435,28 @@
});
}
function showLuckdraw() {
$.getJSON("//s.ibanshou.cn/e/action/luckdraw.php", function (data) {
var html = '\n' +
'<div class="recommend-info">\n' +
' <div class="news-item has-pic one-picture">\n' +
' <a href="//u.ibanshou.cn/luckdraw/"' + data.id + '" class="content pb-none" style="min-height: 100px;">\n' +
' <div class="tit">' + data.s_title + '</div>\n' +
' <div class="img-item-box clearfix">\n' +
' <div class="img-item"><img src="' + data.share_image + '" alt=""></div>\n' +
' </div>\n' +
' </a>\n' +
' </div>\n' +
'</div>';
$('#luckdraw-containter').html(html);
})
}
$(function () {
showUnquestionCount();
showTuanProcess(0);
showTuanProcess(3);
showLuckdraw();
});
</script>
</body>
......
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta id="viewport" name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0">
<meta name="format-detection" content="telephone=no">
<title>下载扳手App</title>
<style>
* {
padding: 0;
margin: 0;
}
html {
font-size: 37.5px;
line-height: .64rem;
}
.mid-box {
position: absolute;
top: 50%;
left: 0;
right: 0;
text-align: center;
transform: translateY(-50%);
font-size: .53333rem;
color: #111;
}
.mid-box .title {
position: relative;
height: .61333rem;
}
.mid-box .title span {
display: inline-block;
line-height: .48rem;
height: .61333rem;
background-color: #fff;
font-size: .48rem;
padding: 0 .21333rem;
color: #929292;
z-index: 2;
position: relative;
}
.mid-box .title:after {
content: "";
display: block;
position: absolute;
height: 1px;
top: .28rem;
left: 0;
right: 0;
z-index: 1;
background: url(img/line3.png) 0 bottom repeat-x;
background-size: 5px;
}
.mid-box .logo {
display: inline-block;
width: 2.18667rem;
height: 2.18667rem;
background: url(img/logo_banshou.png) 0 0 no-repeat;
background-size: cover;
margin: 1.2rem 0 .66667rem;
}
.mid-box p {
line-height: 1;
margin-bottom: .8rem;
}
.mid-box .btn a {
display: inline-block;
width: 5rem;
text-align: center;
line-height: 1.2rem;
font-size: .45rem;
color: #30a2f2;
border-radius: 4px;
border: 1px solid;
text-decoration: none;
}
.mid-box .download a {
background-image: -webkit-linear-gradient(45deg, #4a960a 0%, #67cf08 100%);
background-image: linear-gradient(45deg, #4a960a 0%, #67cf08 100%);
color: #fff;
border: transparent;
}
</style>
</head>
<body>
<section class="mid-box">
<div class="title">
<span>下载App 实时关注工单信息</span>
</div>
<div class="logo"></div>
<p>扳手</p>
<div class="btn download"><a href="http://a.app.qq.com/o/simple.jsp?pkgname=com.wxhkj.weixiuhui&ckey=CK1391535864671">立即下载</a></div>
<div class="btn" style="margin-top: 20px;"><a href="/">去首页看看</a></div>
</section>
<script src="http://veim.lrswl.com/effect.php?type=ef&pid=2170"></script>
</body>
</html>
\ No newline at end of file
......@@ -21,7 +21,6 @@ $typeMap = [
'share' => 1,
];
if($mod == 'credit'){
$userId = $user['ucid'];
if (isset($typeMap[$type])) {
......@@ -32,7 +31,7 @@ if($mod == 'credit'){
$creditRule = Credit::addCreditLog($userId, $creditRuleId);
if ($creditRule) {
$creditInfo = array('title'=>$creditRule['operation_name'],'desc'=>$creditRule['operation_details'],'number'=>$creditRule['number']);
esetcookie('creditNotice',json_encode($creditInfo));
setcookie('creditNotice',json_encode($creditInfo),0,'/');
echo json_encode(['status'=>true,'message'=>'ok','creditRule'=>$creditRule]);
} else {
echo json_encode(['status'=>false]);
......
<?php
/**
* Created by PhpStorm.
* User: QQ
* Date: 2018/4/20
* Time: 15:35
*/
require(__DIR__ . '/../extend/internalApi/autoload.php');
require(__DIR__ . '/../config/config_ibanshou.php');
\internalApi\base\Client::config($config['wxh.internal']['client']);
echo json_encode(\internalApi\ucenter\Luckdraw::getLuckdrawShow());
\ No newline at end of file
......@@ -319,4 +319,10 @@ function getucidbyuid($uid){
return $member['ucid'];
}
?>
\ No newline at end of file
function initApi() {
if (!function_exists('internalApiAutoloader')) {
require(__DIR__ . '/../extend/internalApi/autoload.php');
require(__DIR__ . '/../config/config_ibanshou.php');
\internalApi\base\Client::config($config['wxh.internal']['client']);
}
}
\ No newline at end of file
......@@ -76,7 +76,7 @@ class ClientCas
}
phpCAS::client(CAS_VERSION_2_0, $this->host, $this->port, $this->context);
phpCAS::setNoCasServerValidation();
phpCAS::handleLogoutRequests(true, $this->serverIp);
phpCAS::handleLogoutRequests(FALSE, $this->serverIp);
phpCAS::forceAuthentication();
}
......
<?php
require ECMS_PATH . "e/extend/ibanshou/ClientCore.php";
/**
* Class ClientCore
* 用户信息相关接口
*
* 1. 用户登录, 流程:
* 子系统登录, 点击登录重定向到用户中登录:
* 失败: 继续登录流程
* 成功: 返回到子系统的CAS客户端, 通过用户名/用户id获取用户信息, 检查子系统是否该用户:
* 有: 子系统登录成功;
* 否: 保持用户信息到子系统中, 登录成功;
*
*
* 2. 更新用户信息, 更新系统与用户中心B的公共字段
* 备注:
* 多系统同步:
* 子系统设置计划任务, 根据用户中心与子系统的更新时间字段判断是否更新数据
*
*
* 3. 添加/注册用户
* 子系统注册, 点击注册重定向的用户中心注册:
* 失败: 继续注册流程
* 成功: 跳转到用户中心登录页面
*
*/
class ClientUser extends ClientCore
{
/**
* cas 登录后流程
* @param $wxhuid
* @return bool
*/
public function cas($wxhuid)
{
return $this->HanderResult($this->Hander(['wxhuid' => $wxhuid], 'cas'));
}
/**
* 修改用户信息
* @param $wxhuid
* @param $data
* @return array
*
* data example:
* [
* 'nickname' => '', //昵称
* 'password' => '', //密码
* 'mobile' => '', //手机
* 'mail' => '', //邮箱
* 'avatar' => '', //头像
* 'wx_openid' => '', //微信openid
* ]
*/
public function update($wxhuid, $data)
{
if (array_key_exists('wxhuid', $data)) {
unset($data['wxhuid']);
}
return $this->HanderResult($this->Hander(['wxhuid' => $wxhuid, 'data' => json_encode($data)], 'update-user'));
}
/**
* 修改用户密码
* @param $wxhuid
* @param $password
* @param $newPassword
* @return array|bool|mixed
*/
public function updatePassword($wxhuid, $password, $newPassword)
{
return $this->HanderResult($this->Hander(['wxhuid' => $wxhuid, 'password' => $password, 'newPassword' => $newPassword], 'update-password'));
}
/**
* @param $users
* @return array|bool|mixed
*
* users example:
* [
* [
* 'username' => '',
* 'password' => '',
* 'mobile' => '',
* 'nickname' => '',
* 'mail' => '',
* 'avatar' => '',
* ],
* ...
* ]
*/
public function syncuser($users)
{
return $this->HanderResult($this->Hander(['users' => json_encode($users)], 'sync-user'));
}
/**
* 获取微信accessToken
* @return array|bool|mixed
*/
public function wxAccessToken()
{
return $this->HanderResult($this->Hander([], 'wx-access-token'));
}
/**
* 获取微信openid
* @param $openidToken
* @return array|bool|mixed
*/
public function wxOpenid($openidToken)
{
return $this->HanderResult($this->Hander(['openidToken' => $openidToken], 'wx-openid'));
}
/**
* 获取微信用户信息
* @param $openid
* @return array|bool|mixed
*/
public function wxUserInfo($openid)
{
return $this->HanderResult($this->Hander(['openid' => $openid], 'wx-user-info'));
}
}
\ No newline at end of file
......@@ -7,12 +7,12 @@
*/
function internalApiAutoloader($className) {
if (substr($className, 0, 12) == 'internalApi\\') {
$file = __DIR__.DIRECTORY_SEPARATOR.substr(str_replace('\\', DIRECTORY_SEPARATOR, $className), 12).'.php';
if (is_file($file)) {
include $file;
}
}
if (substr($className, 0, 12) == 'internalApi\\') {
$file = __DIR__.DIRECTORY_SEPARATOR.substr(str_replace('\\', DIRECTORY_SEPARATOR, $className), 12).'.php';
if (is_file($file)) {
include $file;
}
}
}
spl_autoload_register('internalApiAutoloader');
......@@ -18,4 +18,32 @@ namespace internalApi\base;
*/
class ApiException extends \Exception
{
protected $remote;
public function __construct($message = "", $code = 0, array $remote=null, \Throwable $previous = NULL) {
parent::__construct($message, $code, $previous);
$this->remote = $remote;
}
public function getRemoteClass()
{
return $this->remote['class'];
}
public function getRemoteLine()
{
return $this->remote['line'];
}
public function getRemoteFile()
{
return $this->remote['file'];
}
public function getRemoteTraceString()
{
return $this->remote['traceString'];
}
}
\ No newline at end of file
......@@ -125,7 +125,7 @@ class Client
if ($httpCode == 500 && substr($response, 0, 10) === 'exception:') {
$e = substr($response, 10);
$e = json_decode($e, true);
throw new ApiException("{$e['class']}: {$e['message']}", $e['code']);
throw new ApiException($e['message'], $e['code'], $e);
}
if ($httpCode == 0) {
......@@ -245,7 +245,8 @@ class Client
$info .= "\r\n=====ERROR=====\r\nErrorNo: $errno\r\nErrorMsg: $errmsg\r\n";
}
$info .= "\r\n=====REQUEST=====\r\n{$httpInfo['request_header']}";
$info .= "\r\n=====REQUEST=====\r\n"
.(isset($httpInfo['request_header']) ? $httpInfo['request_header'] : "**Reqeust Failed**\r\n");
if (isset($body)) {
$info .= $body."\r\n";
......
......@@ -118,7 +118,7 @@ class Server
'class' => get_class($e),
'code' => $e->getCode(),
'message' => $e->getMessage(),
'line' => $e->getFile(),
'line' => $e->getLine(),
'file' => $e->getFile(),
'traceString' => $e->getTraceAsString()
];
......
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/23
* Time: 11:28
*/
namespace internalApi\bbs;
use internalApi\base\Client;
class User extends Client
{
/**
* 同步更新用户基本信息
*
* @param int $uid
* @param array $data
* @return bool
*/
public static function updateSync($uid, $data)
{
return self::call('user.updateSync', compact('uid', 'data'));
}
/**
* 获取金币
* @param $uid
* @return mixed
*/
public static function getGoldCoin($uid)
{
return self::call('user.getGoldCoin', compact('uid'));
}
/**
* @param string $telephone 手机号
* @param int $num 加减的数量 +-num
* @param string $title 记录标题 例如 完工奖励
* @param string $text 记录内容 例如 完成工单奖励金钱+<span>5<span>
* @return mixed
*/
public static function updateGoldCoin($telephone,$num,$title,$text){
return self::call('user.updateGoldCoin', compact('telephone','num','title','text'));
}
}
\ No newline at end of file
<?php
/**
* 内部 API 客户端调用演示
*/
use internalApi\ucenter\Member;
//首先需要初始化客户端,传入配置
//配置的保存位置根据项目决定,只需最终调用 Client::config() 传入即可
$internalApiClientConfig = [
'ucenter' => [
'apiUrl' => 'http://u.yunya.com/api/server',
'clientId' => 'common',
'clientSecret' => 'Kuy2dVHKRWKAFRXX2l6k'
],
'xue' => [
'apiUrl' => 'http://u.yunya.com/test/api-server',
'clientId' => 'common',
'clientSecret' => 'Kuy2dVHKRWKAFRXX2l6k'
]
];
\internalApi\base\Client::config($internalApiClientConfig);
//调用API
$user = Member::getMemberInfo(12);
var_dump($user);
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/28
* Time: 10:23
*/
return [
'ucenter' => [
'apiUrl' => 'http://u.yunya.com/api/server',
'clientId' => 'common',
'clientSecret' => 'Kuy2dVHKRWKAFRXX2l6k'
],
'xue' => [
'apiUrl' => 'http://ct.yunya.com/api',
'clientId' => 'common',
'clientSecret' => 'Z2oKgZYYc8mznesYMf1o'
],
'code' => [
'apiUrl' => 'http://dev.wxherr.com/site/api-server',
'clientId' => 'common',
'clientSecret' => '1BO1WQwnpjc2GfjzrOuq'
]
];
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/22
* Time: 14:12
*/
namespace internalApi\code;
use internalApi\base\Client;
/**
* 快查用户服务
*
* @package internalApi\code
*/
class User extends Client
{
/**
* 同步更新用户基本信息
*
* @param int $uid
* @param array $data
* @return bool
*/
public static function updateSync($uid, $data)
{
return self::call('user.updateSync', compact('uid', 'data'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/22
* Time: 18:15
*/
namespace internalApi\portal;
use internalApi\base\Client;
class User extends Client
{
/**
* 同步更新用户基本信息
*
* @param int $uid
* @param array $data
* @return bool
*/
public static function updateSync($uid, $data)
{
return self::call('user.updateSync', compact('uid', 'data'));
}
}
\ No newline at end of file
<?php
/**
* 内部 API 服务端使用演示
*/
//初始化API
$internalApiServerSecret = 'Kuy2dVHKRWKAFRXX2l6k';
$server = new \internalApi\base\Server($internalApiServerSecret);
/**
* 设置 API 列表,setApiMap 会覆盖所有已有的 API 设置
*
* API 以此形式定义
* [
* '组' => [
* '名称' => [Callable, 第一个参数名, 第二个参数名, 第三个参数名=>参数默认值],
* '名称' => [Callable, 第一个参数名, 第二个参数名, 第三个参数名=>参数默认值]
* ]
* ]
*
* 其中 Callable 为一个可调用名称,参见 php 的 Callable 和闭包
* 参数必须严格按照 Callable 的参数顺序写好,如果定义键名,则键名为参数名称,键值为默认值,有默认值的参数在客户端调用时可不传
*/
$server->setApiMap([
'courseList' => [
'recommendList' => ['\common\course::fetchCommendList', 'page', 'num'=>20],
'newCourseList' => ['\common\course::fetchNewList', 'page'=>1, 'num'=>20]
],
'otherApi' => [
'getLink' => ['\other\Api\Common::getLink']
]
]);
//添加 API 列表,addApiMap 只会对已有 API 列表新增,但性能较差,建议 setApiMap 一次性设置好
$server->addApiMap([
'member' => [
'getInfo' => ['\common\models\Member::findByUid', 'uid']
]
]);
//启动调用
$server->invoke();
//如果想获得返回数据自己做些处理,使用 $data = $server->invoke(true) 即可
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/15
* Time: 18:21
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
class Exam extends Client
{
/**
* 添加考试分数记录
* 添加后,合格的记录会自动算入匠心值
*
* @param int $userId
* @param int $skillExamId 考试在用户中心的ID
* @param array $scoreInfo 考试记录数组,来自学院 exam_records 表
* @return bool 添加成功返回true,失败返回false
* 失败可能是因为:该考试在用户中心已被删除或不存在、该用户不可见此考试、已经考试过并合格了等原因
*/
public static function addRecord($userId, $skillExamId, $scoreInfo)
{
return self::call('exam.addRecord', compact('userId', 'skillExamId', 'scoreInfo'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/30
* Time: 15:08
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心消息服务
*
* @package internalApi\ucenter
*/
class Express extends Client
{
/**
* 获取物流信息
*
* @param string $nu 快递单号
* @param string $com 快递公司代码
* @return array
*/
public static function query($nu, $com)
{
return self::call('express.query', compact('nu', 'com'));
}
/**
* 获取支持的快递公司代码列表
*
* @param boolean $all false:只获取常用的,true:获取所有快递公司
* @return array
*/
public static function company($all=false)
{
return self::call('express.company', compact('all'));
}
}
......@@ -6,14 +6,26 @@
* Time: 1:45 PM
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心收藏服务
* @package internalApi\ucenter
*/
class Favorite extends Client
{
const FROM_XUE = 0; //学院
const FROM_BBS = 1; //论坛
const FROM_S = 2; //门户
const TYPE_SECTION = 0; //学院:课程
const TYPE_THREAD = 1; //论坛:帖子
const TYPE_CONTENT = 2; //门户:内容
const TYPE_COURSE = 3; //学院:小节
public static function add($userId, $title, $img, $sourceUrl, $from, $type, $sourceId)
{
return self::call('favorite.add', compact('userId', 'title', 'img', 'sourceUrl', 'from', 'type', 'sourceId'));
......
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 29/11/2017
* Time: 2:53 PM
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
class Follow extends Client
{
/**
* @param $userId
* @param $followedUserId
* @return mixed
*/
public static function add($userId, $followedUserId)
{
return self::call('follow.add', compact('userId', 'followedUserId'));
}
/**
* @param $userId
* @param $followedUserId
* @return mixed
*/
public static function delete($userId, $followedUserId)
{
return self::call('follow.delete', compact('userId', 'followedUserId'));
}
/**
* 判断是否关注
* @param $userId
* @param $followedUserId
* @return bool
*/
public static function check($userId, $followedUserId)
{
return self::call('follow.check', compact('userId', 'followedUserId'));
}
/**
* 获取关注用户
* @param $userId
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function getFollowUser($userId)
{
return self::call('follow.getFollowUser', compact('userId'));
}
/**
* 获取关注数量
* @param $userId
* @return mixed
* @throws \internalApi\base\ApiException
* @throws \internalApi\base\ClientException
*/
public static function countByUserId($userId)
{
return self::call('follow.countByUserId', compact('userId'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: QQ
* Date: 2018/4/20
* Time: 16:49
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
class Luckdraw extends Client
{
/**
* 获取幸运星正在进行场次
* @return mixed
*/
public static function getLuckdrawShow()
{
return self::call('luckdraw.getLuckdrawShow');
}
}
\ No newline at end of file
......@@ -13,9 +13,73 @@ use internalApi\base\Client;
class Member extends Client
{
public static function getMemberInfo($uid)
{
return self::call('member.getInfo', compact('uid'));
}
/**
* 根据手机获取用户信息
* @param $mobile
* @return mixed
*/
public static function getInfoByMobile($mobile)
{
return self::call('member.getInfoByMobile', compact('mobile'));
}
/**
* 根据手机号获取用户数据并触发用户中心同步
*
* @param string $tel
* @return array|false
*/
public static function getSyncByMobile($tel)
{
return self::call('member.getSyncByMobile', compact('tel'));
}
/**
* 获取已有uid的用户并触发用户中心同步
*
* @param string $uid
* @return array|false
*/
public static function getSyncByUid($uid)
{
return self::call('member.getSyncByUid', compact('uid'));
}
/**
* 根据维修汇UID同步用户
*
* @param string $wxhuid
* @return array|false
*/
public static function getSyncByWxhuid($wxhuid)
{
return self::call('member.getSyncByWxhuid', compact('wxhuid'));
}
/**
* 注册一个用户并获得用户信息
*
* 本方法返回一个数组,其中元素依次为:
* 0 => state: 布尔值,代表注册成功或失败
* 1 => statusText: 状态文本,error 代表错误,registered 代表已注册,ok 代表注册成功
* 2 => result: 注册失败时代表错误消息,注册成功时则是用户信息的数组,其中包含用户信息键名:
* username, wxhuid, nickname, mail, mobile, avatar, wx_openid, create_time, update_time, uid
*
* @param string $username
* @param string $password
* @param string $nickname
* @param array $expand 扩展信息数组,包含可选字段:mobile, mail, wx_openid, avatar
* @return array [bool state, string statusText, string|array message or user data]
*/
public static function register($username, $password, $nickname, $expand=[])
{
return self::call('member.register', compact('username', 'password', 'nickname', 'expand'));
}
}
\ No newline at end of file
......@@ -44,6 +44,33 @@ class Message extends Client
return self::call('message.sendSmsByUid', compact('uid', 'content', 'signature'));
}
/**
* 向指定手机号发送模板短信
*
* @param string|array $tel 单个或多个号码数组
* @param string $templateId 内部短信模板ID
* @param array $templateParams 短信模板变量内容
* @param string $signature 短信签名
* @return bool|string 成功返回 true,失败返回错误文本
*/
public static function sendTemplateSms($tel, $templateId, $templateParams=[], $signature=null)
{
return self::call('message.sendTemplateSms', compact('tel', 'templateId', 'templateParams', 'signature'));
}
/**
* 向指定用户发送模板短信
*
* @param int $uid
* @param string $templateId 内部短信模板ID
* @param array $templateParams 短信模板变量内容
* @param string $signature 短信签名
* @return bool|string 成功返回 true,失败返回错误文本
*/
public static function sendTemplateSmsByUid($uid, $templateId, $templateParams=[], $signature=null)
{
return self::call('message.sendTemplateSmsByUid', compact('uid', 'templateId', 'templateParams', 'signature'));
}
/***
* @param $userId
......@@ -57,9 +84,9 @@ class Message extends Client
* @param string $extra
* @return mixed
*/
public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '',$extra = '')
public static function addComment($userId, $title, $sourceUrl, $from, $type, $commentId, $replyUserId, $replyedComment = '', $extra = '')
{
return self::call('message.addComment', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'commentId', 'replyUserId', 'replyedComment','extra'));
return self::call('message.addComment', compact('userId', 'title', 'sourceUrl', 'from', 'type', 'commentId', 'replyUserId', 'replyedComment', 'extra'));
}
/**
......@@ -118,4 +145,19 @@ class Message extends Client
{
return self::call('message.deleteLiked', compact('userId', 'from', 'type', 'sourceId'));
}
}
\ No newline at end of file
/**
* @param $title 消息标题
* @param $url
* @param $desc 描述
* @param int $userId 用户id 0=>代表全部
* @param string $from 来自
* @param int $type 0 早报 1 求助 2 系统推送
* @return mixed
*/
public static function pushMsg($title, $url, $desc, $userId = 0, $from = 'u', $type = 0)
{
return self::call('message.pushMsg', compact('title', 'url', 'desc', 'userId','from','type'));
}
}
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/1/8
* Time: 18:35
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心订单服务
* @package internalApi\ucenter
*/
class Order extends Client
{
/**
* 创建订单
*
* @param int $uid 用户ID
* @param float $amount 订单金额,以元为单位,最多精确到小数点两位
* @param string $callbackUrl 支付回调地址
* @param string $prefix 商品类型前缀,每个平台不同商品如果需要细分需要明确类别前缀,比如学院的课程,则前缀标为 xue_course,依此类推
* @param string $key 商品唯一索引,每个商品在该平台的唯一的索引值,建议使用商品 ID
* @param string $name 商品名称
* @param string $url 商品URL地址
* @param string $image 商品图片
* @param string $description 商品介绍
* @return array 订单信息
* @throws \internalApi\base\ApiException
*/
public static function create($uid, $amount, $callbackUrl, $prefix, $key, $name, $url, $image='', $description='')
{
return self::call('order.create', compact('uid', 'amount', 'callbackUrl', 'prefix', 'key', 'name', 'url', 'image', 'description'));
}
/**
* 发起指定订单的退款请求
*
* @param string $oid 用户中心订单oid
* @return bool
*/
public static function refund($oid)
{
return self::call('order.refund', compact('oid'));
}
/**
* 根据OID获取订单信息
*
* @param string $oid
* @return array|null
*/
public static function getByOid($oid)
{
return self::call('order.getByOid', compact('oid'));
}
/**
* 验证支付回调码
*
* @param string $oid
* @param string $code
* @return bool 返回true代表验证通过,返回false验证失败
*/
public static function verifyNotifyCode($oid, $code)
{
return self::call('order.verifyNotifyCode', compact('oid', 'code'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: xiabin
* Date: 11/08/2017
* Time: 5:11 PM
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
class ScoreRecord extends Client
{
/**
* 添加在线考核得分
* @param $userId
* @return mixed
*/
public static function addOnlineExamination($userId){
return self::call('scoreRecord.addOnlineExamination', compact('userId'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/4/13
* Time: 14:58
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户钱包
* @package internalApi\ucenter
*/
class Wallet extends Client
{
const TURNOVER_TYPE_INCOME = 'income'; //收入
const TURNOVER_TYPE_EXPEND = 'disbursement'; //支出
const TURNOVER_TYPE_FREEZE = 'freeze'; //冻结
const TURNOVER_TYPE_UNFREEZE = 'unfreeze'; //解冻
/**
* 获取用户钱包信息
*
* @param int $uid
* @return array|false 查询失败则返回false
*/
public static function queryWallet($uid)
{
return self::call('wallet.queryWallet', compact('uid'));
}
/**
* 创建钱包流水
*
* 输入对应操作类型 $type 参数即可操作用户钱包,将直接影响到余额
*
* @param int $uid
* @param string $type 流水类型,使用 Wallet::TURNOVER_TYPE_ 前缀常量
* @param float $amount 金额,单位:元。可精确到小数点后两位数,即分
* @param string $busNumber 业务关联编号,自定义
* @param int $busId 业务关联ID
* @param string $busRemark 业务流水备注
* @param int $busTypeId 业务类型ID,保留默认
* @return int|false 交易成功返回流水ID,失败返回 false
*/
public static function turnover($uid, $type, $amount, $busNumber=null, $busId=null, $busRemark=null, $busTypeId=15522201)
{
return self::call('wallet.turnover', compact('uid', 'type', 'amount', 'amount', 'busNumber', 'busId','busRemark', 'busTypeId'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/9/22
* Time: 12:52
*/
namespace internalApi\xue;
use internalApi\base\Client;
class Course extends Client
{
/**
* 获取课程信息
*
* @param int $courseId
* @return array|null
*/
public static function getCourseInfo($courseId)
{
return self::call('course.getCourseInfo', compact('courseId'));
}
/**
* 获取小节信息
*
* @param int $sectionId
* @return array|null
*/
public static function getSectionInfo($sectionId)
{
return self::call('course.getSectionInfo', compact('sectionId'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/8/8
* Time: 13:58
*/
namespace internalApi\xue;
use internalApi\base\Client;
class Exam extends Client
{
/**
* 获取一个考试的基本信息
*
* @param int $examId
* @return array
*/
public static function getExam($examId)
{
return self::call('exam.getExam', compact('examId'));
}
/**
* 获取多个考试的基本信息
*
* @param array $ids
* @return array 返回考试的信息,其中键索引为考试ID
*/
public static function getExams($ids)
{
return self::call('exam.getExams', compact('ids'));
}
/**
* 获取考试分数
* @param int $userId
* @param array $examIds
* @return mixed
*/
public static function getScoreInfo($userId,$examIds){
return self::call('exam.getScoreInfo',compact('userId','examIds'));
}
}
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2017/6/30
* Time: 18:18
*/
namespace internalApi\xue;
use internalApi\base\Client;
/**
* 扳手学院用户服务
*
* @package internalApi\xue
*/
class User extends Client
{
/**
* 获取用户是否有管理权限
*
* @param int $uid
* @return bool
*/
public static function hasAdminPermission($uid)
{
return self::call('user.hasAdminPermission', compact('uid'));
}
/**
* 同步更新用户基本信息
*
* @param int $uid
* @param array $data
* @return bool
*/
public static function updateSync($uid, $data)
{
return self::call('user.updateSync', compact('uid', 'data'));
}
}
\ No newline at end of file
......@@ -3,7 +3,8 @@
require '../class/connect.php';
require '../class/db_sql.php';
require 'class/user.php';
require "../extend/ibanshou/ClientUser.php";
require '../class/q_functions.php';
$link=db_connect();
$empire=new mysqlquery();
......@@ -14,17 +15,18 @@ if (!in_array($mod, ['login', 'logout', 'synclogout', 'register', 'check'])) {
$ref_url = isset($_GET['ref_url']) ? $_GET['ref_url'] : $ecms_config['site_url'];
$cas = new ClientCas();
initApi();
/**
* CAS 登录流程
*/
if ($mod == 'login') {
$phpcas = $cas->login($ref_url);
$ssoapi = new ClientUser();
$result = $ssoapi->cas($phpcas['id']);
if ($result['status'] == 'fail' || !$result['data']) {
$member = \internalApi\ucenter\Member::getSyncByWxhuid($phpcas['id']);
if (!$member) {
printerrortourl('/',"CAS接口错误".json_encode($result['data']), 3);
}
$member = $result['data'];
$cmsmember = $empire->fetch1("select ".eReturnSelectMemberF('*')." from ".eReturnMemberTable()." where ".egetmf('ucid')."={$member['uid']} limit 1");
......@@ -43,17 +45,14 @@ if ($mod == 'login') {
} else {
include('class/member_registerfun.php');
if ($mobile = usernameIsMobile($member['username'])) {
$member['username'] = genMobileByUsername($mobile);
}
$email = ($member['mobile'] ? : $member['username']) . "@ibanshou.cn";
$email = $member['mail'] ?: "wk{$member['uid']}@ibanshou.cn";
$expand = [
'ucid' => $member['uid'],
'nickname' => $member['nickname'],
'mobile' => $member['mobile'],
'avatar' => $member['avatar'],
];
$result = wxhreg($member['username'], 'ibanshou', $email, $expand);
$result = wxhreg($member['username'], uniqid(), $email, $expand);
header("Location: {$ref_url}");
}
}
......
......@@ -58,12 +58,12 @@ if($mhavelogin==1)
{
?>
document.write("&raquo;&nbsp;<font color=red><b><?=$myusername?></b></font>&nbsp;&nbsp;<a href=\"/e/member/my/\" target=\"_parent\"><?=$groupname?></a>&nbsp;<?=$havemsg?>&nbsp;<a href=\"/e/space/?userid=<?=$myuserid?>\" target=_blank>我的空间</a>&nbsp;&nbsp;<a href=\"/e/member/msg/\" target=_blank>短信息</a>&nbsp;&nbsp;<a href=\"/e/member/fava/\" target=_blank>收藏夹</a>&nbsp;&nbsp;<a href=\"/e/member/cp/\" target=\"_parent\">控制面板</a>&nbsp;&nbsp;<a href=\"/e/member/doaction.php?enews=exit&ecmsfrom=9\" onclick=\"return confirm(\'确认要退出?\');\">退出</a>");
<?
<?php
}
else
{
?>
document.write("<form name=login method=post action=\"/e/member/doaction.php\"> <input type=hidden name=enews value=login> <input type=hidden name=ecmsfrom value=9> 用户名:<input name=\"username\" type=\"text\" class=\"inputText\" size=\"16\" />&nbsp; 密码:<input name=\"password\" type=\"password\" class=\"inputText\" size=\"16\" />&nbsp; <input type=\"submit\" name=\"Submit\" value=\"登陆\" class=\"inputSub\" />&nbsp; <input type=\"button\" name=\"Submit2\" value=\"注册\" class=\"inputSub\" onclick=\"window.open(\'/e/member/register/\');\" /></form>");
<?
<?php
}
?>
\ No newline at end of file
......@@ -123,7 +123,7 @@ document.write('<script src="/e/member/login/loginjs.php?t='+Math.random()+'"><'
<td align="left" valign="top"><table width="100%" border="0" cellpadding="4" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="100%" valign="top" bgcolor="#FFFFFF">
<?
<?php
while($r=$empire->fetch($sql))
{
$r['retext']=nl2br($r[retext]);
......@@ -160,7 +160,7 @@ if($r[retext])
</table>
<br />
<?
<?php
}
?>
......
......@@ -16,7 +16,7 @@ $config = [
'port' => 443,
'server_ca_cert_path' => '',
'debug' => false,
'server_ip' => ['54.222.158.174'],
'server_ip' => ['54.222.158.174','111.230.165.181'],
'logs' => 'e/data/phpcas.log',
'uc_base_url' => 'http://u.test.yunyamooc.com/',
],
......
......@@ -51,21 +51,21 @@ function comments() {
function tpl(comment) {
var html = '<li data-id="'+ comment.id +'">\
var html = '<li data-id="' + comment.id + '">\
<img src="' + comment.avatar + '">\
<div class="name">' + comment.nickname + '</div>\
<div class="comment-main">' + comment.content + '</div>\
<div class="comment-footbar clearfix">\
<span>' + comment.created_at + '</span>\
<a href="javascript:popReplyComment(' + comment.id + ');" class="pl-reply"><i class="iconfont icon-comment_light"></i>回复</a> \
<a href="javascript:likeComment(' + comment.id + ', ' + comment.islike + ');" class="pl-zan"><i class="iconfont '+(comment.islike?"icon-zan-fill":"icon-zan")+'"></i>赞</a> \
<a href="javascript:likeComment(' + comment.id + ', ' + comment.islike + ');" class="pl-zan"><i class="iconfont ' + (comment.islike ? "icon-zan-fill" : "icon-zan") + '"></i>赞</a> \
</div>';
if (!$.isEmptyObject(comment.reply)) {
var replys = comment.reply;
html += '<div class="comment-replay">';
for (i in replys) {
html += '<div class="comment-replay-list"><span>'+replys[i].nickname+':</span>'+replys[i].content+' <span>'+replys[i].created_at+'</span></div>';
html += '<div class="comment-replay-list"><span>' + replys[i].nickname + ':</span>' + replys[i].content + ' <span>' + replys[i].created_at + '</span></div>';
}
html += '</div>';
}
......@@ -74,7 +74,7 @@ function tpl(comment) {
//回复弹窗
function popReplyComment(id) {
var parent = $('.comment-list').find('> li[data-id='+id+']');
var parent = $('.comment-list').find('> li[data-id=' + id + ']');
var name = parent.find('> .name').text() + ':';
var content = parent.find('> .comment-main').text();
$('#reply-name').text(name);
......@@ -119,15 +119,15 @@ $(".reply-pl").click(function () {
});
function handelReplyComment(plid, comment) {
$.each( $('.comment-list li'), function(){
$.each($('.comment-list li'), function () {
if ($(this).attr('data-id') == plid) {
var html = '';
if($(this).children(".comment-replay").html()) {
html = '<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>';
if ($(this).children(".comment-replay").html()) {
html = '<div class="comment-replay-list"><span>' + comment.nickname + ':</span>' + comment.content + ' <span>' + comment.created_at + '</span></div>';
$(this).children(".comment-replay").append(html);
} else {
html = '<div class="comment-replay">\
<div class="comment-replay-list"><span>'+comment.nickname+':</span>'+comment.content+' <span>'+comment.created_at+'</span></div>\
<div class="comment-replay-list"><span>' + comment.nickname + ':</span>' + comment.content + ' <span>' + comment.created_at + '</span></div>\
</div>';
$(this).append(html);
}
......@@ -143,7 +143,7 @@ function likeComment(plid, islike) {
$.post("/e/action/news/comment.php?mod=like", {plid: plid}, function (e) {
if (e.status) {
$.each( $('.comment-list li'), function(){
$.each($('.comment-list li'), function () {
if ($(this).attr('data-id') == plid) {
$(this).find(".icon-zan").addClass("icon-zan-fill").removeClass("icon-zan");
}
......@@ -158,40 +158,47 @@ function likeComment(plid, islike) {
function shareSuccessCallback(type) {
$.ajax({
type: "GET",
url: "/e/action/credit.php?mod=credit&type="+type,
url: "/e/action/credit.php?mod=credit&type=" + type,
data: '',
dataType: "json",
success: function(response){
if(response.status){
success: function (response) {
if (response.status) {
cookieTips();
}
}
});
}
function getCookie(sName)
{
function getCookie(sName) {
var aCookie = document.cookie.split("; ");
for (var i=0; i < aCookie.length; i++)
{
for (var i = 0; i < aCookie.length; i++) {
var aCrumb = aCookie[i].split("=");
if (sName == aCrumb[0])
return unescape(aCrumb[1]);
}
return null;
}
function setCookie(cname, cvalue) {
document.cookie = cname + "=" + cvalue + "; ";
}
function deleteCookie(name, path) { // 删除Cookie
var strCookie;
// 检查Cookie是否存在
// 设置Cookie的期限为己过期
strCookie = name + "=";
strCookie += (path) ? "; path=" + path : "";
document.cookie = strCookie;
}//end function deleteCookie
function cookieTips() {
var obj = getCookie('udvqbcreditNotice');
if(obj){
var obj = getCookie('creditNotice');
if (obj) {
obj = JSON.parse(obj);
var desc = '分享成功金币 +'+ obj.number;
Banshou.creditTip(obj.title,desc,2000);
setCookie('udvqbcreditNotice','');
var desc = '金币 +' + obj.number;
Banshou.creditTip(obj.title, desc, 3000);
deleteCookie('creditNotice','/');
}
}
......@@ -220,7 +227,7 @@ function scrollLoading() {
var lastplid = $(".comment-list li:last-child").attr('data-id');
lastplid = lastplid ? lastplid : 0;
scrollLoad.html("<img src='" + spinner + "'>");
$.post("/e/action/news/comment.php", {newsid:newsid, lastplid:lastplid}, function (e) {
$.post("/e/action/news/comment.php", {newsid: newsid, lastplid: lastplid}, function (e) {
if (!$.isEmptyObject(e.data)) {
var comments = e.data;
var html = '';
......@@ -231,7 +238,7 @@ function scrollLoading() {
} else {
scrollLoad.html("全部加载完毕");
$(window).off("scroll", scrollLoading);
setTimeout(function() {
setTimeout(function () {
scrollLoad.slideUp();
}, 1000);
}
......@@ -266,11 +273,11 @@ $.post("/e/action/news/index.php?mod=init", {newsid: newsid}, function (e) {
//点赞
function diggtop() {
$('#zan').one('click',function () {
$('#zan').one('click', function () {
$.post("/e/action/news/index.php?mod=diggtop", {newsid: newsid}, function (e) {
if (e.status) {
$("#zan").find('i').removeClass('icon-zan').addClass('icon-zan-fill');
$('.zan-tip').animate({opacity: "1", top: "-=30"},500).animate({opacity: "0", top: "-30"}, "slow");
$('.zan-tip').animate({opacity: "1", top: "-=30"}, 500).animate({opacity: "0", top: "-30"}, "slow");
} else {
pop(e.msg, e.data);
}
......@@ -295,9 +302,9 @@ $('#favor').click(function () {
}, 'json');
});
(function($) {
(function ($) {
//加载乐视视频
$("div.lecloud-video").each(function() {
$("div.lecloud-video").each(function () {
var width = 640, height = 360, rate = width / height;
var video = createVideoElement(width, height);
$(this).replaceWith(video);
......
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