Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
s_ibanshou
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋林
s_ibanshou
Commits
90aa42b1
Commit
90aa42b1
authored
Apr 24, 2018
by
杨培
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了用户邮箱与同步机制
parent
6a1132b8
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
682 additions
and
120 deletions
+682
-120
q_functions.php
e/class/q_functions.php
+7
-1
autoload.php
e/extend/internalApi/autoload.php
+6
-6
ApiException.php
e/extend/internalApi/base/ApiException.php
+28
-0
Client.php
e/extend/internalApi/base/Client.php
+3
-2
Server.php
e/extend/internalApi/base/Server.php
+1
-1
client_config.exmaple.php
e/extend/internalApi/client_config.exmaple.php
+0
-27
client_config_dev.php
e/extend/internalApi/client_config_dev.php
+0
-25
User.php
e/extend/internalApi/code/User.php
+33
-0
User.php
e/extend/internalApi/portal/User.php
+28
-0
server.example.php
e/extend/internalApi/server.example.php
+0
-44
Exam.php
e/extend/internalApi/ucenter/Exam.php
+32
-0
Express.php
e/extend/internalApi/ucenter/Express.php
+46
-0
Favorite.php
e/extend/internalApi/ucenter/Favorite.php
+14
-2
Follow.php
e/extend/internalApi/ucenter/Follow.php
+77
-0
Member.php
e/extend/internalApi/ucenter/Member.php
+64
-0
Message.php
e/extend/internalApi/ucenter/Message.php
+45
-3
Order.php
e/extend/internalApi/ucenter/Order.php
+74
-0
ScoreRecord.php
e/extend/internalApi/ucenter/ScoreRecord.php
+28
-0
Wallet.php
e/extend/internalApi/ucenter/Wallet.php
+55
-0
Course.php
e/extend/internalApi/xue/Course.php
+38
-0
Exam.php
e/extend/internalApi/xue/Exam.php
+50
-0
User.php
e/extend/internalApi/xue/User.php
+44
-0
cas.php
e/member/cas.php
+9
-9
No files found.
e/class/q_functions.php
View file @
90aa42b1
...
...
@@ -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
e/extend/internalApi/autoload.php
View file @
90aa42b1
...
...
@@ -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'
);
e/extend/internalApi/base/ApiException.php
View file @
90aa42b1
...
...
@@ -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
e/extend/internalApi/base/Client.php
View file @
90aa42b1
...
...
@@ -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\n
ErrorNo:
$errno
\r\n
ErrorMsg:
$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
"
;
...
...
e/extend/internalApi/base/Server.php
View file @
90aa42b1
...
...
@@ -118,7 +118,7 @@ class Server
'class'
=>
get_class
(
$e
),
'code'
=>
$e
->
getCode
(),
'message'
=>
$e
->
getMessage
(),
'line'
=>
$e
->
get
Fil
e
(),
'line'
=>
$e
->
get
Lin
e
(),
'file'
=>
$e
->
getFile
(),
'traceString'
=>
$e
->
getTraceAsString
()
];
...
...
e/extend/internalApi/client_config.exmaple.php
deleted
100644 → 0
View file @
6a1132b8
<?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
e/extend/internalApi/client_config_dev.php
deleted
100644 → 0
View file @
6a1132b8
<?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
e/extend/internalApi/code/User.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/portal/User.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/server.example.php
deleted
100644 → 0
View file @
6a1132b8
<?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
e/extend/internalApi/ucenter/Exam.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/ucenter/Express.php
0 → 100644
View file @
90aa42b1
<?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'
));
}
}
e/extend/internalApi/ucenter/Favorite.php
View file @
90aa42b1
...
...
@@ -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'
));
...
...
e/extend/internalApi/ucenter/Follow.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/ucenter/Member.php
View file @
90aa42b1
...
...
@@ -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
e/extend/internalApi/ucenter/Message.php
View file @
90aa42b1
...
...
@@ -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'
));
}
}
e/extend/internalApi/ucenter/Order.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/ucenter/ScoreRecord.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/ucenter/Wallet.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/xue/Course.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/xue/Exam.php
0 → 100644
View file @
90aa42b1
<?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
e/extend/internalApi/xue/User.php
0 → 100644
View file @
90aa42b1
<?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
e/member/cas.php
View file @
90aa42b1
...
...
@@ -3,6 +3,8 @@
require
'../class/connect.php'
;
require
'../class/db_sql.php'
;
require
'class/user.php'
;
require
'../class/q_functions.php'
;
require
"../extend/ibanshou/ClientUser.php"
;
$link
=
db_connect
();
$empire
=
new
mysqlquery
();
...
...
@@ -14,17 +16,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 +46,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
}
"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment