Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
util
Overview
Overview
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
刘旋尧
util
Commits
5eeb914f
Commit
5eeb914f
authored
Jul 21, 2016
by
usual2970
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拨打电话API
parent
df5327e6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
2 deletions
+58
-2
.gitignore
.gitignore
+1
-0
client.go
request/client.go
+3
-2
tel.go
service/controllers/tel.go
+44
-0
result.go
service/models/result.go
+9
-0
router.go
service/routers/router.go
+1
-0
No files found.
.gitignore
View file @
5eeb914f
util
util
service/service
request/client.go
View file @
5eeb914f
...
@@ -22,7 +22,9 @@ type Client struct {
...
@@ -22,7 +22,9 @@ type Client struct {
type
Resp
struct
{
type
Resp
struct
{
Code
,
Description
,
Sessionid
string
Code
string
`json:"code"`
Description
string
`json:"description"`
Sessionid
string
`json:"sessionid"`
}
}
func
(
clt
*
Client
)
AppKey
()
string
{
func
(
clt
*
Client
)
AppKey
()
string
{
...
@@ -93,7 +95,6 @@ func (clt *Client) Post(url string,params interface{}) (resp Resp,err error){
...
@@ -93,7 +95,6 @@ func (clt *Client) Post(url string,params interface{}) (resp Resp,err error){
fmt
.
Println
(
err
)
fmt
.
Println
(
err
)
return
return
}
}
fmt
.
Println
(
resp
)
return
return
}
}
...
...
service/controllers/tel.go
0 → 100644
View file @
5eeb914f
package
controllers
import
(
"github.com/astaxie/beego"
"github.com/usual2970/util/tel"
"github.com/usual2970/util/service/models"
)
type
TelController
struct
{
beego
.
Controller
}
func
(
c
*
TelController
)
Dial
()
{
rs
:=&
models
.
Result
{
"0"
,
"success"
,
nil
}
for
{
from
:=
c
.
GetString
(
"from"
)
if
from
==
""
{
rs
.
ErrNo
=
"1"
rs
.
Msg
=
"请提交主叫号码"
break
}
to
:=
c
.
GetString
(
"to"
)
if
to
==
""
{
rs
.
ErrNo
=
"2"
rs
.
Msg
=
"请提交被叫号码"
break
}
telObj
:=
tel
.
NewTel
(
from
,
to
)
resp
,
err
:=
telObj
.
Dial
()
if
err
!=
nil
{
rs
.
ErrNo
=
"2"
rs
.
Msg
=
"拨打失败"
break
;
}
rs
.
Data
=
resp
break
}
c
.
Data
[
"json"
]
=
rs
c
.
ServeJSON
()
}
service/models/result.go
0 → 100644
View file @
5eeb914f
package
models
type
Result
struct
{
ErrNo
string
`json:"errNo"`
Msg
string
`json:"msg"`
Data
interface
{}
`json:"data"`
}
\ No newline at end of file
service/routers/router.go
View file @
5eeb914f
...
@@ -7,4 +7,5 @@ import (
...
@@ -7,4 +7,5 @@ import (
func
init
()
{
func
init
()
{
beego
.
Router
(
"/"
,
&
controllers
.
MainController
{})
beego
.
Router
(
"/"
,
&
controllers
.
MainController
{})
beego
.
AutoRouter
(
&
controllers
.
TelController
{})
}
}
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