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
bad9392b
Commit
bad9392b
authored
Jul 23, 2021
by
耿鸿飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature:生活号 骑手排线
parent
1b9dd0d7
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
637 additions
and
1 deletion
+637
-1
DelivererException.php
application/exception/custom/DelivererException.php
+16
-0
DelivererAddValidate.php
application/library/Validate/DelivererAddValidate.php
+28
-0
DelivererDayAddValidate.php
application/library/Validate/DelivererDayAddValidate.php
+25
-0
ActivityDao.php
application/models/commerce/mysql/ActivityDao.php
+13
-0
GoodsClassifyCollectDao.php
...ication/models/commerce/mysql/GoodsClassifyCollectDao.php
+13
-0
GoodsClassifyDao.php
application/models/commerce/mysql/GoodsClassifyDao.php
+13
-0
GoodsDao.php
application/models/commerce/mysql/GoodsDao.php
+13
-0
OrderDao.php
application/models/commerce/mysql/OrderDao.php
+13
-0
OrderItemDao.php
application/models/commerce/mysql/OrderItemDao.php
+13
-0
StationCollectDao.php
application/models/commerce/mysql/StationCollectDao.php
+13
-0
StationDao.php
application/models/commerce/mysql/StationDao.php
+15
-0
DelivererDao.php
application/models/merchant/mysql/DelivererDao.php
+14
-0
DelivererDayDao.php
application/models/merchant/mysql/DelivererDayDao.php
+14
-0
CommercePlanLine.php
application/modules/Cli/controllers/CommercePlanLine.php
+9
-0
Deliverer.php
application/modules/Merchant/controllers/Deliverer.php
+75
-0
PlanLineService.php
application/services/commerce/PlanLineService.php
+247
-0
DelivererService.php
application/services/merchant/DelivererService.php
+102
-0
application.ini
conf/application.ini
+1
-1
No files found.
application/exception/custom/DelivererException.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Exception\custom
;
use
App\Exception\BaseException
;
class
DelivererException
extends
BaseException
{
protected
$base_code
=
Code
::
DELIVERER
;
protected
$cus
=
[
0
=>
'骑手创建失败,请稍后重试'
,
];
}
\ No newline at end of file
application/library/Validate/DelivererAddValidate.php
0 → 100644
View file @
bad9392b
<?php
namespace
Validate
;
/**
* Class GoodsAddValidate
*
* @package Validate
*/
class
DelivererAddValidate
extends
BaseValidate
{
protected
$rule
=
[
'name'
=>
'require|length:1,15'
,
'max_capacity'
=>
'require|between:1,1000'
,
'min_capacity'
=>
'require|between:1,1000'
,
'tool_type'
=>
'require|between:0,1'
,
];
protected
$message
=
[
'name'
=>
'请检查骑手名称,内容不能太长或者不填写'
,
'max_capacity'
=>
'请填写骑手最大配送量,1--1000'
,
'min_capacity'
=>
'请填写骑手最小配送量,1--1000'
,
'tool_type'
=>
'请选择交通工具,电动车或者摩托车'
];
}
\ No newline at end of file
application/library/Validate/DelivererDayAddValidate.php
0 → 100644
View file @
bad9392b
<?php
namespace
Validate
;
/**
* Class GoodsAddValidate
*
* @package Validate
*/
class
DelivererDayAddValidate
extends
BaseValidate
{
protected
$rule
=
[
'date'
=>
'require|length:1,15'
,
'uids'
=>
'require|length:1,1000'
,
];
protected
$message
=
[
'date'
=>
'请检查日期'
,
'uids'
=>
'请填写骑手'
,
];
}
\ No newline at end of file
application/models/commerce/mysql/ActivityDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
ActivityDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkModelCore'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/GoodsClassifyCollectDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
GoodsClassifyCollectDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkGoodsClassifyCollect'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/GoodsClassifyDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
GoodsClassifyDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkGoodsClassify'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/GoodsDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
GoodsDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkCore'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/OrderDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
OrderDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkOrder'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/OrderItemDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
OrderItemDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkOrderItem'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/StationCollectDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
StationCollectDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkStationCollect'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/commerce/mysql/StationDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\commerce\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
StationDao
extends
MysqlBase
{
const
TABLE_NAME
=
'hulk_HulkStation'
;
const
CONFIG_INDEX
=
'commerce'
;
}
\ No newline at end of file
application/models/merchant/mysql/DelivererDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\merchant\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
DelivererDao
extends
MysqlBase
{
const
TABLE_NAME
=
'deliverer'
;
const
CONFIG_INDEX
=
'goods'
;
const
PRIMARY_KEY
=
'deliverer_id'
;
}
\ No newline at end of file
application/models/merchant/mysql/DelivererDayDao.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Models\merchant\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
DelivererDayDao
extends
MysqlBase
{
const
TABLE_NAME
=
'deliverer_day'
;
const
CONFIG_INDEX
=
'goods'
;
const
PRIMARY_KEY
=
'deliverer_day_id'
;
}
\ No newline at end of file
application/modules/Cli/controllers/CommercePlanLine.php
0 → 100644
View file @
bad9392b
<?php
class
CommercePlanLineController
extends
\App\Base\Cli
{
public
function
RunAction
(){
(
new
\App\Services\commerce\PlanLineService
)
->
commerce
(
'1NJF2Y'
);
}
}
\ No newline at end of file
application/modules/Merchant/controllers/Deliverer.php
0 → 100644
View file @
bad9392b
<?php
class
DelivererController
extends
\App\Base\Base
{
/**
* 添加配送员
* @author 耿鸿飞<15911185633>
* @date 2021/7/22 下午7:52
* @link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=69521762#space-menu-link-content
* @api_link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=70453886
* @throws \App\Exception\custom\DelivererException
* @throws \App\Exception\custom\ParamException
*/
public
function
add_delivererAction
(){
(
new
\Validate\DelivererAddValidate
())
->
validate
();
$params
=
$this
->
params
;
if
(
\App\Services\merchant\DelivererService
::
AddDeliverer
(
$params
)){
$this
->
success
([
'response'
=>
'ok'
]);
}
throw
new
\App\Exception\custom\DelivererException
([
'cus'
=>
0
]);
}
/**
* 获取配送员列表
* @author 耿鸿飞<15911185633>
* @date 2021/7/22 下午7:52
* @link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=69521762#space-menu-link-content
* @api_link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=70453889
* @throws Exception
*/
public
function
list_day_delivererAction
(){
$day
=
$this
->
params
[
'date'
]
??
''
;
$delivererList
=
\App\Services\merchant\DelivererService
::
ListDeliverer
(
$day
);
$this
->
success
([
'response'
=>
$delivererList
]);
}
/**
* 保存每日的配送员
* @author 耿鸿飞<15911185633>
* @date 2021/7/22 下午7:52
* @link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=69521762#space-menu-link-content
* @api_link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=70453893
* @throws \App\Exception\custom\ParamException
*/
public
function
save_day_delivererAction
(){
(
new
\Validate\DelivererDayAddValidate
())
->
validate
();
$params
=
$this
->
params
;
\App\Services\merchant\DelivererService
::
SaveDelivererDay
(
$params
);
$this
->
success
([
'response'
=>
'ok'
]);
}
/**
* 获取日配送员列表
* @author 耿鸿飞<15911185633>
* @date 2021/7/22 下午7:51
* @link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=69521762#space-menu-link-content
* @api_link http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=70453896
* @throws Exception
*/
public
function
list_day_deliverer_confAction
(){
$list
=
\App\Services\merchant\DelivererService
::
ListDelivererConf
(
$this
->
params
);
//$this->success(['a' => \Yaf\Application::app()->environ()]);
$this
->
success
([
'response'
=>
$list
]);
}
}
\ No newline at end of file
application/services/commerce/PlanLineService.php
0 → 100644
View file @
bad9392b
This diff is collapsed.
Click to expand it.
application/services/merchant/DelivererService.php
0 → 100644
View file @
bad9392b
<?php
namespace
App\Services\merchant
;
use
App\Models\merchant\mysql\DelivererDao
;
use
App\Models\merchant\mysql\DelivererDayDao
;
class
DelivererService
{
/**
* 添加配送员
* @param $params
* @return bool
*/
public
static
function
AddDeliverer
(
$params
){
$row
=
DelivererDao
::
get
([
'deliverer_id'
,
'deliverer_status'
],[
'deliverer_name'
=>
$params
[
'name'
]]);
if
(
$row
){
if
(
$row
[
'deliverer_status'
]
!=
0
){
return
DelivererDao
::
update
([
'deliverer_status'
=>
0
],[
'deliverer_id'
=>
$row
[
'deliverer_id'
]])
>
0
;
}
return
$row
[
'deliverer_id'
];
}
return
DelivererDao
::
insert
([
'deliverer_name'
=>
$params
[
'name'
],
'deliverer_max_capacity'
=>
intval
(
$params
[
'max_capacity'
]),
'deliverer_min_capacity'
=>
intval
(
$params
[
'min_capacity'
]),
'deliverer_tool_type'
=>
intval
(
$params
[
'tool_type'
]),
])
>
0
;
}
/**
* 获取全部可用配送员列表
* @param string $date
* @return array
*/
public
static
function
ListDeliverer
(
$date
=
''
){
$delivererList
=
DelivererDao
::
select
([
'deliverer_id'
,
'deliverer_name'
,
'deliverer_max_capacity'
,
'deliverer_min_capacity'
,
'deliverer_tool_type'
],[
'deliverer_status'
=>
0
]);
$dayDelivererMap
=
[];
if
(
$date
){
$dayDelivererMap
=
array_column
(
DelivererDayDao
::
select
([
'deliverer_id'
],[
'deliverer_day_date'
=>
$date
,
'deliverer_day_status'
=>
0
]),
null
,
'deliverer_id'
);
}
return
array_map
(
function
(
$a
)
use
(
$dayDelivererMap
){
$a
[
'checked'
]
=
isset
(
$dayDelivererMap
[
$a
[
'deliverer_id'
]])
?
1
:
0
;
return
$a
;
},
$delivererList
);
}
/**
* 保存每日配送员设置
* @param $params
* @return bool
*/
public
static
function
SaveDelivererDay
(
$params
){
$date
=
$params
[
'date'
];
DelivererDayDao
::
beginTransaction
();
DelivererDayDao
::
delete
([
'deliverer_day_date'
=>
$date
]);
$uids
=
explode
(
','
,
$params
[
'uids'
]);
foreach
(
$uids
as
$uid
){
if
(
!
$uid
){
continue
;
}
$ret
=
DelivererDayDao
::
insert
([
'deliverer_day_date'
=>
$date
,
'deliverer_id'
=>
$uid
,
]);
if
(
!
$ret
){
DelivererDayDao
::
rollback
();
return
false
;
}
}
return
DelivererDayDao
::
commit
();
}
/**
* 获取每日配送员列表
* @param $params
* @return array
*/
public
static
function
ListDelivererConf
(
$params
){
$dateList
=
DelivererDayDao
::
select
([
'deliverer_day_date'
,
'deliverer_id'
],[
'deliverer_day_status'
=>
0
,
'deliverer_day_date[>]'
=>
date
(
"Y-m-d"
,
strtotime
(
'-30 days'
))]);
if
(
!
$dateList
){
return
[];
}
$delivererIdList
=
array_unique
(
array_column
(
$dateList
,
'deliverer_id'
));
$delivererList
=
DelivererDao
::
select
([
'deliverer_id'
,
'deliverer_name'
,
'deliverer_max_capacity'
,
'deliverer_min_capacity'
,
'deliverer_tool_type'
],[
'deliverer_id[in]'
=>
$delivererIdList
]);
$delivererMap
=
array_column
(
$delivererList
,
null
,
'deliverer_id'
);
$retList
=
[];
foreach
(
$dateList
as
$item
){
if
(
!
isset
(
$retList
[
$item
[
'deliverer_day_date'
]])){
$retList
[
$item
[
'deliverer_day_date'
]]
=
[];
}
$retList
[
$item
[
'deliverer_day_date'
]][]
=
$delivererMap
[
$item
[
'deliverer_id'
]];
}
krsort
(
$retList
,
SORT_STRING
);
return
$retList
;
}
}
\ No newline at end of file
conf/application.ini
View file @
bad9392b
...
...
@@ -3,7 +3,7 @@ application.directory = APP_PATH
application.bootstrap
=
APP_PATH "/Bootstrap.php"
application.library
=
APP_PATH"/library"
application.library.namespace
=
""
application.modules
=
"Index,Test,Goods,Shop,Marketing,Tcc"
application.modules
=
"Index,Test,Goods,Shop,Marketing,Tcc
,Merchant
"
appid
=
"goods"
;AES密钥
...
...
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