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
e2dcf593
Commit
e2dcf593
authored
Jun 23, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:set
parent
6cb88e3b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
178 deletions
+61
-178
DistributorException.php
application/exception/custom/DistributorException.php
+2
-0
Distribution.php
application/models/marketing/mysql/Distribution.php
+0
-63
DistributionGoods.php
application/models/marketing/mysql/DistributionGoods.php
+0
-67
Marketinggoods.php
application/modules/Marketing/controllers/Marketinggoods.php
+31
-14
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+28
-34
No files found.
application/exception/custom/DistributorException.php
View file @
e2dcf593
...
@@ -31,5 +31,7 @@ class DistributorException extends BaseException
...
@@ -31,5 +31,7 @@ class DistributorException extends BaseException
12
=>
'类型不能为空'
,
12
=>
'类型不能为空'
,
13
=>
'姓名不能大于40字符'
,
13
=>
'姓名不能大于40字符'
,
14
=>
'用户id不能能为空'
,
14
=>
'用户id不能能为空'
,
15
=>
'活动id不能能为空'
,
16
=>
'商品id不能能为空'
,
];
];
}
}
\ No newline at end of file
application/models/marketing/mysql/Distribution.php
deleted
100644 → 0
View file @
6cb88e3b
<?php
namespace
App\Models\distribution\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
Distribution
extends
MysqlBase
{
const
TABLE_NAME
=
'distribution'
;
const
CONFIG_INDEX
=
'distribution'
;
const
PRIMARY_KEY
=
'id'
;
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
get
(
$colums
,
$where
);
}
public
static
function
getRecordMaster
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
selectMaster
(
$colums
,
$where
);
}
public
static
function
insertRecord
(
$colums
)
{
return
self
::
insert
(
$colums
);
}
public
static
function
updateRecord
(
$colums
,
$where
)
{
return
self
::
update
(
$colums
,
$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
);
}
public
static
function
getRecords
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
select
(
$colums
,
$where
);
}
public
static
function
getCount
(
$where
,
$columns
=
"*"
)
{
return
self
::
count
(
$columns
,
$where
);
}
}
application/models/marketing/mysql/DistributionGoods.php
deleted
100644 → 0
View file @
6cb88e3b
<?php
namespace
App\Models\shop\mysql
;
use
Api\PhpUtils\Mysql\MysqlBase
;
class
SubShop
extends
MysqlBase
{
const
TABLE_NAME
=
'sub_shop'
;
const
CONFIG_INDEX
=
'goods'
;
const
PRIMARY_KEY
=
'stores_id'
;
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
get
(
$colums
,
$where
);
}
public
static
function
getRecordMaster
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
selectMaster
(
$colums
,
$where
);
}
public
static
function
insertRecord
(
$colums
)
{
$options
[
'rowCount'
]
=
true
;
return
self
::
insert
(
$colums
,
$options
);
}
public
static
function
updateRecord
(
$colums
,
$where
)
{
return
self
::
update
(
$colums
,
$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
);
}
public
static
function
getRecords
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
$colums
=
'*'
;
}
return
self
::
select
(
$colums
,
$where
);
}
public
static
function
getCount
(
$where
,
$columns
=
"*"
)
{
return
self
::
count
(
$columns
,
$where
);
}
}
application/modules/Marketing/controllers/Marketinggoods.php
View file @
e2dcf593
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
use
App\Base\Base
;
use
App\Base\Base
;
use
App\Services\Marketing\MarketingGoodsService
;
use
App\Services\Marketing\MarketingGoodsService
;
use
App\Exception\custom\DistributorException
;
use
App\Exception\custom\DistributorException
;
use
Helpers\Aes
;
class
MarketingGoodsController
extends
Base
class
MarketingGoodsController
extends
Base
{
{
...
@@ -14,21 +15,37 @@ class MarketingGoodsController extends Base
...
@@ -14,21 +15,37 @@ class MarketingGoodsController extends Base
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
// $marketingList = Marketing::getMarketingList(['online_status' => 1,'start_time' => date("Y-m-d H:i:s"),'end_time' => date("Y-m-d H:i:s")]);
$list
=
MarketingGoodsService
::
marketingGoodsList
(
$params
);
$this
->
success
(
$list
);
}
public
function
generate_share_goodsAction
()
{
$params
=
$this
->
params
;
$userId
=
!
empty
(
$params
[
'user_id'
])
?
$params
[
'user_id'
]
:
''
;
$marketingId
=
!
empty
(
$params
[
'marketing_id'
])
?
$params
[
'marketing_id'
]
:
''
;
$goodsSkuId
=
!
empty
(
$params
[
'goods_sku_id'
])
?
$params
[
'goods_sku_id'
]
:
''
;
$content
=
$userId
.
'_'
.
$marketingId
.
'_'
.
$goodsSkuId
;
// print_r( $marketingList);
if
(
empty
(
$userId
))
{
throw
new
DistributorException
([
'cus'
=>
14
]);
}
// die();
if
(
empty
(
$marketingId
))
{
throw
new
DistributorException
([
'cus'
=>
15
]);
}
if
(
empty
(
$goodsSkuId
))
{
throw
new
DistributorException
([
'cus'
=>
16
]);
}
$distributionList
=
MarketingGoodsService
::
marketingGoodsList
(
$params
);
print_r
(
$distributionList
);
die
();
$goodsShareId
=
Aes
::
encrypt
(
$content
);
$this
->
success
(
$distributionList
);
$data
[
'goods_share_id'
]
=
$goodsShareId
;
$result
=
[
'result'
=>
$data
];
$this
->
success
(
$result
);
}
}
...
...
application/services/marketing/MarketingGoodsService.php
View file @
e2dcf593
...
@@ -15,8 +15,14 @@ class MarketingGoodsService
...
@@ -15,8 +15,14 @@ class MarketingGoodsService
{
{
public
static
function
marketingGoodsList
(
$params
)
public
static
function
marketingGoodsList
(
$params
)
{
{
$params
[
'page'
]
=
!
empty
(
$params
[
'page'
])
?
$params
[
'page'
]
:
1
;
$limit
=
!
empty
(
$params
[
'page_size'
])
?
$params
[
'page_size'
]
:
20
;
$page
=
(
$params
[
'page'
]
-
1
)
*
$limit
;
$where
[
'LIMIT'
]
=
[
$page
,
$limit
];
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
$where
=
[];
$marketingWhere
=
[
$marketingWhere
=
[
"end_time[>]"
=>
date
(
"Y-m-d"
),
"end_time[>]"
=>
date
(
"Y-m-d"
),
"online_status"
=>
1
,
"online_status"
=>
1
,
...
@@ -28,51 +34,39 @@ class MarketingGoodsService
...
@@ -28,51 +34,39 @@ class MarketingGoodsService
$goodsSkuId
=
array_column
(
$data
,
'goods_sku_id'
);
$goodsSkuId
=
array_column
(
$data
,
'goods_sku_id'
);
$goodsSkuList
=
GoodsSku
::
getRecordMaster
([
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
GoodsSku
::
getRecordMaster
([
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
array_column
(
$goodsSkuList
,
null
,
'goods_sku_id'
);
$goodsSkuList
=
array_column
(
$goodsSkuList
,
null
,
'goods_sku_id'
);
$lastData
=
end
(
$data
);
$lastId
=
!
empty
(
$lastData
[
'id'
])
?
$lastData
[
'id'
]
:
''
;
$shopId
=
[];
$shopId
=
[];
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
$shopId
[
$key
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
]
:
''
;
$shopId
[
$key
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
]
:
''
;
}
}
$subShopList
=
SubShop
::
getRecordMaster
([
'shop_id'
=>
$shopId
]);
$subShopList
=
array_column
(
$subShopList
,
null
,
'shop_id'
);
$subShopList
=
SubShop
::
getRecords
([
'shop_id'
=>
$shopId
]);
print_r
(
$subShopList
);
die
();
$list
=
[];
$list
=
[];
$i
=
0
;
foreach
(
$data
as
$key
=>
$value
)
{
foreach
(
$data
as
$key
=>
$value
)
{
$list
[
$key
]
=
$value
;
$list
[
$i
]
=
$value
;
$list
[
$key
][
'life_account_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
]
:
''
;
$list
[
$i
][
'life_account_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
]
:
''
;
$list
[
$key
][
'shop_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
]
:
''
;
$list
[
$i
][
'shop_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'shop_id'
]
:
''
;
$list
[
$key
][
'goods_name'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'name'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'name'
]
:
''
;
$list
[
$i
][
'goods_name'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'name'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'name'
]
:
''
;
$list
[
$key
][
'goods_desc'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'desc'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'desc'
]
:
''
;
$list
[
$i
][
'goods_desc'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'desc'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'desc'
]
:
''
;
$list
[
$key
][
'goods_spu_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'goods_spu_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'goods_spu_id'
]
:
''
;
$list
[
$i
][
'goods_spu_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'goods_spu_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'goods_spu_id'
]
:
''
;
$list
[
$key
][
'original_price'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'original_price'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'original_price'
]
:
''
;
$list
[
$i
][
'original_price'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'original_price'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'original_price'
]
:
''
;
$list
[
$key
][
'price'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'price'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'price'
]
:
''
;
$list
[
$i
][
'price'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'price'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'price'
]
:
''
;
$list
[
$key
][
'total_amount_order'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'total_amount_order'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'total_amount_order'
]
:
''
;
$list
[
$i
][
'total_amount_order'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'total_amount_order'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'total_amount_order'
]
:
''
;
$list
[
$key
][
'url'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'url'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'url'
]
:
''
;
$list
[
$i
][
'url'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'url'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'url'
]
:
''
;
$shopId
=
!
empty
(
$list
[
$i
][
'shop_id'
])
?
$list
[
$i
][
'shop_id'
]
:
''
;
$shopId
=
!
empty
(
$list
[
$key
][
'shop_id'
])
?
$list
[
$key
][
'shop_id'
]
:
''
;
$list
[
$i
][
'shop_name'
]
=
!
empty
(
$subShopList
[
$shopId
][
'name'
])
?
$subShopList
[
$shopId
][
'name'
]
:
''
;
$i
++
;
}
}
$result
=
[
'result'
=>
$list
,
'last_id'
=>
$lastId
];
return
$result
;
return
$list
;
}
}
}
}
...
...
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