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
4138d4a2
Commit
4138d4a2
authored
Apr 28, 2022
by
Javier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Usuario Ext
parent
6a172079
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
cli.py
cli.py
+21
-2
No files found.
cli.py
View file @
4138d4a2
...
@@ -132,19 +132,38 @@ def update_balance(target_clis: list[str]) -> Tuple[int, int]:
...
@@ -132,19 +132,38 @@ def update_balance(target_clis: list[str]) -> Tuple[int, int]:
with
typer
.
progressbar
(
active_users
(),
label
=
"Actualizando Balance"
)
as
progress
:
with
typer
.
progressbar
(
active_users
(),
label
=
"Actualizando Balance"
)
as
progress
:
for
sip_account
in
progress
:
for
sip_account
in
progress
:
if
sip_account
[
'username'
]
in
target_clis
:
if
sip_account
[
'username'
]
in
target_clis
:
# Cálculo de Parámetros
flat_rate
=
sip_account
[
'offer'
]
if
sip_account
[
'plan'
]
==
TARIFA_PLANA_ID
else
None
flat_rate
=
sip_account
[
'offer'
]
if
sip_account
[
'plan'
]
==
TARIFA_PLANA_ID
else
None
credit
=
999.00
if
sip_account
[
'credit'
]
<=
0
and
sip_account
[
'postpaid'
]
==
True
else
round
(
sip_account
[
'credit'
],
2
)
# Si la cuenta es emisora de llamadas, añadimos ClaveEXT
if
sip_account
[
'credit'
]
>
0
:
cursor
.
execute
(
"""UPDATE [bdd_wifi].[dbo].[TB_ServicioFijo]
SET SaldoActual=?, Activo=?, TarifaPlana=?, Pospago=?, IdTarifa=?, UsuarioEXT=?,
ClaveEXT=? WHERE DDI=? AND FechaBaja is NULL"""
,
(
credit
,
sip_account
[
'active'
],
flat_rate
,
sip_account
[
'postpaid'
],
sip_account
[
'plan'
],
sip_account
[
'username'
],
sip_account
[
'password'
],
sip_account
[
'username'
])
)
else
:
cursor
.
execute
(
cursor
.
execute
(
"""UPDATE [bdd_wifi].[dbo].[TB_ServicioFijo]
"""UPDATE [bdd_wifi].[dbo].[TB_ServicioFijo]
SET SaldoActual=?, Activo=?, TarifaPlana=?, Pospago=?, IdTarifa=?
SET SaldoActual=?, Activo=?, TarifaPlana=?, Pospago=?, IdTarifa=?
WHERE DDI=? AND FechaBaja is not
NULL"""
,
WHERE DDI=? AND FechaBaja is
NULL"""
,
(
sip_account
[
'credit'
]
,
sip_account
[
'active'
],
(
credit
,
sip_account
[
'active'
],
flat_rate
,
sip_account
[
'postpaid'
],
sip_account
[
'plan'
],
sip_account
[
'username'
])
flat_rate
,
sip_account
[
'postpaid'
],
sip_account
[
'plan'
],
sip_account
[
'username'
])
)
)
updated
=
updated
+
1
updated
=
updated
+
1
cnx
.
commit
()
else
:
else
:
non_updated
=
non_updated
+
1
non_updated
=
non_updated
+
1
return
updated
,
non_updated
return
updated
,
non_updated
...
...
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