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
f56a963d
Commit
f56a963d
authored
Sep 27, 2021
by
卢洪光
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pre_release' into 'master'
Pre release See merge request bp/goods!75
parents
a4899e40
a65c7e76
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
652 additions
and
65 deletions
+652
-65
MarketingException.php
application/exception/custom/MarketingException.php
+4
-0
BusinessCircleValidate.php
application/library/Validate/BusinessCircleValidate.php
+39
-0
TagValidate.php
application/library/Validate/TagValidate.php
+33
-0
BusinessCircle.php
application/models/marketing/mysql/BusinessCircle.php
+52
-0
Tag.php
application/models/marketing/mysql/Tag.php
+52
-0
TakePlace.php
application/models/marketing/mysql/TakePlace.php
+8
-36
Businesscircle.php
application/modules/Marketing/controllers/Businesscircle.php
+56
-0
Marketinggoods.php
application/modules/Marketing/controllers/Marketinggoods.php
+1
-1
Tag.php
application/modules/Marketing/controllers/Tag.php
+56
-0
BusinessCircleService.php
application/services/marketing/BusinessCircleService.php
+98
-0
TagService.php
application/services/marketing/TagService.php
+106
-0
TakePlaceService.php
application/services/marketing/TakePlaceService.php
+147
-28
No files found.
application/exception/custom/MarketingException.php
View file @
f56a963d
...
...
@@ -26,6 +26,8 @@ class MarketingException extends BaseException
const
COLONEL_TAKE_PLACE_EDIT_FAILED
=
36
;
const
COLONEL_APPLY_EXIST
=
37
;
const
COLONEL_DATE_ERROR
=
38
;
const
BUSINESS_CIRCLE_IS_EXIST
=
39
;
const
TAG_IS_EXIST
=
40
;
protected
$cus
=
[
0
=>
'活动名称不能为空'
,
...
...
@@ -67,5 +69,7 @@ class MarketingException extends BaseException
self
::
COLONEL_TAKE_PLACE_EDIT_FAILED
=>
'修改团长自提点失败'
,
self
::
COLONEL_APPLY_EXIST
=>
'当前用户已提交团长申请'
,
self
::
COLONEL_DATE_ERROR
=>
'当前日期的配置不能修改'
,
self
::
BUSINESS_CIRCLE_IS_EXIST
=>
'此商圈名已经存在'
,
self
::
TAG_IS_EXIST
=>
'此分类标签已经存在'
,
];
}
application/library/Validate/BusinessCircleValidate.php
0 → 100644
View file @
f56a963d
<?php
namespace
Validate
;
/**
* Class Businesscircle
*
* @package Validate
*/
class
BusinessCircleValidate
extends
BaseValidate
{
protected
$rule
=
[
'business_circle_id'
=>
'require'
,
'business_circle_name'
=>
'require'
,
'longitude'
=>
'require'
,
'latitude'
=>
'require'
,
'location'
=>
'require'
,
];
protected
$message
=
[
"business_circle_id"
=>
"business_circle_id 不能为空"
,
'business_circle_name'
=>
'商圈名称不能为空'
,
'longitude'
=>
'经度不能为空'
,
'latitude'
=>
'纬度不能为空'
,
'location'
=>
'详细地址不能为空'
,
];
public
function
sceneDetail
()
{
return
$this
->
only
([
'business_circle_id'
])
->
append
(
"business_circle_id"
,
"require"
);
}
public
function
sceneDelete
()
{
return
$this
->
only
([
'business_circle_id'
])
->
append
(
"business_circle_id"
,
"require"
);
}
}
\ No newline at end of file
application/library/Validate/TagValidate.php
0 → 100644
View file @
f56a963d
<?php
namespace
Validate
;
/**
* Class TagValidate
*
* @package Validate
*/
class
TagValidate
extends
BaseValidate
{
protected
$rule
=
[
'tag_id'
=>
'require'
,
'tag_name'
=>
'require'
,
];
protected
$message
=
[
"tag_id"
=>
"tag_id 不能为空"
,
"tag_name"
=>
"tag_id 不能为空"
,
];
public
function
sceneDetail
()
{
return
$this
->
only
([
'tag_id'
])
->
append
(
"tag_id"
,
"require"
);
}
public
function
sceneDelete
()
{
return
$this
->
only
([
'tag_id'
])
->
append
(
"tag_id"
,
"require"
);
}
}
\ No newline at end of file
application/models/marketing/mysql/BusinessCircle.php
0 → 100644
View file @
f56a963d
<?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 @
f56a963d
<?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'
;
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/TakePlace.php
View file @
f56a963d
...
...
@@ -19,42 +19,6 @@ class TakePlace extends MysqlBase
const
STATUS_NORMAL
=
0
;
// 正常
const
STATUS_DELETE
=
1
;
// 删除
/**
* 获取
* @param $params
* @return mixed
*/
public
static
function
searchList
(
$params
)
{
$lifeAccountId
=
$params
[
'life_account_id'
]
??
MarketingService
::
getPublicLifeAccountId
();
$keywords
=
$params
[
'keywords'
]
??
''
;
$offset
=
$params
[
'offset'
]
??
0
;
$limit
=
$params
[
'limit'
]
??
20
;
$takePlaceIds
=
$params
[
'take_place_id'
]
??
[];
if
(
!
empty
(
$takePlaceIds
))
{
$where
[
'take_place_id'
]
=
$takePlaceIds
;
}
if
(
$lifeAccountId
)
{
$where
[
'life_account_id'
]
=
$lifeAccountId
;
}
if
(
$keywords
)
{
$where
[
'OR'
]
=
[
'take_place_name[~]'
=>
$keywords
,
'contact_name[~]'
=>
$keywords
,
];
}
$where
[
'is_delete'
]
=
TakePlace
::
STATUS_NORMAL
;
$where
[
'ORDER'
]
=
[
'take_place_id'
=>
'DESC'
];
$where
[
'LIMIT'
]
=
[
$offset
,
$limit
];
$res
[
'list'
]
=
self
::
select
(
'*'
,
$where
);
unset
(
$where
[
'ORDER'
],
$where
[
'LIMIT'
]);
$res
[
'total'
]
=
self
::
count
(
'*'
,
$where
);
return
$res
;
}
public
static
function
getRecord
(
array
$where
,
$column
=
'*'
)
{
return
self
::
get
(
$column
,
$where
);
...
...
@@ -70,4 +34,12 @@ class TakePlace extends MysqlBase
$exist
=
self
::
getRecord
([
'take_place_name'
=>
$takePlaceName
],
[
'take_place_id'
]);
return
!
empty
(
$exist
);
}
public
static
function
save
(
$data
,
$where
=
[])
{
if
(
empty
(
$where
))
{
return
self
::
insert
(
$data
,
[]);
}
return
self
::
update
(
$data
,
$where
);
}
}
application/modules/Marketing/controllers/Businesscircle.php
0 → 100644
View file @
f56a963d
<?php
use
App\Base\Base
;
use
\App\Services\marketing\BusinessCircleService
;
use
\Validate\BusinessCircleValidate
;
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
()
{
(
new
BusinessCircleValidate
())
->
scene
(
"detail"
)
->
validate
();
$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
()
{
(
new
BusinessCircleValidate
())
->
scene
(
"delete"
)
->
validate
();
$params
=
$this
->
params
;
$list
=
BusinessCircleService
::
businessCircleDelete
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
}
\ No newline at end of file
application/modules/Marketing/controllers/Marketinggoods.php
View file @
f56a963d
...
...
@@ -12,7 +12,7 @@ use App\Services\goods\GoodsService;
class
MarketinggoodsController
extends
Base
{
const
KS3_BASE_URL
=
'ks3-cn-beijing.ksyun.com'
;
const
KS3_BASE_URL
=
'ks3-cn-beijing.ksyun
cs
.com'
;
/**
* 获取全部生效营销活动商品列表
*
...
...
application/modules/Marketing/controllers/Tag.php
0 → 100644
View file @
f56a963d
<?php
use
App\Base\Base
;
use
\App\Services\marketing\TagService
;
use
\Validate\TagValidate
;
class
TagController
extends
Base
{
/**
* 分类标签数据列表
* @throws Exception
*/
public
function
listAction
()
{
$params
=
$this
->
params
;
$list
=
TagService
::
getList
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 分类标签详情
* @throws Exception
*/
public
function
detailAction
()
{
(
new
TagValidate
())
->
scene
(
"detail"
)
->
validate
();
$params
=
$this
->
params
;
$list
=
TagService
::
tagDetail
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 分类标签编辑(包括add 和 update)
* @throws Exception
*/
public
function
editAction
()
{
$params
=
$this
->
params
;
$list
=
TagService
::
tagEdit
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
/**
* 分类标签删除(逻辑删除)
* @throws Exception
*/
public
function
deleteAction
()
{
(
new
TagValidate
())
->
scene
(
"delete"
)
->
validate
();
$params
=
$this
->
params
;
$list
=
TagService
::
tagDelete
(
$params
);
$this
->
success
([
"result"
=>
$list
]);
}
}
\ No newline at end of file
application/services/marketing/BusinessCircleService.php
0 → 100644
View file @
f56a963d
<?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
[
'list'
=>
$list
,
'count'
=>
$count
];
}
}
\ No newline at end of file
application/services/marketing/TagService.php
0 → 100644
View file @
f56a963d
<?php
/**
* Tag
* Class Tag
* @package App\Models\marketing\mysql
*/
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Models\marketing\mysql\Tag
;
use
App\Models\marketing\mysql\TakePlace
;
class
TagService
{
/**
* 分类标签详情
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
tagDetail
(
$params
=
[])
{
return
Tag
::
getRecord
([
"tag_id"
=>
$params
[
"tag_id"
]]);
}
/**
* 分类标签编辑
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
* @throws MarketingException
*/
public
static
function
tagEdit
(
$params
=
[])
{
$tagId
=
empty
(
$params
[
"tag_id"
])
?
0
:
$params
[
"tag_id"
];
$data
=
[];
$data
[
"tag_name"
]
=
empty
(
$params
[
"tag_name"
])
?
""
:
$params
[
"tag_name"
];
$data
[
"type"
]
=
empty
(
$params
[
"type"
])
?
1
:
$params
[
"type"
];
$data
[
"is_delete"
]
=
empty
(
$params
[
"is_delete"
])
?
Tag
::
STATUS_IS_DEL_NO
:
$params
[
"is_delete"
];
if
(
!
empty
(
$tagId
))
{
$tag
=
Tag
::
getRecordMaster
([
"tag_name"
=>
$data
[
"tag_name"
],
"tag_id[!]"
=>
$tagId
]);
if
(
!
empty
(
$tag
))
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
TAG_IS_EXIST
]);
}
$result
=
Tag
::
save
(
$data
,
[
"tag_id"
=>
$tagId
]);
}
else
{
$tag
=
Tag
::
getRecordMaster
([
"tag_name"
=>
$data
[
"tag_name"
]]);
if
(
!
empty
(
$tag
))
{
throw
new
MarketingException
([
'cus'
=>
MarketingException
::
TAG_IS_EXIST
]);
}
$result
=
Tag
::
save
(
$data
);
}
return
$result
;
}
/**
* 逻辑删除分类标签
* @param array $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
tagDelete
(
$params
=
[])
{
$tagId
=
$params
[
"tag_id"
];
$data
=
[];
$data
[
"is_delete"
]
=
empty
(
$params
[
"is_delete"
])
?
0
:
$params
[
"is_delete"
];
$deleteRes
=
Tag
::
save
(
$data
,
[
"tag_id"
=>
$tagId
]);
if
(
!
empty
(
$data
[
"is_delete"
]))
{
$takePlaceIds
=
TakePlace
::
getRecords
([
"tag_id"
=>
$tagId
],
[
"take_place_id"
]);
if
(
!
empty
(
$takePlaceIds
))
{
$ids
=
array_column
(
$takePlaceIds
,
"take_place_id"
);
TakePlace
::
save
([
"tag_id"
=>
0
],
[
"take_place_id"
=>
$ids
]);
}
}
return
$deleteRes
;
}
/**
* 分类标签列表
* @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
[
"tag_name"
]))
{
$where
[
"tag_name[~]"
]
=
$params
[
"tag_name"
];
}
$where
[
'is_delete'
]
=
Tag
::
STATUS_IS_DEL_NO
;
$where
[
'ORDER'
]
=
[
"tag_id"
=>
"DESC"
];
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$list
=
Tag
::
getRecords
(
$where
);
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
$count
=
Tag
::
count
(
"*"
,
$where
);
return
[
'result'
=>
$list
,
'count'
=>
$count
];
}
}
\ No newline at end of file
application/services/marketing/TakePlaceService.php
View file @
f56a963d
This diff is collapsed.
Click to expand it.
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