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
460c0b41
Commit
460c0b41
authored
Aug 20, 2021
by
pengfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add 增加拼单申请团长接口
parent
e7c5b626
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
122 additions
and
0 deletions
+122
-0
ColonelApplyValidate.php
application/library/Validate/ColonelApplyValidate.php
+22
-0
PindanActivityColonelApply.php
...ion/models/marketing/mysql/PindanActivityColonelApply.php
+23
-0
Colonel.php
application/modules/Marketing/controllers/Colonel.php
+30
-0
ColonelService.php
application/services/marketing/ColonelService.php
+47
-0
No files found.
application/library/Validate/ColonelApplyValidate.php
0 → 100644
View file @
460c0b41
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:11 下午
*/
namespace
Validate
;
class
ColonelApplyValidate
extends
BaseValidate
{
protected
$rule
=
[
'phone'
=>
'isMobile'
,
'contact_name'
=>
'require'
,
];
protected
$message
=
[
'phone'
=>
'请输入正确的手机号'
,
'contact_name'
=>
'联系人不能为空'
];
}
\ No newline at end of file
application/models/marketing/mysql/PindanActivityColonelApply.php
0 → 100644
View file @
460c0b41
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:38 下午
*/
namespace
App\Models\marketing\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
PindanActivityColonelApply
extends
MysqlBase
{
const
TABLE_NAME
=
'pindan_activity_colonel_apply'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'colonel_apply_id'
;
public
static
function
insertRecord
(
array
$colums
)
{
return
self
::
insert
(
$colums
);
}
}
\ No newline at end of file
application/modules/Marketing/controllers/Colonel.php
0 → 100644
View file @
460c0b41
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:06 下午
*/
use
App\Base\Base
;
use
App\Services\marketing\ColonelService
;
use
\Validate\ColonelApplyValidate
;
class
ColonelController
extends
Base
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:21 下午
* @throws \App\Exception\custom\MarketingException
* @throws \App\Exception\custom\ParamException
*/
public
function
applyAction
()
{
$params
=
$this
->
params
;
(
new
ColonelApplyValidate
())
->
validate
();
$applyId
=
ColonelService
::
apply
(
$params
);
return
$this
->
success
([
'result'
=>
[
'applyId'
=>
$applyId
]]);
}
}
\ No newline at end of file
application/services/marketing/ColonelService.php
0 → 100644
View file @
460c0b41
<?php
/**
* Created by PhpStorm.
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 2:23 下午
*/
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\PindanActivityColonelApply
;
class
ColonelService
{
/**
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* Date: 2021/8/20 3:38 下午
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws MarketingException
*/
public
static
function
apply
(
array
$params
)
{
$colonelData
=
[
'phone'
=>
$params
[
'phone'
],
'contact_name'
=>
$params
[
'contact_name'
],
'take_place_name'
=>
$params
[
'take_place_name'
],
'take_place_pic'
=>
$params
[
'take_place_pic'
]
??
''
,
'longitude'
=>
$params
[
'longitude'
]
??
0
,
'latitude'
=>
$params
[
'latitude'
]
??
0
,
'location'
=>
$params
[
'location'
]
??
''
,
'address'
=>
$params
[
'address'
]
??
''
,
'province'
=>
$params
[
'province'
]
??
''
,
'city'
=>
$params
[
'city'
]
??
''
,
'area'
=>
$params
[
'area'
]
??
''
,
];
try
{
if
(
!
$applyId
=
PindanActivityColonelApply
::
insertRecord
(
$colonelData
))
{
throw
new
MarketingException
([
'cus'
=>
5
]);
}
return
$applyId
;
}
catch
(
\MarketingException
$e
)
{
throw
new
MarketingException
([
'cus'
=>
5
]);
}
}
}
\ No newline at end of file
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