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
54810771
Commit
54810771
authored
Aug 19, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
update: 处理冲突
parents
c8f3979a
e2c94e70
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
96 additions
and
4 deletions
+96
-4
Goods.php
application/modules/Goods/controllers/Goods.php
+10
-0
Marketingfororder.php
...ation/modules/Marketing/controllers/Marketingfororder.php
+11
-2
GoodsService.php
application/services/goods/GoodsService.php
+26
-0
MarketingPindanGoodsService.php
application/services/goods/MarketingPindanGoodsService.php
+4
-0
MarketingForOrderService.php
application/services/marketing/MarketingForOrderService.php
+2
-2
MarketingService.php
application/services/marketing/MarketingService.php
+43
-0
No files found.
application/modules/Goods/controllers/Goods.php
View file @
54810771
...
@@ -314,4 +314,14 @@ class GoodsController extends Base
...
@@ -314,4 +314,14 @@ class GoodsController extends Base
$res
=
GoodsSnapshotsService
::
pindanGoodsSnapshots
(
$this
->
params
);
$res
=
GoodsSnapshotsService
::
pindanGoodsSnapshots
(
$this
->
params
);
$this
->
success
([
"result"
=>
$res
]);
$this
->
success
([
"result"
=>
$res
]);
}
}
/**
* 通过goods_sku_id 获取 拼单商品的ota信息
* @throws Exception
*/
public
function
take_place_by_goods_sku_idsAction
()
{
$res
=
GoodsService
::
getOtaInfoByGoodsSkuIds
(
$this
->
params
);
$this
->
success
([
"result"
=>
$res
]);
}
}
}
\ No newline at end of file
application/modules/Marketing/controllers/Marketingfororder.php
View file @
54810771
...
@@ -34,8 +34,17 @@ class MarketingfororderController extends Base
...
@@ -34,8 +34,17 @@ class MarketingfororderController extends Base
public
function
take_place_listAction
()
public
function
take_place_listAction
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
$data
=
MarketingForOrderService
::
getMarketingTakePlaceList
(
$params
);
$this
->
success
([
"result"
=>
$data
]);
$takePlaceList
=
MarketingForOrderService
::
getMarketingTakePlaceList
(
$params
);
$addressList
=
[];
//
if
(
!
empty
(
$takePlaceList
))
$addressList
=
array_unique
(
array_column
(
$takePlaceList
,
'address'
));
//
$this
->
success
([
"result"
=>
[
'take_place_list'
=>
$takePlaceList
,
'address_list'
=>
$addressList
]]);
}
}
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
54810771
...
@@ -20,6 +20,7 @@ use App\Models\goods\mysql\GoodsSkuSubShop;
...
@@ -20,6 +20,7 @@ use App\Models\goods\mysql\GoodsSkuSubShop;
use
App\Models\goods\mysql\GoodsSnapshot
;
use
App\Models\goods\mysql\GoodsSnapshot
;
use
App\Models\goods\mysql\GoodsSpu
;
use
App\Models\goods\mysql\GoodsSpu
;
use
App\Models\goods\mysql\LifeAccountShopNum
;
use
App\Models\goods\mysql\LifeAccountShopNum
;
use
App\Models\goods\mysql\Ota
;
use
App\Models\goods\mysql\PaySuccessGoodsCallbackRecord
;
use
App\Models\goods\mysql\PaySuccessGoodsCallbackRecord
;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\goods\mysql\Shop
;
use
App\Models\goods\mysql\Shop
;
...
@@ -1717,4 +1718,29 @@ class GoodsService
...
@@ -1717,4 +1718,29 @@ class GoodsService
}
}
return
true
;
return
true
;
}
}
/**
* 通过goods_sku_id 获取 拼单商品的ota信息
* @param array $params
* @return array
*/
public
static
function
getOtaInfoByGoodsSkuIds
(
$params
=
[])
{
$data
=
[];
$goodsSkuIds
=
empty
(
$params
[
"goods_sku_ids"
])
?
[]
:
$params
[
"goods_sku_ids"
];
if
(
!
empty
(
$goodsSkuIds
))
{
$pindanGoodsSkus
=
PindanGoodsSku
::
select
([
"goods_sku_id"
,
"ota_id"
],
[
"goods_sku_id"
=>
$goodsSkuIds
]);
$otaIds
=
array_column
(
$pindanGoodsSkus
,
"ota_id"
);
$otaInfos
=
Ota
::
select
(
"*"
,
[
"ota_id"
=>
$otaIds
]);
$otaIds
=
array_column
(
$otaInfos
,
"ota_id"
);
$otaInfos
=
array_column
(
$otaInfos
,
null
,
"ota_id"
);
foreach
(
$pindanGoodsSkus
as
$sku
)
{
if
(
in_array
(
$sku
[
"ota_id"
],
$otaIds
))
{
$data
[
$sku
[
"goods_sku_id"
]]
=
$otaInfos
[
$sku
[
"ota_id"
]];
}
}
}
return
$data
;
}
}
}
\ No newline at end of file
application/services/goods/MarketingPindanGoodsService.php
View file @
54810771
...
@@ -143,6 +143,7 @@ class MarketingPindanGoodsService
...
@@ -143,6 +143,7 @@ class MarketingPindanGoodsService
"goods_name"
=>
$spuData
[
"marketing_name"
],
"goods_name"
=>
$spuData
[
"marketing_name"
],
"desc_pic_url"
=>
$spuData
[
"desc_pic_url"
],
"desc_pic_url"
=>
$spuData
[
"desc_pic_url"
],
"desc"
=>
$spuData
[
"desc"
],
"desc"
=>
$spuData
[
"desc"
],
"rule_limit"
=>
empty
(
$skuData
[
"rule_limit"
])
?
0
:
$skuData
[
"rule_limit"
],
"goods_type"
=>
empty
(
$spuData
[
"goods_type"
])
?
GoodsSpu
::
TYPE_ENTITY
:
$spuData
[
"goods_type"
],
"goods_type"
=>
empty
(
$spuData
[
"goods_type"
])
?
GoodsSpu
::
TYPE_ENTITY
:
$spuData
[
"goods_type"
],
"goods_sub_type"
=>
empty
(
$spuData
[
"goods_sub_type"
])
?
GoodsSpu
::
SUB_TYPE_INSTANT
:
$spuData
[
"goods_sub_type"
],
"goods_sub_type"
=>
empty
(
$spuData
[
"goods_sub_type"
])
?
GoodsSpu
::
SUB_TYPE_INSTANT
:
$spuData
[
"goods_sub_type"
],
"belong_type"
=>
empty
(
$spuData
[
"belong_type"
])
?
GoodsSpu
::
BELONG_TYPE_DISANFANG
:
$spuData
[
"belong_type"
],
"belong_type"
=>
empty
(
$spuData
[
"belong_type"
])
?
GoodsSpu
::
BELONG_TYPE_DISANFANG
:
$spuData
[
"belong_type"
],
...
@@ -202,6 +203,7 @@ class MarketingPindanGoodsService
...
@@ -202,6 +203,7 @@ class MarketingPindanGoodsService
"goods_name"
=>
$skuData
[
"goods_name"
],
"goods_name"
=>
$skuData
[
"goods_name"
],
"desc_pic_url"
=>
$skuData
[
"desc_pic_url"
],
"desc_pic_url"
=>
$skuData
[
"desc_pic_url"
],
"desc"
=>
$skuData
[
"desc"
],
"desc"
=>
$skuData
[
"desc"
],
"rule_limit"
=>
empty
(
$skuData
[
"rule_limit"
])
?
0
:
$skuData
[
"rule_limit"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"original_price"
=>
empty
(
$skuData
[
"original_price"
])
?
""
:
$skuData
[
"original_price"
]
*
100
,
"original_price"
=>
empty
(
$skuData
[
"original_price"
])
?
""
:
$skuData
[
"original_price"
]
*
100
,
...
@@ -267,6 +269,7 @@ class MarketingPindanGoodsService
...
@@ -267,6 +269,7 @@ class MarketingPindanGoodsService
return
GoodsSpu
::
save
([
return
GoodsSpu
::
save
([
"desc_pic_url"
=>
$params
[
"desc_pic_url"
],
"desc_pic_url"
=>
$params
[
"desc_pic_url"
],
"desc"
=>
$params
[
"desc"
],
"desc"
=>
$params
[
"desc"
],
"rule_limit"
=>
empty
(
$params
[
"rule_limit"
])
?
0
:
$params
[
"rule_limit"
],
],
[
"goods_spu_id"
=>
$goodsSpu
[
"goods_spu_id"
]]);
],
[
"goods_spu_id"
=>
$goodsSpu
[
"goods_spu_id"
]]);
}
}
...
@@ -313,6 +316,7 @@ class MarketingPindanGoodsService
...
@@ -313,6 +316,7 @@ class MarketingPindanGoodsService
"goods_name"
=>
$params
[
"goods_name"
],
"goods_name"
=>
$params
[
"goods_name"
],
"desc_pic_url"
=>
$params
[
"desc_pic_url"
],
"desc_pic_url"
=>
$params
[
"desc_pic_url"
],
"desc"
=>
$params
[
"desc"
],
"desc"
=>
$params
[
"desc"
],
"rule_limit"
=>
empty
(
$params
[
"rule_limit"
])
?
0
:
$params
[
"rule_limit"
],
"inventory_total"
=>
$inventoryTotal
,
"inventory_total"
=>
$inventoryTotal
,
"ota_id"
=>
empty
(
$params
[
"ota_id"
])
?
0
:
$params
[
"ota_id"
],
"ota_id"
=>
empty
(
$params
[
"ota_id"
])
?
0
:
$params
[
"ota_id"
],
"inventory_rest"
=>
$inventoryCount
,
"inventory_rest"
=>
$inventoryCount
,
...
...
application/services/marketing/MarketingForOrderService.php
View file @
54810771
...
@@ -58,10 +58,10 @@ class MarketingForOrderService
...
@@ -58,10 +58,10 @@ class MarketingForOrderService
$takePlaceList
=
[];
$takePlaceList
=
[];
if
(
!
empty
(
$takePlaceIdList
))
{
if
(
!
empty
(
$takePlaceIdList
))
{
$takePlaceIdArr
=
array_column
(
$takePlaceIdList
,
"take_place_id"
);
$takePlaceIdArr
=
array_column
(
$takePlaceIdList
,
"take_place_id"
);
$takePlaceList
=
TakePlace
::
select
([
"take_place_id"
,
"take_place_name"
,
"create_time"
],
[
"take_place_id"
=>
$takePlaceIdArr
]);
$takePlaceList
=
TakePlace
::
select
([
"take_place_id"
,
"take_place_name"
,
"create_time"
,
"address"
],
[
"take_place_id"
=>
$takePlaceIdArr
]);
}
}
}
else
{
}
else
{
$takePlaceList
=
TakePlace
::
select
([
"take_place_id"
,
"take_place_name"
,
"create_time"
]);
$takePlaceList
=
TakePlace
::
select
([
"take_place_id"
,
"take_place_name"
,
"create_time"
,
"address"
]);
}
}
return
$takePlaceList
;
return
$takePlaceList
;
}
}
...
...
application/services/marketing/MarketingService.php
View file @
54810771
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
namespace
App\Services\marketing
;
namespace
App\Services\marketing
;
use
Api\PhpServices\Ksy\Ks3Api
;
use
Api\PhpServices\Ksy\Ks3Api
;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Exception\custom\InterfaceException
;
use
App\Models\goods\mysql\Ota
;
use
App\Models\goods\mysql\Ota
;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\Marketing
;
...
@@ -945,6 +947,15 @@ class MarketingService
...
@@ -945,6 +947,15 @@ class MarketingService
$info
[
'marketing_info'
]
=
$marketingData
;
$info
[
'marketing_info'
]
=
$marketingData
;
//有用户登录时候,当前用户购买的商品数量信息
$haveBuyGoodsStatistics
=
[];
if
(
!
empty
(
$params
[
"user_id"
]))
{
$haveBuyGoodsStatistics
=
self
::
getHaveBuyGoodsStatistics
([
"user_id"
=>
$params
[
"user_id"
],
"marketing_id"
=>
$marketingData
[
"id"
]]);
}
//活动中所有购买的商品数量信息
$allHaveBuyGoodsStatistics
=
self
::
getHaveBuyGoodsStatistics
([
"marketing_id"
=>
$marketingData
[
"id"
]]);
if
(
!
empty
(
$goodsSkuList
))
{
if
(
!
empty
(
$goodsSkuList
))
{
$otaIds
=
array_unique
(
array_column
(
$goodsSkuList
,
"ota_id"
));
$otaIds
=
array_unique
(
array_column
(
$goodsSkuList
,
"ota_id"
));
$otas
=
Ota
::
select
([
"ota_id"
,
"ota_name"
],
[
"ota_id"
=>
$otaIds
]);
$otas
=
Ota
::
select
([
"ota_id"
,
"ota_name"
],
[
"ota_id"
=>
$otaIds
]);
...
@@ -957,6 +968,18 @@ class MarketingService
...
@@ -957,6 +968,18 @@ class MarketingService
$goodsSkuList
[
$key
][
"ota_name"
]
=
empty
(
$otasData
[
$item
[
"ota_id"
]][
"ota_name"
])
?
""
:
$otasData
[
$item
[
"ota_id"
]][
"ota_name"
];
$goodsSkuList
[
$key
][
"ota_name"
]
=
empty
(
$otasData
[
$item
[
"ota_id"
]][
"ota_name"
])
?
""
:
$otasData
[
$item
[
"ota_id"
]][
"ota_name"
];
$goodsSkuList
[
$key
][
"original_price"
]
=
empty
(
$item
[
"original_price"
])
?
''
:
sprintf
(
"%.2f"
,
(
int
)
$item
[
"original_price"
]
/
100
);
$goodsSkuList
[
$key
][
"original_price"
]
=
empty
(
$item
[
"original_price"
])
?
''
:
sprintf
(
"%.2f"
,
(
int
)
$item
[
"original_price"
]
/
100
);
$goodsSkuList
[
$key
][
"price"
]
=
sprintf
(
"%.2f"
,
$item
[
"price"
]
/
100
);
$goodsSkuList
[
$key
][
"price"
]
=
sprintf
(
"%.2f"
,
$item
[
"price"
]
/
100
);
$goodsSkuList
[
$key
][
"have_buy_goods_count"
]
=
0
;
//前端当前登录人的数据
$haveBuyGoodsSkuIds
=
array_keys
(
$haveBuyGoodsStatistics
);
if
(
in_array
(
$item
[
"goods_sku_id"
],
$haveBuyGoodsSkuIds
))
{
$goodsSkuList
[
$key
][
"have_buy_goods_count"
]
=
$haveBuyGoodsStatistics
[
$item
[
"goods_sku_id"
]];
}
//后台展示所有购买的数量
$allHaveBuyGoodsSkuIds
=
array_keys
(
$allHaveBuyGoodsStatistics
);
if
(
in_array
(
$item
[
"goods_sku_id"
],
$allHaveBuyGoodsSkuIds
))
{
$goodsSkuList
[
$key
][
"all_have_buy_goods_count"
]
=
$allHaveBuyGoodsStatistics
[
$item
[
"goods_sku_id"
]];
}
}
}
}
}
...
@@ -1014,4 +1037,24 @@ class MarketingService
...
@@ -1014,4 +1037,24 @@ class MarketingService
"count"
=>
$count
]],
[]);
"count"
=>
$count
]],
[]);
return
$res
[
'id_snow'
][
$type
]
??
[];
return
$res
[
'id_snow'
][
$type
]
??
[];
}
}
/**
* 指定活动的已购买商品统计
* @param array $params
* @return array|mixed
* @throws InterfaceException
*/
public
static
function
getHaveBuyGoodsStatistics
(
$params
=
[])
{
$url
=
config
(
'interface'
,
'order.order.have_buy_order_statistics'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
0
]);
}
$res
=
HttpUtil
::
get
(
$url
,
$params
);
$data
=
[];
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
][
"result"
]))
{
$data
=
$res
[
"response"
][
"result"
];
}
return
$data
;
}
}
}
\ 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