Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AmiBX
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
bitrix
AmiBX
Commits
ae1e736f
Commit
ae1e736f
authored
Apr 01, 2022
by
Kulya
😊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix warn in actionfile
parent
0bdf9531
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
230 additions
and
46 deletions
+230
-46
AloVoiceActions.php
vendor/alovoice/src/AloVoiceActions.php
+1
-1
AloVoiceConnector.php
vendor/alovoice/src/AloVoiceConnector.php
+95
-19
AloVoiceHandle.php
vendor/alovoice/src/AloVoiceHandle.php
+7
-8
AloVoiceRest.php
vendor/alovoice/src/AloVoiceRest.php
+53
-0
BitrixEvents.php
vendor/alovoice/src/BitrixEvents.php
+47
-2
ATelegram.php
vendor/tg/src/ATelegram.php
+27
-16
No files found.
vendor/alovoice/src/AloVoiceActions.php
View file @
ae1e736f
...
...
@@ -629,7 +629,7 @@ class AloVoiceActions
}
$keyVal
=
explode
(
':'
,
trim
(
$line
));
$tag
=
trim
(
$keyVal
[
0
]);
$value
=
trim
(
$keyVal
[
1
],
"
\t\n\r\0\x0B\"
"
)
;
$value
=
(
!
empty
(
$keyVal
[
1
]))
?
trim
(
$keyVal
[
1
],
"
\t\n\r\0\x0B\"
"
)
:
""
;
if
(
!
empty
(
$keyVal
[
2
]))
{
$value
=
$value
.
' '
.
trim
(
$keyVal
[
2
],
"
\t\n\r\0\x0B\"
"
);
}
if
(
!
$tag
)
continue
;
...
...
vendor/alovoice/src/AloVoiceConnector.php
View file @
ae1e736f
...
...
@@ -242,15 +242,15 @@ class AloVoiceConnector
return
$this
->
returnRes
(
$resAction
);
}
$this
->
TG
=
new
\TGA\ATelegram
();
$tgla
=
$this
->
TG
->
doTgMethod
(
$_REQUEST
);
$this
->
eLog
(
$tgla
,
"------ ATelegram: RES:"
);
if
(
!
empty
(
$tgla
)){
if
(
!
empty
(
$tgla
[
"action"
])
){
$alvRest
->
doMethod
(
$tgla
[
"action"
]);
}
return
$this
->
returnRes
(
$tgla
);
}
//
$this->TG = new \TGA\ATelegram();
//
$tgla = $this->TG->doTgMethod($_REQUEST);
//
$this->eLog($tgla,"------ ATelegram: RES:");
//
if(!empty($tgla)){
//
if( !empty($tgla["action"]) ){
//
$alvRest->doMethod($tgla["action"]);
//
}
//
return $this->returnRes($tgla);
//
}
$bxEvent
=
new
BitrixEvents
(
$this
->
configs
);
if
(
!
empty
(
$bxEventRes
=
$bxEvent
->
runEvents
())){
...
...
@@ -2396,6 +2396,9 @@ CFU=';
}
if
(
empty
(
$outBxCallId
)){
if
(
strlen
(
$queryData
)
==
9
){
$queryData
=
"+998"
.
$queryData
;
}
$bxRes
=
BxRest
::
call
(
"telephony.externalcall.register"
,
$queryData
);
self
::
eLog
(
$bxRes
,
"--== startCall RES:"
);
}
else
{
...
...
@@ -3295,24 +3298,31 @@ CFU=';
return
false
;
}
public
function
didox_inn
(
$inn
=
false
){
public
function
didox_inn
(
$inn
=
false
,
$info
=
false
){
$frominn
=
'303903621'
;
$didoxTokenFile
=
__DIR__
.
'/didox.json'
;
$didoxToken
=
false
;
$jsDidoxToken
=
file_get_contents
(
$didoxTokenFile
);
$timerz
=
36000
;
$timerz
=
3600
;
self
::
eLog
(
"Test DiDox INN TokenCheck time["
.
time
()
.
"] JS:"
.
$jsDidoxToken
);
if
(
!
empty
(
$jsDidoxToken
)){
$arDdxToken
=
json_decode
(
$jsDidoxToken
,
true
);
if
(
!
empty
(
$arDdxToken
[
"time"
])
&&
!
empty
(
$arDdxToken
[
"token"
])){
$ddxrz
=
time
()
-
$arDdxToken
[
"time"
];
$ddxrz
=
time
()
-
$arDdxToken
[
"time"
];
self
::
eLog
(
"Test DiDox INN TokenCheck Razn["
.
$ddxrz
.
"]"
);
if
(
$ddxrz
<
$timerz
){
$didoxToken
=
$arDdxToken
[
"token"
];
}
}
}
self
::
eLog
(
"Test DiDox INN TokenCheck:"
.
$didoxToken
);
if
(
empty
(
$didoxToken
)){
$ddxRes
=
self
::
didoxrequest
(
false
,
"user/"
.
$frominn
.
"/token"
,[
"password"
=>
"mteamgfhjkm"
]);
self
::
eLog
(
"Test DiDox INN TokenCheck REQ RES:"
.
$ddxRes
);
if
(
!
empty
(
$ddxRes
)
&&
strlen
(
$ddxRes
)
>
20
){
if
(
file_put_contents
(
$didoxTokenFile
,
json_encode
([
"time"
=>
time
(),
"token"
=>
$ddxRes
]))){
$didoxToken
=
$ddxRes
;
...
...
@@ -3324,19 +3334,32 @@ CFU=';
if
(
!
empty
(
$didoxToken
)
&&
!
empty
(
$inn
)){
$ddxInnRes
=
self
::
didoxrequest
(
$didoxToken
,
"info/"
.
$inn
);
$arInnRes
=
json_decode
(
$ddxInnRes
,
true
);
if
(
!
empty
(
$arInnRes
)){
return
$arInnRes
;
// $arInnRes = json_decode($ddxInnRes,true);
// if(!empty($arInnRes)){
// return $arInnRes;
// }
}
elseif
(
!
empty
(
$info
)){
if
(
$info
==
"banks"
){
$ddxInnRes
=
self
::
didoxrequest
(
$didoxToken
,
"https://api.didox.uz/v1/banks/all"
);
}
elseif
(
$info
==
"regions"
){
$ddxInnRes
=
self
::
didoxrequest
(
$didoxToken
,
"https://api.didox.uz/v1/regions/all"
);
}
}
return
false
;
return
(
!
empty
(
$ddxInnRes
))
?
$ddxInnRes
:
false
;
}
public
function
didoxrequest
(
$t
,
$m
,
$d
=
false
){
public
function
didoxrequest
(
$t
,
$m
,
$d
=
false
,
$p
=
false
){
if
(
empty
(
$m
)){
return
""
;
}
//https://api.goodsign.biz/waltz/goodsign/0.0.1/user/303903621/token
if
(
substr
(
$m
,
0
,
5
)
==
"https"
){
$urlrest
=
$m
;
}
else
{
$urlrest
=
'https://api.goodsign.biz/waltz/goodsign/0.0.1/'
.
$m
;
}
// $urlrest = 'https://api.goodsign.biz/waltz/goodsign/0.0.1/info/'.$inn;
$curl
=
curl_init
();
...
...
@@ -3377,7 +3400,7 @@ CFU=';
return
$response
;
// return json_decode($response,true);
}
//UF_CRM_1609777763
public
function
nn
(
$number
,
$nplus
=
false
)
{
// self::eLog($number,"Number test 1");
$number
=
preg_replace
(
"/[^0-9]/"
,
''
,
$number
);
...
...
@@ -3395,6 +3418,59 @@ CFU=';
return
(
$nplus
)
?
substr
(
$number
,
1
)
:
$number
;
}
public
function
num2str
(
$num
)
{
$nul
=
'ноль'
;
$ten
=
array
(
array
(
''
,
'один'
,
'два'
,
'три'
,
'четыре'
,
'пять'
,
'шесть'
,
'семь'
,
'восемь'
,
'девять'
),
array
(
''
,
'одна'
,
'две'
,
'три'
,
'четыре'
,
'пять'
,
'шесть'
,
'семь'
,
'восемь'
,
'девять'
),
);
$a20
=
array
(
'десять'
,
'одиннадцать'
,
'двенадцать'
,
'тринадцать'
,
'четырнадцать'
,
'пятнадцать'
,
'шестнадцать'
,
'семнадцать'
,
'восемнадцать'
,
'девятнадцать'
);
$tens
=
array
(
2
=>
'двадцать'
,
'тридцать'
,
'сорок'
,
'пятьдесят'
,
'шестьдесят'
,
'семьдесят'
,
'восемьдесят'
,
'девяносто'
);
$hundred
=
array
(
''
,
'сто'
,
'двести'
,
'триста'
,
'четыреста'
,
'пятьсот'
,
'шестьсот'
,
'семьсот'
,
'восемьсот'
,
'девятьсот'
);
$unit
=
array
(
// Units
array
(
'копейка'
,
'копейки'
,
'копеек'
,
1
),
array
(
''
,
''
,
''
,
0
),
// array('рубль' ,'рубля' ,'рублей' ,0),
array
(
'тысяча'
,
'тысячи'
,
'тысяч'
,
1
),
array
(
'миллион'
,
'миллиона'
,
'миллионов'
,
0
),
array
(
'миллиард'
,
'милиарда'
,
'миллиардов'
,
0
),
);
//
list
(
$rub
,
$kop
)
=
explode
(
'.'
,
sprintf
(
"%015.2f"
,
floatval
(
$num
)));
$out
=
array
();
if
(
intval
(
$rub
)
>
0
)
{
foreach
(
str_split
(
$rub
,
3
)
as
$uk
=>
$v
)
{
// by 3 symbols
if
(
!
intval
(
$v
))
continue
;
$uk
=
sizeof
(
$unit
)
-
$uk
-
1
;
// unit key
$gender
=
$unit
[
$uk
][
3
];
list
(
$i1
,
$i2
,
$i3
)
=
array_map
(
'intval'
,
str_split
(
$v
,
1
));
// mega-logic
$out
[]
=
$hundred
[
$i1
];
# 1xx-9xx
if
(
$i2
>
1
)
$out
[]
=
$tens
[
$i2
]
.
' '
.
$ten
[
$gender
][
$i3
];
# 20-99
else
$out
[]
=
$i2
>
0
?
$a20
[
$i3
]
:
$ten
[
$gender
][
$i3
];
# 10-19 | 1-9
// units without rub & kop
if
(
$uk
>
1
)
$out
[]
=
self
::
morph
(
$v
,
$unit
[
$uk
][
0
],
$unit
[
$uk
][
1
],
$unit
[
$uk
][
2
]);
}
//foreach
}
else
$out
[]
=
$nul
;
$out
[]
=
self
::
morph
(
intval
(
$rub
),
$unit
[
1
][
0
],
$unit
[
1
][
1
],
$unit
[
1
][
2
]);
// rub
// $out[] = $kop.' '.self::morph($kop,$unit[0][0],$unit[0][1],$unit[0][2]); // kop
return
trim
(
preg_replace
(
'/ {2,}/'
,
' '
,
join
(
' '
,
$out
)));
}
/**
* Склоняем словоформу
* @ author runcore
*/
public
function
morph
(
$n
,
$f1
,
$f2
,
$f5
)
{
$n
=
abs
(
intval
(
$n
))
%
100
;
if
(
$n
>
10
&&
$n
<
20
)
return
$f5
;
$n
=
$n
%
10
;
if
(
$n
>
1
&&
$n
<
5
)
return
$f2
;
if
(
$n
==
1
)
return
$f1
;
return
$f5
;
}
public
function
statAPI
(
$m
,
$p
){
if
(
empty
(
$m
)){
return
false
;
}
...
...
vendor/alovoice/src/AloVoiceHandle.php
View file @
ae1e736f
...
...
@@ -143,7 +143,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$msgFrom
=
$eventKeys
[
"from"
];
$crmEntitySearchResult
=
BxRest
::
call
(
"telephony.externalCall.searchCrmEntities"
,
array
(
'PHONE_NUMBER'
=>
$msgFrom
,
'PHONE_NUMBER'
=>
ALVC
::
nn
(
$msgFrom
)
,
));
self
::
eLog
(
$crmEntitySearchResult
,
"--== SMS searchCrmEntities RESULT:"
,
true
);
...
...
@@ -349,7 +349,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
}
}
$connLineNum
=
(
!
empty
(
$eventKeys
[
"connectedlinenum"
]))
?
substr
(
$eventKeys
[
"connectedlinenum"
],
-
9
)
:
false
;
$connLineNum
=
(
!
empty
(
$eventKeys
[
"connectedlinenum"
]))
?
ALVC
::
nn
(
$eventKeys
[
"connectedlinenum"
]
)
:
false
;
if
(
$callRegisterParams
[
"TYPE"
]
==
1
){
$callRegisterParams
[
"USER_PHONE_INNER"
]
=
$bxchannels
[
$eventKeys
[
"linkedid"
]][
"BX24_CALLERID"
];
...
...
@@ -360,17 +360,17 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
elseif
(
(
!
empty
(
$bxchannels
[
$eventKeys
[
"linkedid"
]][
"BX24_CALLERID"
]))
&&
(
!
empty
(
$this
->
bxusers
[
$bxchannels
[
$eventKeys
[
"linkedid"
]][
"BX24_CALLERID"
]]))
){
$callRegisterParams
[
"USER_PHONE_INNER"
]
=
$bxchannels
[
$eventKeys
[
"linkedid"
]][
"BX24_CALLERID"
];
$callRegisterParams
[
"USER_ID"
]
=
$this
->
bxusers
[
$bxchannels
[
$eventKeys
[
"linkedid"
]][
"BX24_CALLERID"
]][
"ID"
];
$callRegisterParams
[
"PHONE_NUMBER"
]
=
(
is_numeric
(
$connLineNum
))
?
$connLineNum
:
substr
(
$eventKeys
[
"destexten"
],
-
9
);
$callRegisterParams
[
"PHONE_NUMBER"
]
=
(
is_numeric
(
$connLineNum
))
?
$connLineNum
:
ALVC
::
nn
(
$eventKeys
[
"destexten"
]
);
$callRegisterParams
[
"DESC"
]
=
$eventKeys
[
"destchannel"
];
}
elseif
(
!
empty
(
$this
->
bxusers
[
$eventKeys
[
"destexten"
]])
){
$callRegisterParams
[
"USER_PHONE_INNER"
]
=
$eventKeys
[
"destexten"
];
$callRegisterParams
[
"USER_ID"
]
=
$this
->
bxusers
[
$eventKeys
[
"destexten"
]][
"ID"
];
$callRegisterParams
[
"PHONE_NUMBER"
]
=
substr
(
$eventKeys
[
"calleridnum"
],
-
9
);
$callRegisterParams
[
"PHONE_NUMBER"
]
=
ALVC
::
nn
(
$eventKeys
[
"calleridnum"
]
);
$callRegisterParams
[
"DESC"
]
=
$eventKeys
[
"calleridname"
];
}
else
{
$callRegisterParams
[
"PHONE_NUMBER"
]
=
substr
(
$eventKeys
[
"calleridnum"
],
-
9
);
$callRegisterParams
[
"PHONE_NUMBER"
]
=
ALVC
::
nn
(
$eventKeys
[
"calleridnum"
]
);
}
$searchNumber
=
$callRegisterParams
[
"PHONE_NUMBER"
];
...
...
@@ -485,7 +485,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
$stParams
=
[
'TYPE'
=>
$calltype
,
'USER_PHONE_INNER'
=>
$phoneInner
,
'PHONE_NUMBER'
=>
$eventKeys
[
"destconnectedlinenum"
]
'PHONE_NUMBER'
=>
ALVC
::
nn
(
$eventKeys
[
"destconnectedlinenum"
])
];
$registerResult
=
ALVC
::
startCall
(
$stParams
,
$bxchannels
[
$linkedID
]);
...
...
@@ -694,8 +694,7 @@ class AloVoiceHandle implements \PAMI\Listener\IEventListener
);
if
(
!
empty
(
$chVars
[
"REALCALLERIDNUM"
])
){
$realCallerNum
=
preg_replace
(
"/[^0-9]/"
,
''
,
$chVars
[
"REALCALLERIDNUM"
]);
$realCallerNum
=
substr
(
$realCallerNum
,
-
9
);
$realCallerNum
=
ALVC
::
nn
(
$chVars
[
"REALCALLERIDNUM"
]);
$regParams
[
'PHONE_NUMBER'
]
=
(
!
empty
(
$realCallerNum
))
?
$realCallerNum
:
''
;
if
(
empty
(
$regParams
[
'PHONE_NUMBER'
])){
$regParams
[
'PHONE_NUMBER'
]
=
(
!
empty
(
$chVars
[
"BX24_CALLERID"
]))
?
$chVars
[
"BX24_CALLERID"
]
:
'1000002'
;
}
...
...
vendor/alovoice/src/AloVoiceRest.php
View file @
ae1e736f
...
...
@@ -1937,6 +1937,36 @@ function(result){
'status'
=>
'off'
,
)];
$res
[
'nextintegration'
]
=
'status_dealupdate'
;
$res
[
'rescheck'
]
=
$arResults
;
return
$res
;
}
private
function
status_dealupdate
(
$r
=
false
)
{
$arResults
=
BxRest
::
call
(
'event.get'
);
$integrations
=
[];
if
(
!
empty
(
$arResults
[
"result"
])){
foreach
(
$arResults
[
"result"
]
as
$itg
){
if
(
$itg
[
"event"
]
==
"ONCRMDEALUPDATE"
){
if
(
$itg
[
"handler"
]
==
$this
->
config
[
"alovoice_host"
]
){
$integrations
[]
=
array
(
'code'
=>
'crmdealupdate'
,
'title'
=>
'Обновления сделок'
,
'status'
=>
'on'
,
);
}
}
}
}
$res
[
'lines'
]
=
(
!
empty
(
$integrations
))
?
$integrations
:
[
array
(
'code'
=>
'crmdealupdate'
,
'title'
=>
'Обновления сделок'
,
'status'
=>
'off'
,
)];
$res
[
'nextintegration'
]
=
'status_alvcrmmenus'
;
$res
[
'rescheck'
]
=
$arResults
;
...
...
@@ -2403,6 +2433,13 @@ function(result){
]);
return
array
(
'do'
=>
$doResult
,
'result'
=>
'success'
);
}
if
(
$r
[
"code"
]
==
'crmdealupdate'
){
$doResult
=
BxRest
::
call
(
'event.bind'
,[
'event'
=>
'ONCRMDEALUPDATE'
,
'handler'
=>
$this
->
config
[
"alovoice_host"
],
]);
return
array
(
'do'
=>
$doResult
,
'result'
=>
'success'
);
}
if
(
$r
[
"code"
]
==
'tgservice'
){
$arResults
=
BxRest
::
call
(
'imconnector.unregister'
,[
'ID'
=>
'alotg'
]);
...
...
@@ -2650,6 +2687,22 @@ function(result){
return
array
(
'do'
=>
$doResult
,
'result'
=>
'success'
);
}
if
(
$r
[
"code"
]
==
'crmdealupdate'
){
$doResult
=
BxRest
::
call
(
'event.unbind'
,[
'event'
=>
'ONCRMDEALUPDATE'
,
'handler'
=>
$this
->
config
[
"alovoice_host"
],
]);
return
array
(
'do'
=>
$doResult
,
'result'
=>
'success'
);
}
if
(
$r
[
"code"
]
==
'contactupdate'
){
$doResult
=
BxRest
::
call
(
'event.unbind'
,[
'event'
=>
'ONCRMCONTACTUPDATE'
,
'handler'
=>
$this
->
config
[
"alovoice_host"
],
]);
return
array
(
'do'
=>
$doResult
,
'result'
=>
'success'
);
}
if
(
$r
[
"code"
]
==
'leadupdateevent'
){
$doResult
=
BxRest
::
call
(
'event.unbind'
,[
'event'
=>
'ONCRMLEADUPDATE'
,
...
...
vendor/alovoice/src/BitrixEvents.php
View file @
ae1e736f
...
...
@@ -1298,6 +1298,30 @@ class BitrixEvents
public
function
oncrmdealupdate
()
{
ALVC
::
eLog
(
$this
->
bxData
,
"------ Events.php :: oncrm DEAL UPDATE:"
);
$dealId
=
$this
->
bxData
[
"FIELDS"
][
"ID"
];
$resDeal
=
BxRest
::
call
(
'crm.deal.get'
,
array
(
"id"
=>
$dealId
)
);
ALVC
::
eLog
(
$resDeal
,
"------ Events.php :: Deal GET Result: ----------"
);
if
(
!
empty
(
$resDeal
[
"result"
][
"ID"
])){
$arDeal
=
$resDeal
[
"result"
];
ALVC
::
eLog
(
$arDeal
[
"OPPORTUNITY"
],
"------ Events.php :: Deal GET Result: ----------"
);
if
(
empty
(
$arDeal
[
"OPPORTUNITY"
])
&&
!
empty
(
$arDeal
[
"UF_CRM_1609777763"
])){
$oprtnty
=
round
(
$arDeal
[
"OPPORTUNITY"
]);
$oprtntyTxt
=
ALVC
::
num2str
(
$oprtnty
);
$resDealSave
=
BxRest
::
call
(
'crm.deal.update'
,
array
(
"id"
=>
$dealId
,
"fields"
=>
[
"UF_CRM_1609777763"
=>
$oprtntyTxt
])
);
ALVC
::
eLog
(
$resDealSave
,
"------ Events.php :: Deal Update Oport TXT: "
.
$oprtntyTxt
);
}
if
(
!
empty
(
$arDeal
[
"OPPORTUNITY"
])){
//&& empty($arDeal["UF_CRM_1609777763"])
$oprtnty
=
round
(
$arDeal
[
"OPPORTUNITY"
]);
$oprtntyTxt
=
ALVC
::
num2str
(
$oprtnty
);
$resDealSave
=
BxRest
::
call
(
'crm.deal.update'
,
array
(
"id"
=>
$dealId
,
"fields"
=>
[
"UF_CRM_1609777763"
=>
$oprtntyTxt
])
);
ALVC
::
eLog
(
$resDealSave
,
"------ Events.php :: Deal Update Oport TXT: "
.
$oprtntyTxt
);
}
}
}
public
function
crm_deal_activity_timeline_menu__
()
{
// ALVC::eLog($this->bxData,"------ Events.php :: oncrm DEAL Activity MENU:");
...
...
@@ -1317,6 +1341,27 @@ class BitrixEvents
public
function
oncrmleadupdate
()
{
$leadID
=
$this
->
bxData
[
"FIELDS"
][
"ID"
];
$resLead
=
BxRest
::
call
(
'crm.lead.get'
,
array
(
"id"
=>
$leadID
)
);
// ALVC::eLog($resLead,"------ Events.php :: lead GET Result: ----------");
if
(
!
empty
(
$resLead
[
"result"
][
"ID"
])){
$arLead
=
$resLead
[
"result"
];
ALVC
::
eLog
(
$arLead
[
"OPPORTUNITY"
],
"------ Events.php :: lead GET Result: ----------"
);
if
(
!
empty
(
$arLead
[
"OPPORTUNITY"
])){
//&& empty($arLead["UF_CRM_1619575012878"])
$oprtnty
=
round
(
$arLead
[
"OPPORTUNITY"
]);
$oprtntyTxt
=
ALVC
::
num2str
(
$oprtnty
);
$resDealSave
=
BxRest
::
call
(
'crm.lead.update'
,
array
(
"id"
=>
$leadID
,
"fields"
=>
[
"UF_CRM_1619575012878"
=>
$oprtntyTxt
])
);
ALVC
::
eLog
(
$resDealSave
,
"------ Events.php :: lead Update Oport TXT: "
.
$oprtntyTxt
);
}
if
(
empty
(
$arLead
[
"OPPORTUNITY"
])
&&
!
empty
(
$arLead
[
"UF_CRM_1619575012878"
])){
$resDealSave
=
BxRest
::
call
(
'crm.lead.update'
,
array
(
"id"
=>
$leadID
,
"fields"
=>
[
"UF_CRM_1619575012878"
=>
""
])
);
}
}
// $resLead = BxRest::call( 'crm.lead.get', array("id"=>$leadID) );
// ALVC::eLog($resLead,"------ Events.php :: Deal GET Result: ----------");
...
...
@@ -1338,7 +1383,7 @@ class BitrixEvents
public
function
oncrmleadadd
()
{
$leadID
=
$this
->
bxData
[
"FIELDS"
][
"ID"
];
$resLead
=
BxRest
::
call
(
'crm.lead.get'
,
array
(
"id"
=>
$leadID
)
);
ALVC
::
eLog
(
$resLead
,
"------ Events.php :: Deal GET Result: ----------"
);
//
ALVC::eLog($resLead,"------ Events.php :: Deal GET Result: ----------");
if
(
!
empty
(
$resLead
[
"result"
][
"ID"
])){
$tgres
=
ALVC
::
checkTgContact
(
$resLead
[
"result"
]);
...
...
vendor/tg/src/ATelegram.php
View file @
ae1e736f
...
...
@@ -55,6 +55,7 @@ class ATelegram {
}
public
function
get_contact
(
$phone
){
return
false
;
$this
->
tLog
(
$phone
,
"-- get_contact BEGIn CONTACT SEARCH:"
);
if
(
(
empty
(
$this
->
TGM
))
||
(
empty
(
$this
->
tg_sender_default
))
){
$this
->
tLog
(
$phone
,
"-- get_contact NO Telegram Connect:"
);
...
...
@@ -118,6 +119,7 @@ class ATelegram {
}
public
function
contactsUpdate
(){
return
true
;
if
(
(
empty
(
$this
->
TGM
))
||
(
empty
(
$this
->
tg_sender_default
))
){
return
false
;
}
...
...
@@ -153,6 +155,7 @@ class ATelegram {
public
function
doTgMethod
(
$prms
){
return
true
;
/*if (!empty($prms['event']) && $prms['event'] == 'ONIMCONNECTORMESSAGEADD' && !empty($prms['data']['CONNECTOR']) && $prms['data']['CONNECTOR'] == $this->code && !empty($prms['data']['MESSAGES'])){
return $this->on_imconnectormessageadd($prms);
...
...
@@ -208,6 +211,7 @@ class ATelegram {
}
public
function
incom_tgmessage
(
$p
=
false
){
return
true
;
$this
->
tLog
(
"-------------------==ATG incom_tgmessage ==----------------"
);
/*
$action = [
...
...
@@ -467,24 +471,15 @@ class ATelegram {
}
}
}
/*
{id: "$01000000182773071d3a41e62f1c9b0b", peer_type: "user", peer_id: 124987160,…}
first_name: "КУЛДАШ Шухратович"
flags: 196609
id: "$01000000182773071d3a41e62f1c9b0b"
last_name: "НАВРУЗОВ"
peer_id: 124987160
peer_type: "user"
phone: "998977076909"
print_name: "КУЛДАШ_Шухратович_НАВРУЗОВ"
username: "kuldash"
when: "2021-02-02 01:35:54"
*/
public
function
get_contact_bynumber
(
$r
){
return
true
;
return
$this
->
get_contact_info
(
$r
[
"number"
]);
}
public
function
get_contact_info
(
$number
){
return
true
;
$this
->
tLog
(
$number
,
"--== TGM Begin GEtting Contact Info Contact: "
);
if
(
empty
(
$this
->
TGM
)){
return
''
;
}
$jsContacts
=
$this
->
TGM
->
getContactList
();
...
...
@@ -555,7 +550,7 @@ when: "2021-02-02 01:35:54"
}*/
public
function
set_tg_sender_default
(
$sender
=
false
){
return
true
;
$sender
=
(
!
empty
(
$sender
))
?
preg_replace
(
"/[^0-9]/"
,
''
,
$sender
)
:
false
;
if
(
is_numeric
(
$sender
)){
...
...
@@ -589,6 +584,8 @@ when: "2021-02-02 01:35:54"
}
public
function
send_telegram_file
(
$p
){
return
true
;
if
(
!
empty
(
$p
[
"from_number"
])){
$this
->
set_tg_sender_default
(
$p
[
"from_number"
]);
}
$telegram
=
$this
->
TGM
;
$this
->
tLog
(
"aTG: --=== Begin Sending TG Files... : ["
.
json_encode
(
$p
)
.
"]"
);
...
...
@@ -608,6 +605,7 @@ when: "2021-02-02 01:35:54"
}
public
function
send_telegram_photo
(
$p
){
return
true
;
/* PARAMS
- tonumber
- path
...
...
@@ -642,6 +640,7 @@ when: "2021-02-02 01:35:54"
}
public
function
send_telegram_msg
(
$p
){
return
true
;
/* PARAMS
- tonumber (or toid)
- message
...
...
@@ -685,6 +684,7 @@ when: "2021-02-02 01:35:54"
public
function
delete_telegram_account
(
$params
){
return
true
;
if
(
!
empty
(
$params
[
"TGNUMBER"
])){
$tgNumber
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGNUMBER"
]);
}
if
(
!
empty
(
$tgNumber
)){
$this
->
stop_profile_by_number
(
$tgNumber
);
...
...
@@ -709,6 +709,7 @@ when: "2021-02-02 01:35:54"
}
public
function
get_telegram_account_status
(
$params
){
return
true
;
if
(
!
empty
(
$params
[
"TGNUMBER"
])){
$tgNumber
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGNUMBER"
]);
}
else
{
return
'Not set Profile'
;
}
$profd
=
"prf_"
.
$tgNumber
;
$arProfile
=
$this
->
get_tg_account_self
(
$profd
);
...
...
@@ -722,6 +723,7 @@ when: "2021-02-02 01:35:54"
}
public
function
get_telegram_accounts
(){
return
true
;
$tg_profiles_dir
=
$this
->
tgdir
.
"/profiles/"
;
$tg_socks_dir
=
$this
->
tgdir
.
"/socks/"
;
...
...
@@ -767,6 +769,7 @@ when: "2021-02-02 01:35:54"
}
public
function
register_account_confcode
(
$params
){
return
true
;
if
(
!
empty
(
$params
[
"TGNUMBER"
])){
$tgNumber
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGNUMBER"
]);
}
if
(
!
empty
(
$params
[
"TGCONFCODE"
])){
$tgNumberConfCode
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGCONFCODE"
]);
}
if
(
!
empty
(
$tgNumber
)){
...
...
@@ -780,6 +783,7 @@ when: "2021-02-02 01:35:54"
}
public
function
stop_profile_by_number
(
$params
){
return
true
;
if
(
!
empty
(
$params
[
"TGNUMBER"
])){
$tgNumber
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGNUMBER"
]);
}
if
(
empty
(
$tgNumber
)){
return
array
(
"error"
=>
'No or bad Number'
);
...
...
@@ -832,6 +836,7 @@ when: "2021-02-02 01:35:54"
}
public
function
get_contacts_list_old
(
$params
){
return
true
;
if
(
empty
(
$this
->
currentProfile
)){
$this
->
currentProfile
=
"998946712860"
;
}
$telegram
=
new
\Zyberspace\Telegram\Cli\Client
(
'unix://'
.
$this
->
tgsocks_dir
.
'prf_'
.
$this
->
currentProfile
.
'.sck'
);
...
...
@@ -862,7 +867,7 @@ when: "2021-02-02 01:35:54"
}
public
function
async_run_profile_by_number
(
$tgNumber
){
return
true
;
if
(
empty
(
$tgNumber
)){
return
array
(
"error"
=>
'No or bad Numbers'
);
}
...
...
@@ -900,6 +905,7 @@ when: "2021-02-02 01:35:54"
public
function
register_account
(
$params
){
return
true
;
$this
->
tLog
(
"aTG: register_account: "
.
json_encode
(
$params
));
if
(
!
empty
(
$params
[
"TGNUMBER"
])){
$tgNumber
=
preg_replace
(
"/[^0-9]/"
,
''
,
$params
[
"TGNUMBER"
]);
}
$this
->
delete_telegram_account
([
"TGNUMBER"
=>
$tgNumber
]);
...
...
@@ -917,6 +923,7 @@ when: "2021-02-02 01:35:54"
}
public
function
getTelegramSmsSettingsPage
()
{
return
true
;
global
$APPLICATION
;
$arAccountsList
=
$this
->
get_telegram_accounts
();
//var_dump($arAccountsList);
...
...
@@ -978,6 +985,7 @@ when: "2021-02-02 01:35:54"
/*----------------------------INCOM----------------------------------------------*/
public
function
handleIncomingMessages
(
$params
){
return
true
;
$this
->
tLog
(
"aTG: handleIncomingMessages: |"
.
$params
.
"|"
);
//{"to":{"last_name":"*","peer_type":"user","id":"$010000007e53ac3d557f36881c3521f6","flags":524291,"access_hash":1,"username":"texnomartstar","peer_id":1034703742,"print_name":"Texnomart_*","phone":"998946712860","first_name":"Texnomart"},"date":1576750169,"unread":true,"flags":257,"out":false,"text":"123123","service":false,"from":{"last_name":"Nava","peer_type":"user","id":"$010000001827730723b8ffcdc773a34c","flags":196609,"access_hash":1,"username":"kuldash","peer_id":124987160,"print_name":"kulya_Nava","phone":"998977076909","first_name":"kulya"},"id":"0100000018277307080000000000000023b8ffcdc773a34c"}
$arDefIncomUsersIds
=
array
(
1
,
9
);
...
...
@@ -1030,6 +1038,7 @@ when: "2021-02-02 01:35:54"
/*---------------------------- CONTACT -- INFO --------------------------------------------*/
public
function
getcontactinfo
(
$params
){
return
true
;
$telegram
=
new
\Zyberspace\Telegram\Cli\Client
(
$tgSocket
);
$resAns
=
''
;
$number
=
preg_replace
(
"/[^0-9]/"
,
''
,
$_REQUEST
[
"getcontactinfo"
])
;
...
...
@@ -1192,6 +1201,7 @@ when: "2021-02-02 01:35:54"
public
function
telegram_activity_add
(
$params
,
$dir
=
\CCrmActivityDirection
::
Outgoing
)
{
return
true
;
$this
->
tLog
(
"aTG: PRED Add Activity IN PARAMS: ["
.
json_encode
(
$params
)
.
"]"
);
\Bitrix\Main\Loader
::
includeModule
(
'crm'
);
$arCrmEntTypes
=
array
(
...
...
@@ -1240,6 +1250,7 @@ when: "2021-02-02 01:35:54"
}
}
public
function
echo_sleep
(
$sec
,
$msg
=
false
,
$newline
=
false
)
{
return
true
;
global
$echo_sleep_prev_msg_gb
;
// Preeventing to show the same msg.
if
(
$echo_sleep_prev_msg_gb
!==
$msg
)
{
if
(
$msg
)
$this
->
tLog
(
$msg
);
...
...
@@ -1251,7 +1262,7 @@ when: "2021-02-02 01:35:54"
}
public
function
check_and_register_tg
(
$tgnumber
)
{
return
true
;
$this
->
tLog
(
"Alo TG Reginster begin number: "
.
$tgnumber
);
$this
->
echo_sleep
(
1
,
"Loading config"
,
true
);
...
...
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