Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
scrapper-portabilidad
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
Javier
scrapper-portabilidad
Commits
4cab2441
Commit
4cab2441
authored
Mar 31, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Se agrega Postpago y se corrije error en número al recargar
parent
782a1b01
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
create_user.php
mbilling/create_user.php
+1
-1
functions.py
mbilling/functions.py
+12
-7
No files found.
mbilling/create_user.php
View file @
4cab2441
...
@@ -14,7 +14,7 @@ if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4]) &&
...
@@ -14,7 +14,7 @@ if (isset($argv[1]) && isset($argv[2]) && isset($argv[3]) && isset($argv[4]) &&
'password'
=>
$argv
[
2
]
.
strval
(
rand
(
100
,
999
)),
'password'
=>
$argv
[
2
]
.
strval
(
rand
(
100
,
999
)),
'active'
=>
'1'
,
'active'
=>
'1'
,
'firstname'
=>
str_replace
(
"
\"
"
,
""
,
strtoupper
(
$argv
[
3
])),
'firstname'
=>
str_replace
(
"
\"
"
,
""
,
strtoupper
(
$argv
[
3
])),
'lastname'
=>
str
toupper
(
$argv
[
4
]
),
'lastname'
=>
str
_replace
(
"
\"
"
,
""
,
strtoupper
(
$argv
[
4
])
),
'callingcard_pin'
=>
strval
(
rand
(
1000
,
9999
)),
'callingcard_pin'
=>
strval
(
rand
(
1000
,
9999
)),
'id_group'
=>
3
,
'id_group'
=>
3
,
'id_plan'
=>
$argv
[
5
],
'id_plan'
=>
$argv
[
5
],
...
...
mbilling/functions.py
View file @
4cab2441
...
@@ -17,8 +17,8 @@ DB_CREDENTIALS = {
...
@@ -17,8 +17,8 @@ DB_CREDENTIALS = {
'host'
:
re
.
match
(
r'.*http://([0-9\.]+).*'
,
values
[
'MAGNUS_HOST'
],
flags
=
re
.
DOTALL
)
.
group
(
1
),
'host'
:
re
.
match
(
r'.*http://([0-9\.]+).*'
,
values
[
'MAGNUS_HOST'
],
flags
=
re
.
DOTALL
)
.
group
(
1
),
'user'
:
values
[
'DB_USER'
],
'user'
:
values
[
'DB_USER'
],
'password'
:
values
[
'DB_PASSWORD'
],
'password'
:
values
[
'DB_PASSWORD'
],
'port'
:
3306
,
'port'
:
3306
,
'database'
:
'mbilling'
'database'
:
'mbilling'
}
}
...
@@ -129,7 +129,13 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
...
@@ -129,7 +129,13 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
password
=
password
if
password
else
''
.
join
(
password
=
password
if
password
else
''
.
join
(
(
name
.
split
(
' '
)[
0
]
.
lower
(),
str
(
randint
(
100
,
999
))))
(
name
.
split
(
' '
)[
0
]
.
lower
(),
str
(
randint
(
100
,
999
))))
_create_user
(
phone_number
,
password
,
name
,
surname
,
plan_id
,
offer_id
)
# Eliminamos Espacios entre Elementos
phone_number
=
phone_number
.
strip
()
name
=
name
.
strip
()
surname
=
surname
.
strip
()
# Lanzamos las Acciones del API
_create_user
(
phone_number
.
strip
(),
password
,
name
,
surname
,
plan_id
,
offer_id
)
_create_sip
(
phone_number
,
password
,
pbx
)
_create_sip
(
phone_number
,
password
,
pbx
)
_create_did
(
phone_number
)
_create_did
(
phone_number
)
...
@@ -139,8 +145,7 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
...
@@ -139,8 +145,7 @@ def create_user(phone_number: str, name: str, surname: str, password: str = None
"UPDATE mbilling.pkg_user SET typepaid=1, creditlimit=30 WHERE username=?"
,
"UPDATE mbilling.pkg_user SET typepaid=1, creditlimit=30 WHERE username=?"
,
(
phone_number
,)
(
phone_number
,)
)
)
cursor
.
fetchone
()
cnx
.
commit
()
return
password
return
password
...
@@ -162,7 +167,7 @@ def add_balance(phone_number: str, quantity: float, tax: float = 0.21, descript
...
@@ -162,7 +167,7 @@ def add_balance(phone_number: str, quantity: float, tax: float = 0.21, descript
result
=
subprocess
.
check_output
(
result
=
subprocess
.
check_output
(
[
'php'
,
pathlib
.
Path
(
mbapi_path
,
'add_balance.php'
),
[
'php'
,
pathlib
.
Path
(
mbapi_path
,
'add_balance.php'
),
phone_number
,
quantity
,
f
'
\"
{description}
\"
'
]
phone_number
.
strip
()
,
quantity
,
f
'
\"
{description}
\"
'
]
)
)
if
not
re
.
match
(
succesful
,
result
.
decode
(
'utf-8'
)):
if
not
re
.
match
(
succesful
,
result
.
decode
(
'utf-8'
)):
...
@@ -192,6 +197,6 @@ def get_user(phone_number: str) -> dict:
...
@@ -192,6 +197,6 @@ def get_user(phone_number: str) -> dict:
(
phone_number
,)
(
phone_number
,)
)
)
query
=
cursor
.
fetchone
()
cnx
.
commit
()
return
dict
(
zip
(
headers
,
query
))
if
query
else
None
return
dict
(
zip
(
headers
,
query
))
if
query
else
None
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