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
a1d611f4
Commit
a1d611f4
authored
Sep 13, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update: 商圈逻辑接口
parent
824b111a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
245 additions
and
0 deletions
+245
-0
MarketingException.php
application/exception/custom/MarketingException.php
+2
-0
BusinessCircle.php
application/models/marketing/mysql/BusinessCircle.php
+52
-0
Tag.php
application/models/marketing/mysql/Tag.php
+41
-0
Businesscircle.php
application/modules/Marketing/controllers/Businesscircle.php
+52
-0
BusinessCircleService.php
application/services/marketing/BusinessCircleService.php
+98
-0
No files found.
application/exception/custom/MarketingException.php
View file @
a1d611f4
...
@@ -13,6 +13,7 @@ class MarketingException extends BaseException
...
@@ -13,6 +13,7 @@ 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
BUSINESS_CIRCLE_IS_EXIST
=
34
;
protected
$cus
=
[
protected
$cus
=
[
0
=>
'活动名称不能为空'
,
0
=>
'活动名称不能为空'
,
...
@@ -39,5 +40,6 @@ class MarketingException extends BaseException
...
@@ -39,5 +40,6 @@ class MarketingException extends BaseException
21
=>
"活动开始时间不能大于或者等于结束时间"
,
21
=>
"活动开始时间不能大于或者等于结束时间"
,
22
=>
"自提点不能为空"
,
22
=>
"自提点不能为空"
,
33
=>
'分润金额+手续费不能大于售价金额'
,
33
=>
'分润金额+手续费不能大于售价金额'
,
self
::
BUSINESS_CIRCLE_IS_EXIST
=>
'此商圈名已经存在'
,
];
];
}
}
\ No newline at end of file
application/models/marketing/mysql/BusinessCircle.php
0 → 100644
View file @
a1d611f4
<?php
namespace
App\Models\marketing\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
BusinessCircle
extends
MysqlBase
{
const
TABLE_NAME
=
'business_circle'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'business_circle_id'
;
const
STATUS_IS_DEL_NO
=
0
;
const
STATUS_IS_DEL_YES
=
1
;
public
static
function
getRecord
(
$where
,
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
get
(
$columns
,
$where
,
[]);
}
public
static
function
getRecords
(
$where
,
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
select
(
$columns
,
$where
,
[]);
}
public
static
function
getRecordMaster
(
$where
,
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
selectMaster
(
$columns
,
$where
,
[]);
}
public
static
function
save
(
$data
,
$where
=
[])
{
if
(
empty
(
$where
))
{
return
self
::
insert
(
$data
,
[]);
}
return
self
::
update
(
$data
,
$where
);
}
public
static
function
deleteRecord
(
$where
)
{
return
self
::
delete
(
$where
);
}
}
application/models/marketing/mysql/Tag.php
0 → 100644
View file @
a1d611f4
<?php
namespace
App\Models\marketing\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
Tag
extends
MysqlBase
{
const
TABLE_NAME
=
'tag'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'tag_id'
;
public
static
function
getRecord
(
$where
,
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
get
(
$columns
,
$where
,
[]);
}
public
static
function
getRecordMaster
(
$where
,
$columns
=
[])
{
if
(
empty
(
$columns
))
{
$columns
=
'*'
;
}
return
self
::
selectMaster
(
$columns
,
$where
,
[]);
}
public
static
function
save
(
$data
,
$where
=
[])
{
if
(
empty
(
$where
))
{
return
self
::
insert
(
$data
,
[]);
}
return
self
::
update
(
$data
,
$where
);
}
public
static
function
deleteRecord
(
$where
)
{
return
self
::
delete
(
$where
);
}
}
application/modules/Marketing/controllers/Businesscircle.php
0 → 100644
View file @
a1d611f4
<?php
use
App\Base\Base
;
use
\App\Services\marketing\BusinessCircleService
;
use
\Validate\MarketingInfoValidate
;
class
BusinesscircleController
extends
Base
{
/**
* 商圈数据列表
* @throws Exception
*/
public
function
listAction
()
{
$params
=
$this
->
params
;
$list
=
BusinessCircleService
::
getList
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 商圈详情
* @throws Exception
*/
public
function
detailAction
()
{
$params
=
$this
->
params
;
$list
=
BusinessCircleService
::
businessCircleDetail
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 商圈编辑(包括add 和 update)
* @throws Exception
*/
public
function
editAction
()
{
$params
=
$this
->
params
;
$list
=
BusinessCircleService
::
businessCircleEdit
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 商圈删除(逻辑删除)
* @throws Exception
*/
public
function
deleteAction
()
{
$params
=
$this
->
params
;
$list
=
BusinessCircleService
::
businessCircleDelete
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
}
\ No newline at end of file
application/services/marketing/BusinessCircleService.php
0 → 100644
View file @
a1d611f4
<?php
/**
* BusinessCircle
* Class BusinessCircle
* @package App\Models\marketing\mysql
*/
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\BusinessCircle
;
class
BusinessCircleService
{
/**
* 商圈详情
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
businessCircleDetail
(
$params
=
[])
{
return
BusinessCircle
::
getRecord
([
"business_circle_id"
=>
$params
[
"business_circle_id"
]]);
}
/**
* 商圈编辑
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws MarketingException
*/
public
static
function
businessCircleEdit
(
$params
=
[])
{
$businessCircleId
=
empty
(
$params
[
"business_circle_id"
])
?
0
:
$params
[
"business_circle_id"
];
$data
=
[];
$data
[
"business_circle_name"
]
=
empty
(
$params
[
"business_circle_name"
])
?
""
:
$params
[
"business_circle_name"
];
$data
[
"longitude"
]
=
empty
(
$params
[
"longitude"
])
?
""
:
$params
[
"longitude"
];
$data
[
"latitude"
]
=
empty
(
$params
[
"latitude"
])
?
""
:
$params
[
"latitude"
];
$data
[
"location"
]
=
empty
(
$params
[
"location"
])
?
""
:
$params
[
"location"
];
$data
[
"is_delete"
]
=
empty
(
$params
[
"is_delete"
])
?
BusinessCircle
::
STATUS_IS_DEL_NO
:
$params
[
"is_delete"
];
if
(
!
empty
(
$businessCircleId
))
{
$businessCircle
=
BusinessCircle
::
getRecordMaster
([
"business_circle_name"
=>
$data
[
"business_circle_name"
],
"business_circle_id[!]"
=>
$businessCircleId
]);
if
(
!
empty
(
$businessCircle
))
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
BUSINESS_CIRCLE_IS_EXIST
]);
}
$result
=
BusinessCircle
::
save
(
$data
,
[
"business_circle_id"
=>
$businessCircleId
]);
}
else
{
$businessCircle
=
BusinessCircle
::
getRecordMaster
([
"business_circle_name"
=>
$data
[
"business_circle_name"
]]);
if
(
!
empty
(
$businessCircle
))
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
BUSINESS_CIRCLE_IS_EXIST
]);
}
$result
=
BusinessCircle
::
save
(
$data
);
}
return
$result
;
}
/**
* 逻辑删除商圈
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
businessCircleDelete
(
$params
=
[])
{
$businessCircleId
=
$params
[
"business_circle_id"
];
$data
=
[];
$data
[
"is_delete"
]
=
empty
(
$params
[
"is_delete"
])
?
0
:
$params
[
"is_delete"
];
return
BusinessCircle
::
save
(
$data
,
[
"business_circle_id"
=>
$businessCircleId
]);
}
/**
* 商圈列表
* @param array $params
* @return array
*/
public
static
function
getList
(
$params
=
[])
{
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$limit
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$page
=
(
$params
[
'page'
]
-
1
)
*
$limit
;
$where
=
[];
if
(
!
empty
(
$params
[
"business_circle_name"
]))
{
$where
[
"business_circle_name[~]"
]
=
$params
[
"business_circle_name"
];
}
$where
[
'is_delete'
]
=
BusinessCircle
::
STATUS_IS_DEL_NO
;
$where
[
'ORDER'
]
=
[
"business_circle_id"
=>
"DESC"
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$list
=
BusinessCircle
::
getRecords
(
$where
);
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
$count
=
BusinessCircle
::
count
(
"*"
,
$where
);
return
[
'result'
=>
$list
,
'count'
=>
$count
];
}
}
\ 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