Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
0e998885
Commit
0e998885
authored
Sep 14, 2021
by
卢洪光
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature_jielong_native' into 'pre_release'
Feature jielong native See merge request bp/goods!56
parents
b0f541db
bd87fc3e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
84 additions
and
0 deletions
+84
-0
KafkaService.php
application/services/common/KafkaService.php
+35
-0
MarketingService.php
application/services/marketing/MarketingService.php
+49
-0
No files found.
application/services/common/KafkaService.php
0 → 100644
View file @
0e998885
<?php
namespace
App\Services\common
;
use
Api\PhpUtils\Kafka\KafkaUtil
;
use
Api\PhpUtils\Log\FileLog
;
class
KafkaService
{
/**
* marketing 广播
*/
public
static
function
productMarketingUpdate
(
array
$marketingInfo
)
:
void
{
$msg
=
json_encode
([
'marketingInfo'
=>
$marketingInfo
,
'time'
=>
time
(),
],
JSON_FORCE_OBJECT
);
$serverName
=
'goods.publish'
;
$kafka
=
KafkaUtil
::
getInstance
(
$serverName
);
if
(
$kafka
->
produce
(
$msg
,
$marketingInfo
[
'activityId'
]))
{
FileLog
::
info
(
sprintf
(
'kafka produce success serverName %s msg = %s'
,
$serverName
,
$msg
));
}
else
{
FileLog
::
error
(
sprintf
(
'kafka produce failure serverName %s msg = %s'
,
$serverName
,
$msg
));
}
}
}
\ No newline at end of file
application/services/marketing/MarketingService.php
View file @
0e998885
...
...
@@ -6,6 +6,7 @@ namespace App\Services\marketing;
use
Api\PhpServices\Ksy\Ks3Api
;
use
Api\PhpUtils\Http\Request
;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Exception\BaseException
;
use
App\Exception\custom\InterfaceException
;
use
App\Models\goods\mysql\Ota
;
use
App\Models\goods\mysql\PindanGoodsSku
;
...
...
@@ -19,6 +20,7 @@ use App\Models\marketing\mysql\MarketingPindan;
use
App\Models\marketing\mysql\MarketingTakePlace
;
use
App\Models\marketing\mysql\TakePlace
;
use
App\Services\common\CommonService
;
use
App\Services\common\KafkaService
;
use
App\Services\goods\GoodsService
;
use
Daemon\Goods
;
use
App\Exception\custom\GoodsException
;
...
...
@@ -740,6 +742,19 @@ class MarketingService
throw
new
MarketingException
([
"cus"
=>
5
]);
}
$picList
=
GoodsService
::
getUrlList
(
$pindanPic
);
KafkaService
::
productMarketingUpdate
([
'activityId'
=>
$marketingId
,
'startDate'
=>
$startTime
,
'endDate'
=>
$endTime
,
'userId'
=>
$lifeAccountId
,
'activityName'
=>
$marketingName
,
'text'
=>
$pindanDesc
,
'imageId'
=>
$picList
[
0
]
??
''
,
'createTime'
=>
date
(
'Y-m-d H:i:s'
),
'onlineStatus'
=>
Marketing
::
ONLINE_STATUS_QIDONG
,
]);
return
$pindanId
;
}
...
...
@@ -895,6 +910,20 @@ class MarketingService
throw
new
MarketingException
([
"cus"
=>
5
]);
}
$picList
=
GoodsService
::
getUrlList
(
$marketingPindan
[
'pindan_pic'
]);
KafkaService
::
productMarketingUpdate
([
'activityId'
=>
$marketingId
,
'startDate'
=>
$startTime
,
'endDate'
=>
$endTime
,
'userId'
=>
config
(
'lifeaccount'
,
'life_account_id'
),
'activityName'
=>
$marketingName
,
'text'
=>
$pindanDesc
,
'imageId'
=>
$picList
[
0
]
??
''
,
'createTime'
=>
$marketing
[
'create_time'
],
'onlineStatus'
=>
Marketing
::
ONLINE_STATUS_QIDONG
,
]);
return
true
;
}
...
...
@@ -921,6 +950,26 @@ class MarketingService
'online_status'
=>
$onlineStatus
,
'end_time'
=>
$endTime
,
];
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
$marketing
=
Marketing
::
getRecord
([
"marketing_id"
=>
$marketingId
]);
$marketingPindan
=
MarketingPindan
::
getRecord
([
"marketing_id"
=>
$marketingId
]);
$picList
=
GoodsService
::
getUrlList
(
$marketingPindan
[
'pindan_pic'
]);
KafkaService
::
productMarketingUpdate
([
'activityId'
=>
$marketingId
,
'startDate'
=>
$marketing
[
'start_time'
],
'endDate'
=>
$endTime
,
'userId'
=>
config
(
'lifeaccount'
,
'life_account_id'
),
'activityName'
=>
$marketing
[
'marketing_name'
],
'text'
=>
$marketingPindan
[
'pindan_desc'
],
'imageId'
=>
$picList
[
0
]
??
''
,
'createTime'
=>
$marketing
[
'create_time'
],
'onlineStatus'
=>
$onlineStatus
,
]);
}
Marketing
::
updateRecord
(
$marketingParams
,
[
"marketing_id"
=>
$marketingId
,
"marketing_type"
=>
$marketingType
]);
}
...
...
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