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
0cec99db
Commit
0cec99db
authored
Aug 24, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
update: 处理冲突
parents
cb8b641f
b603b9b2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
214 additions
and
20 deletions
+214
-20
MarketingException.php
application/exception/custom/MarketingException.php
+8
-0
ColonelAddPoint.php
application/library/Validate/ColonelAddPoint.php
+39
-0
ColonelApplyValidate.php
application/library/Validate/ColonelApplyValidate.php
+2
-2
ColonelDistributorColonel.php
...tion/models/marketing/mysql/ColonelDistributorColonel.php
+35
-0
Colonel.php
application/modules/Marketing/controllers/Colonel.php
+41
-3
ColonelService.php
application/services/marketing/ColonelService.php
+89
-15
No files found.
application/exception/custom/MarketingException.php
View file @
0cec99db
...
@@ -19,6 +19,10 @@ class MarketingException extends BaseException
...
@@ -19,6 +19,10 @@ class MarketingException extends BaseException
const
COLONEL_AUDIT_STATUS
=
27
;
const
COLONEL_AUDIT_STATUS
=
27
;
const
COLONEL_AUDIT_STATUS_FAILED
=
28
;
const
COLONEL_AUDIT_STATUS_FAILED
=
28
;
const
COMMIT_ERROR
=
29
;
const
COMMIT_ERROR
=
29
;
const
COLONEL_TAKE_PLACE_EXIST
=
30
;
const
COLONEL_TAKE_PLACE_PARAMS
=
31
;
const
COLONEL_TAKE_PLACE_FAILED
=
32
;
protected
$cus
=
[
protected
$cus
=
[
0
=>
'活动名称不能为空'
,
0
=>
'活动名称不能为空'
,
...
@@ -51,5 +55,9 @@ class MarketingException extends BaseException
...
@@ -51,5 +55,9 @@ class MarketingException extends BaseException
self
::
COLONEL_AUDIT_STATUS
=>
'团长审核状态错误'
,
self
::
COLONEL_AUDIT_STATUS
=>
'团长审核状态错误'
,
self
::
COLONEL_AUDIT_STATUS_FAILED
=>
'团长审核失败'
,
self
::
COLONEL_AUDIT_STATUS_FAILED
=>
'团长审核失败'
,
self
::
COMMIT_ERROR
=>
'事务commit失败'
,
self
::
COMMIT_ERROR
=>
'事务commit失败'
,
self
::
COLONEL_TAKE_PLACE_EXIST
=>
'自提点名称已存在'
,
self
::
COLONEL_TAKE_PLACE_PARAMS
=>
'自提点信息不存在'
,
self
::
COLONEL_TAKE_PLACE_FAILED
=>
'自提点添加失败'
,
];
];
}
}
application/library/Validate/ColonelAddPoint.php
0 → 100644
View file @
0cec99db
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 1:32 下午
*/
namespace
Validate
;
class
ColonelAddPoint
extends
BaseValidate
{
protected
$rule
=
[
'colonel_apply_id'
=>
'require'
,
'longitude'
=>
'require'
,
'latitude'
=>
'require'
,
'location'
=>
'require'
,
'address'
=>
'require'
,
'province'
=>
'require'
,
'city'
=>
'require'
,
'area'
=>
'require'
,
'contact_name'
=>
'require'
,
'phone'
=>
'isMobile'
,
'take_place_name'
=>
'require'
,
];
protected
$message
=
[
'colonel_apply_id'
=>
'申请id不能为空'
,
'longitude'
=>
'位置经度不能为空'
,
'latitude'
=>
'位置纬度不能为空'
,
'location'
=>
'自提点地址不能为空'
,
'address'
=>
'详细地址不能为空'
,
'province'
=>
'省份不能为空'
,
'city'
=>
'城市不能为空'
,
'area'
=>
'地区不能为空'
,
'contact_name'
=>
'联系人不能为空'
,
'phone'
=>
'请输入正确的手机号'
,
'take_place_name'
=>
'自提点名称不能为空'
,
];
}
application/library/Validate/ColonelApplyValidate.php
View file @
0cec99db
...
@@ -16,8 +16,8 @@ class ColonelApplyValidate extends BaseValidate
...
@@ -16,8 +16,8 @@ class ColonelApplyValidate extends BaseValidate
];
];
protected
$message
=
[
protected
$message
=
[
'user_id'
=>
'用户id不能为空'
,
'phone'
=>
'请输入正确的手机号'
,
'phone'
=>
'请输入正确的手机号'
,
'contact_name'
=>
'联系人不能为空'
'contact_name'
=>
'联系人不能为空'
];
];
}
}
\ No newline at end of file
application/models/marketing/mysql/ColonelDistributorColonel.php
View file @
0cec99db
...
@@ -17,9 +17,44 @@ class ColonelDistributorColonel extends MysqlBase
...
@@ -17,9 +17,44 @@ class ColonelDistributorColonel extends MysqlBase
const
COLONEL_SOURCE_APPLY
=
1
;
//用户申请
const
COLONEL_SOURCE_APPLY
=
1
;
//用户申请
const
COLONEL_SOURCE_ADMIN
=
2
;
//运营添加
const
COLONEL_SOURCE_ADMIN
=
2
;
//运营添加
const
DEFAULT_COLUMN
=
[
'colonel_id'
,
'user_id'
,
'take_place_id'
,
'phone'
,
'contact_name'
,
'colonel_distributor_code'
,
'colonel_source'
];
public
static
function
getRecord
(
array
$where
,
$column
=
'*'
)
{
return
self
::
get
(
$column
,
$where
);
}
public
static
function
updateRecord
(
array
$columns
,
array
$where
)
{
return
self
::
update
(
$columns
,
$where
);
}
public
static
function
insertRecord
(
array
$column
)
:
int
public
static
function
insertRecord
(
array
$column
)
:
int
{
{
$id
=
self
::
insert
(
$column
);
$id
=
self
::
insert
(
$column
);
return
intval
(
$id
);
return
intval
(
$id
);
}
}
public
static
function
getPages
(
array
$where
=
[],
$column
=
'*'
,
int
$page
,
int
$pageSize
,
array
$orderBy
=
[
'colonel_apply_id'
=>
'DESC'
])
{
if
(
empty
(
$column
))
{
$column
=
self
::
DEFAULT_COLUMN
;
}
$data
=
$where
;
$count
=
self
::
count
([],
$where
);
if
(
empty
(
$count
))
{
return
[
'list'
=>
[],
'count'
=>
0
];
}
if
(
!
empty
(
$page
)
&&
!
empty
(
$pageSize
))
{
$offset
=
(
$page
-
1
)
*
$pageSize
;
$data
[
'LIMIT'
]
=
[
$offset
,
$pageSize
];
}
if
(
!
empty
(
$orderBy
))
{
$data
[
'ORDER'
]
=
$orderBy
;
}
$result
=
self
::
select
(
$column
,
$data
);
return
[
'result'
=>
$result
,
'count'
=>
$count
];
}
}
}
application/modules/Marketing/controllers/Colonel.php
View file @
0cec99db
...
@@ -10,6 +10,7 @@ use App\Services\marketing\ColonelService;
...
@@ -10,6 +10,7 @@ use App\Services\marketing\ColonelService;
use
\Validate\ColonelApplyValidate
;
use
\Validate\ColonelApplyValidate
;
use
\Validate\ColonelConfigValidate
;
use
\Validate\ColonelConfigValidate
;
use
\Validate\ColonelAuditValidate
;
use
\Validate\ColonelAuditValidate
;
use
\Validate\ColonelAddPoint
;
use
\App\Services\marketing\PindanActivityColonelConfigService
;
use
\App\Services\marketing\PindanActivityColonelConfigService
;
use
\App\Services\marketing\PindanActivityInviteOrderService
;
use
\App\Services\marketing\PindanActivityInviteOrderService
;
...
@@ -62,9 +63,20 @@ class ColonelController extends Base
...
@@ -62,9 +63,20 @@ class ColonelController extends Base
* Notes: 管理后台 - 申请团长审核列表
* Notes: 管理后台 - 申请团长审核列表
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
* Date: 2021/8/23 2:17 下午
* Date: 2021/8/23 2:17 下午
* @throws Exception
*/
*/
public
function
manage_listAction
()
public
function
manage_colonel_apply_listAction
()
{
$params
=
$this
->
params
;
$manageList
=
ColonelService
::
getManageApplyList
(
$params
);
return
$this
->
success
(
$manageList
);
}
/**
* Notes: 管理后台 - 团长审核列表
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:09 下午
*/
public
function
manage_colonel_listAction
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
$manageList
=
ColonelService
::
getManageList
(
$params
);
$manageList
=
ColonelService
::
getManageList
(
$params
);
...
@@ -85,6 +97,32 @@ class ColonelController extends Base
...
@@ -85,6 +97,32 @@ class ColonelController extends Base
return
$this
->
success
();
return
$this
->
success
();
}
}
/**
* Notes: 管理后台 - 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:43 下午
*/
public
function
manage_show_apply_pointAction
()
{
$params
=
$this
->
params
;
$colonelApply
=
ColonelService
::
getTakePlaceInfo
(
$params
[
'colonel_apply_id'
]);
return
$this
->
success
([
'result'
=>
$colonelApply
]);
}
/**
* Notes: 管理后台 - 添加自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:44 下午
* @throws \App\Exception\custom\MarketingException
*/
public
function
manage_add_apply_pointAction
()
{
$params
=
$this
->
params
;
(
new
ColonelAddPoint
())
->
validate
();
ColonelService
::
handleAddTaskPlace
(
$params
);
return
$this
->
success
();
}
/**
/**
* 团长分销下单处理统计数据逻辑
* 团长分销下单处理统计数据逻辑
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\MarketingException
...
@@ -117,4 +155,4 @@ class ColonelController extends Base
...
@@ -117,4 +155,4 @@ class ColonelController extends Base
$data
=
PindanActivityColonelConfigService
::
getTaskData
(
$params
);
$data
=
PindanActivityColonelConfigService
::
getTaskData
(
$params
);
return
$this
->
success
([
"result"
=>
$data
]);
return
$this
->
success
([
"result"
=>
$data
]);
}
}
}
}
\ No newline at end of file
application/services/marketing/ColonelService.php
View file @
0cec99db
...
@@ -62,7 +62,7 @@ class ColonelService
...
@@ -62,7 +62,7 @@ class ColonelService
* @param array $params
* @param array $params
* @return array
* @return array
*/
*/
public
static
function
getManageList
(
array
$params
)
:
array
public
static
function
getManage
Apply
List
(
array
$params
)
:
array
{
{
$params
=
self
::
getPageParams
(
$params
);
$params
=
self
::
getPageParams
(
$params
);
$result
=
ColonelDistributorColonelApply
::
getPages
([],
ColonelDistributorColonelApply
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
$result
=
ColonelDistributorColonelApply
::
getPages
([],
ColonelDistributorColonelApply
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
...
@@ -77,6 +77,30 @@ class ColonelService
...
@@ -77,6 +77,30 @@ class ColonelService
return
$result
;
return
$result
;
}
}
/**
* Notes: 团长列表-后台管理
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 3:04 下午
* @param array $params
* @return array
*/
public
static
function
getManageList
(
array
$params
)
:
array
{
$params
=
self
::
getPageParams
(
$params
);
$result
=
ColonelDistributorColonel
::
getPages
([],
ColonelDistributorColonel
::
DEFAULT_COLUMN
,
$params
[
'page'
],
$params
[
'page_size'
]);
if
(
empty
(
$result
[
'count'
]))
{
return
$result
;
}
$userMap
=
self
::
getUserMap
(
array_column
(
$result
[
'result'
],
'user_id'
));
foreach
(
$result
[
'result'
]
as
&
$applyVal
)
{
$applyVal
[
'user_avatar'
]
=
!
empty
(
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
])
?
$userMap
[
$applyVal
[
'user_id'
]][
'user_avatar'
]
:
''
;
// TODO 昨日收益 总收益
}
unset
(
$applyVal
);
return
$result
;
}
/**
/**
* Notes: 团长申请审核
* Notes: 团长申请审核
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
...
@@ -97,8 +121,6 @@ class ColonelService
...
@@ -97,8 +121,6 @@ class ColonelService
if
(
empty
(
$applyInfo
)
||
$applyInfo
[
'audit_status'
]
!=
ColonelDistributorColonelApply
::
STATUS_AUDIT
)
{
if
(
empty
(
$applyInfo
)
||
$applyInfo
[
'audit_status'
]
!=
ColonelDistributorColonelApply
::
STATUS_AUDIT
)
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS
);
}
}
// 为了兼容 TakePlaceService:add 方法
$applyInfo
[
'name'
]
=
$applyInfo
[
'take_place_name'
];
try
{
try
{
ColonelDistributorColonelApply
::
beginTransaction
();
ColonelDistributorColonelApply
::
beginTransaction
();
// 修改申请状态
// 修改申请状态
...
@@ -112,37 +134,89 @@ class ColonelService
...
@@ -112,37 +134,89 @@ class ColonelService
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
}
}
}
}
return
ColonelDistributorColonelApply
::
commit
();
if
(
!
ColonelDistributorColonelApply
::
commit
())
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
}
return
true
;
}
catch
(
MarketingException
$e
)
{
}
catch
(
MarketingException
$e
)
{
ColonelDistributorColonelApply
::
rollback
();
ColonelDistributorColonelApply
::
rollback
();
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_AUDIT_STATUS_FAILED
);
}
}
}
}
/**
* Notes: 获取自提点信息
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:40 下午
* @param int $applyId
* @return array
*/
public
static
function
getTakePlaceInfo
(
int
$applyId
)
:
array
{
$where
=
[
'colonel_apply_id'
=>
$applyId
];
$colonelApply
=
ColonelDistributorColonelApply
::
getRecord
(
$where
);
return
(
array
)
$colonelApply
;
}
/**
* Notes: 添加自提点
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 2:41 下午
* @param array $params
* @return int
* @throws MarketingException
*/
public
static
function
handleAddTaskPlace
(
array
$params
)
:
int
{
// 自提点名称检测
if
(
TakePlace
::
existTakePlaceName
(
$params
[
'take_place_name'
]))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_EXIST
);
}
$where
=
[
'colonel_apply_id'
=>
$params
[
'colonel_apply_id'
]
];
// 自提点信息检测
if
(
!
$colonelApply
=
ColonelDistributorColonelApply
::
getRecord
(
$where
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_PARAMS
);
}
$params
[
'life_account_id'
]
=
$colonelApply
[
'life_account_id'
];
$params
[
'name'
]
=
$params
[
'take_place_name'
];
try
{
ColonelDistributorColonel
::
beginTransaction
();
// 添加自提点
if
(
!
$takePlaceId
=
TakePlaceService
::
add
(
$params
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_FAILED
);
}
// 修改自提点id
if
(
!
ColonelDistributorColonel
::
updateRecord
([
'take_place_id'
=>
$takePlaceId
],
$where
))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_FAILED
);
}
if
(
!
ColonelDistributorColonel
::
commit
())
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_FAILED
);
}
return
(
int
)
$takePlaceId
;
}
catch
(
MarketingException
$e
)
{
ColonelDistributorColonel
::
rollback
();
throw
new
MarketingException
(
MarketingException
::
COLONEL_TAKE_PLACE_FAILED
);
}
}
/**
/**
* Notes: 团长审核成功
* Notes: 团长审核成功
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
* Date: 2021/8/24 11:24 上午
* Date: 2021/8/24 11:24 上午
* @param array $applyInfo
* @param array $applyInfo
* @return int
* @return int
* @throws MarketingException
*/
*/
private
static
function
handleAuditSuccess
(
array
$applyInfo
)
:
int
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
=
[
$colonelData
=
[
'user_id'
=>
$applyInfo
[
'user_id'
],
'user_id'
=>
$applyInfo
[
'user_id'
],
'colonel_apply_id'
=>
$applyInfo
[
'colonel_apply_id'
],
'colonel_apply_id'
=>
$applyInfo
[
'colonel_apply_id'
],
'take_place_id'
=>
$takePlaceId
??
''
,
'take_place_id'
=>
0
,
'life_account_id'
=>
$applyInfo
[
'life_account_id'
],
'life_account_id'
=>
$applyInfo
[
'life_account_id'
],
'phone'
=>
$applyInfo
[
'phone'
],
'phone'
=>
$applyInfo
[
'phone'
],
'contact_name'
=>
$applyInfo
[
'contact_name'
],
'contact_name'
=>
$applyInfo
[
'contact_name'
],
...
...
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