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
a971875f
Commit
a971875f
authored
Aug 20, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
update: 处理冲突
parents
a8921578
d792760a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
75 additions
and
22 deletions
+75
-22
BaseException.php
application/exception/BaseException.php
+17
-10
MarketingException.php
application/exception/custom/MarketingException.php
+8
-2
PindanActivityColonel.php
application/models/marketing/mysql/PindanActivityColonel.php
+34
-0
ColonelService.php
application/services/marketing/ColonelService.php
+14
-8
PindanActivityColonelConfigService.php
...services/marketing/PindanActivityColonelConfigService.php
+2
-2
No files found.
application/exception/BaseException.php
View file @
a971875f
...
@@ -22,26 +22,33 @@ class BaseException extends \Exception
...
@@ -22,26 +22,33 @@ class BaseException extends \Exception
*/
*/
public
function
__construct
(
$params
=
[])
public
function
__construct
(
$params
=
[])
{
{
if
(
!
is_arra
y
(
$params
))
{
if
(
empt
y
(
$params
))
{
return
;
return
;
}
}
if
(
!
is_array
(
$params
))
{
return
$this
->
setCusMsg
(
$params
);
}
$this
->
code
=
$params
[
'code'
]
??
Registry
::
get
(
'config'
)
->
exception
->
user
->
code
;
$this
->
code
=
$params
[
'code'
]
??
Registry
::
get
(
'config'
)
->
exception
->
user
->
code
;
$this
->
msg
=
$params
[
'msg'
]
??
Registry
::
get
(
'config'
)
->
exception
->
user
->
msg
;
$this
->
msg
=
$params
[
'msg'
]
??
Registry
::
get
(
'config'
)
->
exception
->
user
->
msg
;
if
(
isset
(
$params
[
'cus'
])
&&
$this
->
cus
&&
isset
(
$this
->
cus
[
intval
(
$params
[
'cus'
])])
&&
$this
->
base_code
)
{
if
(
isset
(
$params
[
'cus'
])
&&
$this
->
cus
&&
isset
(
$this
->
cus
[
intval
(
$params
[
'cus'
])])
&&
$this
->
base_code
)
{
return
$this
->
setCusMsg
(
$params
[
'cus'
]);
}
}
//每个服务都有自己的codePrefix
public
function
setCusMsg
(
$cus
)
$appid
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
"appid"
);
{
$codePrefix
=
\Yaconf
::
get
(
'bizcode.prefix.'
.
$appid
);
//每个服务都有自己的codePrefix
$codePrefix
=
intval
(
$codePrefix
);
$appid
=
\Yaf\Application
::
app
()
->
getConfig
()
->
get
(
"appid"
);
$codePrefix
=
\Yaconf
::
get
(
'bizcode.prefix.'
.
$appid
);
$codePrefix
=
intval
(
$codePrefix
);
$cus_code
=
intval
(
$params
[
'cus'
]
);
$cus_code
=
intval
(
$cus
);
$base_code
=
intval
(
$this
->
base_code
);
$base_code
=
intval
(
$this
->
base_code
);
$this
->
code
=
$codePrefix
+
$base_code
+
$cus_code
;
$this
->
code
=
$codePrefix
+
$base_code
+
$cus_code
;
$this
->
msg
=
isset
(
$params
[
'data'
])
?
vsprintf
(
$this
->
cus
[
$cus_code
],
$params
[
'data'
])
:
$this
->
cus
[
$cus_code
];
$this
->
msg
=
isset
(
$params
[
'data'
])
?
vsprintf
(
$this
->
cus
[
$cus_code
],
$params
[
'data'
])
:
$this
->
cus
[
$cus_code
];
}
}
}
public
function
__get
(
$name
)
:
bool
public
function
__get
(
$name
)
:
bool
...
...
application/exception/custom/MarketingException.php
View file @
a971875f
...
@@ -13,6 +13,10 @@ class MarketingException extends BaseException
...
@@ -13,6 +13,10 @@ class MarketingException extends BaseException
const
LIFE_ACCOUNT_NO_EXIST
=
16
;
const
LIFE_ACCOUNT_NO_EXIST
=
16
;
const
RELATION_ALREADY_EXIST
=
17
;
const
RELATION_ALREADY_EXIST
=
17
;
const
TAKE_PLACE_NOT_EXIST
=
20
;
const
TAKE_PLACE_NOT_EXIST
=
20
;
const
COLONEL_APPLY_EXIST
=
23
;
const
COLONEL_APPLY_FAILED
=
24
;
const
COLONEL_CONFIG_NULL
=
25
;
const
COLONEL_LEVEL_SIX
=
26
;
protected
$cus
=
[
protected
$cus
=
[
0
=>
'活动名称不能为空'
,
0
=>
'活动名称不能为空'
,
...
@@ -38,7 +42,9 @@ class MarketingException extends BaseException
...
@@ -38,7 +42,9 @@ class MarketingException extends BaseException
self
::
TAKE_PLACE_NOT_EXIST
=>
'自提点不存在'
,
self
::
TAKE_PLACE_NOT_EXIST
=>
'自提点不存在'
,
21
=>
"活动开始时间不能大于或者等于结束时间"
,
21
=>
"活动开始时间不能大于或者等于结束时间"
,
22
=>
"自提点不能为空"
,
22
=>
"自提点不能为空"
,
23
=>
"团长分销配置内容不能为空"
,
self
::
COLONEL_APPLY_EXIST
=>
'当前用户已提交团长申请'
,
24
=>
"档位最多设定6档"
,
self
::
COLONEL_APPLY_FAILED
=>
'团长申请失败'
,
self
::
COLONEL_CONFIG_NULL
=>
"团长分销配置内容不能为空"
,
self
::
COLONEL_LEVEL_SIX
=>
"档位最多设定6档"
,
];
];
}
}
\ No newline at end of file
application/models/marketing/mysql/PindanActivityColonel
Apply
.php
→
application/models/marketing/mysql/PindanActivityColonel.php
View file @
a971875f
...
@@ -9,15 +9,26 @@ namespace App\Models\marketing\mysql;
...
@@ -9,15 +9,26 @@ namespace App\Models\marketing\mysql;
use
Api\PhpUtils\Mysql\MysqlBase
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
PindanActivityColonel
Apply
extends
MysqlBase
class
PindanActivityColonel
extends
MysqlBase
{
{
const
TABLE_NAME
=
'pindan_activity_colonel
_apply
'
;
const
TABLE_NAME
=
'pindan_activity_colonel'
;
const
CONFIG_INDEX
=
'marketing'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'colonel_apply_id'
;
const
PRIMARY_KEY
=
'colonel_apply_id'
;
public
static
function
insertRecord
(
array
$colums
)
public
static
function
insertRecord
(
array
$colums
)
:
int
{
{
return
self
::
insert
(
$colums
);
$id
=
self
::
insert
(
$colums
);
return
intval
(
$id
);
}
}
public
static
function
getRecord
(
array
$where
,
array
$colums
=
[
'*'
])
{
return
self
::
get
(
$colums
,
$where
);
}
public
static
function
existPhone
(
string
$phone
)
:
bool
{
$exists
=
self
::
getRecord
([
'phone'
=>
$phone
],[
'colonel_apply_id'
]);
return
!
empty
(
$exists
)
?
true
:
false
;
}
}
}
\ No newline at end of file
application/services/marketing/ColonelService.php
View file @
a971875f
...
@@ -8,20 +8,26 @@
...
@@ -8,20 +8,26 @@
namespace
App\Services\marketing
;
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\PindanActivityColonelApply
;
use
App\Models\marketing\mysql\PindanActivityColonel
;
use
Exception
;
class
ColonelService
class
ColonelService
{
{
/**
/**
* Notes: 申请成为团长
* Notes: 申请成为团长
* User: pengfei@yidian-inc.com
* User: pengfei@yidian-inc.com
* Date: 2021/8/20
3:38
下午
* Date: 2021/8/20
4:29
下午
* @param array $params
* @param array $params
* @return
\Api\PhpUtils\Mysql\MysqlBase
* @return
int $applyId
* @throws MarketingException
* @throws MarketingException
*/
*/
public
static
function
apply
(
array
$params
)
public
static
function
apply
(
array
$params
)
:
int
{
{
$params
[
'phone'
]
=
(
string
)
$params
[
'phone'
];
// TODO 判断用户是否已经成为团长按照 user_id 判断
if
(
PindanActivityColonel
::
existPhone
(
$params
[
'phone'
]))
{
throw
new
MarketingException
(
MarketingException
::
COLONEL_APPLY_EXIST
);
}
$colonelData
=
[
$colonelData
=
[
'phone'
=>
$params
[
'phone'
],
'phone'
=>
$params
[
'phone'
],
'contact_name'
=>
$params
[
'contact_name'
],
'contact_name'
=>
$params
[
'contact_name'
],
...
@@ -36,12 +42,12 @@ class ColonelService
...
@@ -36,12 +42,12 @@ class ColonelService
'area'
=>
$params
[
'area'
]
??
''
,
'area'
=>
$params
[
'area'
]
??
''
,
];
];
try
{
try
{
if
(
!
$applyId
=
PindanActivityColonel
Apply
::
insertRecord
(
$colonelData
))
{
if
(
!
$applyId
=
PindanActivityColonel
::
insertRecord
(
$colonelData
))
{
throw
new
MarketingException
(
[
'cus'
=>
5
]
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_APPLY_FAILED
);
}
}
return
$applyId
;
return
$applyId
;
}
catch
(
\Marketing
Exception
$e
)
{
}
catch
(
Exception
$e
)
{
throw
new
MarketingException
(
[
'cus'
=>
5
]
);
throw
new
MarketingException
(
MarketingException
::
COLONEL_APPLY_FAILED
);
}
}
}
}
}
}
\ No newline at end of file
application/services/marketing/PindanActivityColonelConfigService.php
View file @
a971875f
...
@@ -22,11 +22,11 @@ class PindanActivityColonelConfigService
...
@@ -22,11 +22,11 @@ class PindanActivityColonelConfigService
$configList
=
json_decode
(
$params
[
"config"
],
true
);
$configList
=
json_decode
(
$params
[
"config"
],
true
);
if
(
empty
(
$configList
))
{
if
(
empty
(
$configList
))
{
throw
new
MarketingException
([
'cus'
=>
23
]);
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
COLONEL_CONFIG_NULL
]);
}
}
if
(
count
(
$configList
)
>
6
)
{
if
(
count
(
$configList
)
>
6
)
{
throw
new
MarketingException
([
'cus'
=>
24
]);
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
COLONEL_LEVEL_SIX
]);
}
}
PindanActivityColonelConfig
::
beginTransaction
();
PindanActivityColonelConfig
::
beginTransaction
();
...
...
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