Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
b118d28c
Commit
b118d28c
authored
Jan 18, 2018
by
clone
Committed by
hujun
Mar 01, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用户体系 注册返回唯一id
parent
b0a63d00
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
140 additions
and
0 deletions
+140
-0
RegisterUtil.php
application/chat/utils/RegisterUtil.php
+88
-0
curl_cookie.txt
application/chat/utils/curl_cookie.txt
+5
-0
ChatUser.php
application/model/ChatUser.php
+47
-0
No files found.
application/chat/utils/RegisterUtil.php
0 → 100644
View file @
b118d28c
<?php
namespace
app\chat\utils
;
use
app\chat\consts\ConfigConst
;
use
app\chat\utils
;
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 14:47
* Intro: 注册环信用户
*/
class
RegisterUtil
{
const
IM_REGISTER_USER
=
"/users"
;
const
IM_DELETE_USER
=
"/users"
;
/**
* @param $username
* @param $password
* @return CurlResponse|bool
*/
public
function
registerByCurl
(
$username
,
$password
)
{
$arr
=
array
(
'username'
=>
$username
,
'password'
=>
$password
,
);
$data
=
json_encode
(
$arr
);
$curl
=
new
CurlUtil
();
$curl
->
headers
=
[
"Accept"
=>
"application/json"
,
"Content-Type"
=>
"application/json;charset=utf-8"
,
];
$curl
->
options
=
[
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
$url
=
$this
->
buildSendUrl
()
.
self
::
IM_REGISTER_USER
;
$response
=
$curl
->
post
(
$url
,
$data
);
return
$response
;
}
/**
* @param $username
* @param $access_token
* @return CurlResponse|bool
*/
public
function
deleteByCurl
(
$username
,
$access_token
)
{
$arr
=
array
(
'username'
=>
$username
,
);
$data
=
json_encode
(
$arr
);
$curl
=
new
CurlUtil
();
$curl
->
delete
();
$curl
->
headers
=
[
"Accept"
=>
"application/json"
,
"Content-Type"
=>
"application/json;charset=utf-8"
,
'Authorization'
=>
$access_token
,
];
$curl
->
options
=
[
"CURLOPT_SSL_VERIFYPEER"
=>
0
,
"CURLOPT_SSL_VERIFYHOST"
=>
2
,
];
$url
=
$this
->
buildSendUrl
()
.
self
::
IM_DELETE_USER
;
$response
=
$curl
->
post
(
$url
,
$data
);
return
$response
;
}
/**
* 请求api
* @return string
*/
private
function
buildSendUrl
()
{
return
ConfigConst
::
API_PATH
.
ConfigConst
::
ORG_NAME
.
"/"
.
ConfigConst
::
APP_NAME
;
}
}
\ No newline at end of file
application/chat/utils/curl_cookie.txt
0 → 100644
View file @
b118d28c
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
a1.easemob.com FALSE / FALSE 1516264437 rememberMe deleteMe
application/model/ChatUser.php
0 → 100644
View file @
b118d28c
<?php
/**
* Created by PhpStorm.
* User : zw
* Date : 2018/1/18
* Time : 15:33
* Intro:
*/
namespace
app\model
;
use
think\Model
;
use
think\Db
;
class
ChatUser
extends
Model
{
// 设置当前模型对应的完整数据表名称
protected
$table
=
'chat_user'
;
protected
$db
;
public
function
__construct
()
{
$this
->
db
=
Db
(
$this
->
table
);
}
public
function
getChatUser
(
$params
,
$field
=
"only_id,phone"
)
{
$data
=
$this
->
db
->
field
(
$field
)
->
where
(
$params
)
->
select
();
return
$data
;
}
public
function
addChatUser
(
$params
)
{
Db
::
startTrans
();
try
{
$this
->
save
(
$params
);
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
Db
::
rollback
();
}
}
}
\ No newline at end of file
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