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
4664d311
Commit
4664d311
authored
Aug 24, 2021
by
pengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 团长分销活动
parent
5c8c000b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
12 deletions
+38
-12
ColonelDistributorColonel.php
...tion/models/marketing/mysql/ColonelDistributorColonel.php
+2
-0
TakePlace.php
application/models/marketing/mysql/TakePlace.php
+11
-0
ColonelService.php
application/services/marketing/ColonelService.php
+23
-10
TakePlaceService.php
application/services/marketing/TakePlaceService.php
+2
-2
No files found.
application/models/marketing/mysql/ColonelDistributorColonel.php
View file @
4664d311
...
...
@@ -14,6 +14,8 @@ class ColonelDistributorColonel extends MysqlBase
const
TABLE_NAME
=
'colonel_distributor_colonel'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'colonel_id'
;
const
COLONEL_SOURCE_APPLY
=
1
;
//用户申请
const
COLONEL_SOURCE_ADMIN
=
2
;
//运营添加
public
static
function
insertRecord
(
array
$column
)
:
int
{
...
...
application/models/marketing/mysql/TakePlace.php
View file @
4664d311
...
...
@@ -49,4 +49,15 @@ class TakePlace extends MysqlBase
return
$res
;
}
public
static
function
getRecord
(
array
$where
,
$column
=
'*'
)
{
return
self
::
get
(
$column
,
$where
);
}
public
static
function
existTakePlaceName
(
string
$takePlaceName
)
:
bool
{
$exist
=
self
::
getRecord
([
'take_place_name'
=>
$takePlaceName
],
[
'take_place_id'
]);
return
!
empty
(
$exist
);
}
}
application/services/marketing/ColonelService.php
View file @
4664d311
...
...
@@ -10,6 +10,7 @@ namespace App\Services\marketing;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\ColonelDistributorColonel
;
use
App\Models\marketing\mysql\ColonelDistributorColonelApply
;
use
App\Models\marketing\mysql\TakePlace
;
use
App\Models\user\mysql\UserWechatBind
;
use
Exception
;
...
...
@@ -30,6 +31,7 @@ class ColonelService
}
$colonelData
=
[
'user_id'
=>
$params
[
'user_id'
],
'life_account_id'
=>
MarketingService
::
getPublicLifeAccountId
(),
'phone'
=>
$params
[
'phone'
],
'contact_name'
=>
$params
[
'contact_name'
],
'take_place_name'
=>
$params
[
'take_place_name'
],
...
...
@@ -86,13 +88,17 @@ class ColonelService
*/
public
static
function
handleManageAudit
(
int
$applyId
,
int
$auditStatus
)
:
bool
{
// 审核状态参数检测
if
(
!
in_array
(
$auditStatus
,
[
ColonelDistributorColonelApply
::
STATUS_PASS
,
ColonelDistributorColonelApply
::
STATUS_REJECT
]))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
}
// 审核状态数据检测
$applyInfo
=
ColonelDistributorColonelApply
::
getRecord
([
'colonel_apply_id'
=>
$applyId
]);
if
(
empty
(
$applyInfo
)
||
$applyInfo
[
'audit_status'
]
!=
ColonelDistributorColonelApply
::
STATUS_AUDIT
)
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
}
// 为了兼容 TakePlaceService:add 方法
$applyInfo
[
'name'
]
=
$applyInfo
[
'take_place_name'
];
try
{
ColonelDistributorColonelApply
::
beginTransaction
();
// 修改申请状态
...
...
@@ -100,7 +106,7 @@ class ColonelService
if
(
empty
(
$updateStatus
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
}
// 审核成功
,入库团长表
// 审核成功
if
(
$auditStatus
==
ColonelDistributorColonelApply
::
STATUS_PASS
)
{
if
(
!
self
::
handleAuditSuccess
((
array
)
$applyInfo
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
...
...
@@ -116,25 +122,32 @@ class ColonelService
/**
* Notes: 团长审核成功
* User: pengfei@yidian-inc.com
* Date: 2021/8/2
3 1:52 下
午
* Date: 2021/8/2
4 11:24 上
午
* @param array $applyInfo
* @return int
* @throws MarketingException
*/
private
static
function
handleAuditSuccess
(
array
$applyInfo
)
:
int
{
// 入库自提点
if
(
!
empty
(
$applyInfo
[
'take_place_name'
])
&&
!
empty
(
$applyInfo
[
'longitude'
])
&&
!
empty
(
$applyInfo
[
'location'
]))
{
// 自提点名称检测
if
(
!
$takePlaceId
=
TakePlace
::
existTakePlaceName
(
$applyInfo
[
'take_place_name'
]))
{
if
(
!
$takePlaceId
=
TakePlaceService
::
add
(
$applyInfo
))
{
return
false
;
}
}
}
// 入库团长表
$colonelData
=
[
'user_id'
=>
$applyInfo
[
'user_id'
],
'colonel_apply_id'
=>
$applyInfo
[
'colonel_apply_id'
],
'take_place_id'
=>
$takePlaceId
??
''
,
'life_account_id'
=>
$applyInfo
[
'life_account_id'
],
'phone'
=>
$applyInfo
[
'phone'
],
'contact_name'
=>
$applyInfo
[
'contact_name'
],
'take_place_pic'
=>
$applyInfo
[
'take_place_pic'
],
'longitude'
=>
$applyInfo
[
'longitude'
],
'latitude'
=>
$applyInfo
[
'latitude'
],
'location'
=>
$applyInfo
[
'location'
],
'address'
=>
$applyInfo
[
'address'
],
'province'
=>
$applyInfo
[
'province'
],
'city'
=>
$applyInfo
[
'city'
],
'area'
=>
$applyInfo
[
'area'
]
'colonel_distributor_code'
=>
''
,
//TODO 生成活动码
'colonel_source'
=>
ColonelDistributorColonel
::
COLONEL_SOURCE_APPLY
];
return
ColonelDistributorColonel
::
insertRecord
(
$colonelData
);
}
...
...
application/services/marketing/TakePlaceService.php
View file @
4664d311
...
...
@@ -54,7 +54,8 @@ class TakePlaceService
public
static
function
add
(
$params
)
{
//验证life_account_id
if
(
isset
(
$params
[
'life_account_id'
]))
{
$lifeAccountId
=
MarketingService
::
getPublicLifeAccountId
();
if
(
isset
(
$params
[
'life_account_id'
])
&&
$params
[
'life_account_id'
]
!=
$lifeAccountId
)
{
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_life_account_by_id'
);
$lifeAccountRes
=
(
new
Request
())
->
get
(
$url
,
[
"life_account_id"
=>
$params
[
"life_account_id"
]]);
...
...
@@ -63,7 +64,6 @@ class TakePlaceService
}
}
$lifeAccountId
=
MarketingService
::
getPublicLifeAccountId
();
$data
[
'life_account_id'
]
=
$params
[
'life_account_id'
]
??
$lifeAccountId
;
$data
[
'take_place_name'
]
=
$params
[
'name'
];
$data
[
'longitude'
]
=
$params
[
'longitude'
];
...
...
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