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
2b83f128
Commit
2b83f128
authored
Aug 05, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jielong' of
https://gitlab.yidian-inc.com/bp/goods
into jielong
parents
8b578481
c2fc4ee1
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
146 additions
and
136 deletions
+146
-136
TakePlace.php
application/models/marketing/mysql/TakePlace.php
+1
-1
Goods.php
application/modules/Goods/controllers/Goods.php
+9
-4
Ota.php
application/modules/Goods/controllers/Ota.php
+1
-1
Spell.php
application/modules/Marketing/controllers/Spell.php
+0
-64
Takeplace.php
application/modules/Marketing/controllers/Takeplace.php
+2
-2
GoodsService.php
application/services/goods/GoodsService.php
+19
-1
MarketingPindanGoodsService.php
application/services/goods/MarketingPindanGoodsService.php
+54
-1
OtaService.php
application/services/goods/OtaService.php
+1
-1
MarketingService.php
application/services/marketing/MarketingService.php
+36
-21
Tcc2Service.php
application/services/tcc/Tcc2Service.php
+22
-39
Goods.php
daemon/Goods.php
+1
-1
No files found.
application/models/marketing/mysql/TakePlace.php
View file @
2b83f128
...
@@ -43,8 +43,8 @@ class TakePlace extends MysqlBase
...
@@ -43,8 +43,8 @@ class TakePlace extends MysqlBase
$where
[
'ORDER'
]
=
[
'take_place_id'
=>
'DESC'
];
$where
[
'ORDER'
]
=
[
'take_place_id'
=>
'DESC'
];
$where
[
'LIMIT'
]
=
[
$offset
,
$limit
];
$where
[
'LIMIT'
]
=
[
$offset
,
$limit
];
// $e = TakePlace::debug();
$res
[
'list'
]
=
self
::
select
(
'*'
,
$where
);
$res
[
'list'
]
=
self
::
select
(
'*'
,
$where
);
unset
(
$where
[
'ORDER'
],
$where
[
'LIMIT'
]);
$res
[
'total'
]
=
self
::
count
(
'*'
,
$where
);
$res
[
'total'
]
=
self
::
count
(
'*'
,
$where
);
return
$res
;
return
$res
;
...
...
application/modules/Goods/controllers/Goods.php
View file @
2b83f128
...
@@ -16,6 +16,7 @@ use \Validate\PaySuccessGoodsCallbackValidate;
...
@@ -16,6 +16,7 @@ use \Validate\PaySuccessGoodsCallbackValidate;
use
\Validate\GoodsInitShopValidate
;
use
\Validate\GoodsInitShopValidate
;
use
\App\Services\goods\ElasticGoodService
;
use
\App\Services\goods\ElasticGoodService
;
use
\App\Services\goods\MarketingPindanGoodsService
;
use
\App\Services\goods\MarketingPindanGoodsService
;
use
\App\Models\marketing\mysql\Marketing
;
class
GoodsController
extends
Base
class
GoodsController
extends
Base
...
@@ -46,14 +47,18 @@ class GoodsController extends Base
...
@@ -46,14 +47,18 @@ class GoodsController extends Base
public
function
addAction
()
public
function
addAction
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
if
(
!
empty
(
$params
[
"marketing_type"
])
&&
$params
[
"marketing_type"
]
==
\App\Models\marketing\mysql\
Marketing
::
MARKETING_TYPE_PINDAN
)
{
if
(
!
empty
(
$params
[
"marketing_type"
])
&&
$params
[
"marketing_type"
]
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
}
else
{
}
else
{
(
new
GoodsAddValidate
())
->
validate
();
(
new
GoodsAddValidate
())
->
validate
();
}
}
GoodsService
::
addGoods
(
$params
);
$res
=
GoodsService
::
addGoods
(
$params
);
$this
->
success
();
if
(
!
empty
(
$params
[
"marketing_type"
])
&&
$params
[
"marketing_type"
]
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
$this
->
success
([
"result"
=>
$res
]);
}
else
{
$this
->
success
();
}
}
}
/**
/**
...
@@ -62,7 +67,7 @@ class GoodsController extends Base
...
@@ -62,7 +67,7 @@ class GoodsController extends Base
public
function
editAction
()
public
function
editAction
()
{
{
$params
=
$this
->
params
;
$params
=
$this
->
params
;
if
(
!
empty
(
$params
[
"marketing_type"
])
&&
$params
[
"marketing_type"
]
==
\App\Models\marketing\mysql\
Marketing
::
MARKETING_TYPE_PINDAN
)
{
if
(
!
empty
(
$params
[
"marketing_type"
])
&&
$params
[
"marketing_type"
]
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
}
else
{
}
else
{
(
new
GoodsEditValidate
())
->
validate
();
(
new
GoodsEditValidate
())
->
validate
();
...
...
application/modules/Goods/controllers/Ota.php
View file @
2b83f128
...
@@ -26,7 +26,7 @@ class OtaController extends Base
...
@@ -26,7 +26,7 @@ class OtaController extends Base
$limit
=
$this
->
params
[
'limit'
]
??
20
;
$limit
=
$this
->
params
[
'limit'
]
??
20
;
$res
=
OtaService
::
list
(
$name
,
$printerSn
,
$printerKey
,
$offset
,
$limit
);
$res
=
OtaService
::
list
(
$name
,
$printerSn
,
$printerKey
,
$offset
,
$limit
);
$this
->
success
([
'
data
'
=>
$res
]);
$this
->
success
([
'
result
'
=>
$res
]);
}
}
/**
/**
...
...
application/modules/Marketing/controllers/Spell.php
deleted
100644 → 0
View file @
8b578481
<?php
/**
* Author : Tengda
* Date : 2021/7/29
* Time : 17:59 下午
*/
use
App\Base\Base
;
//use App\Services\marketing\SpellService;
//use \Validate\Spell\detailValidate;
class
SpellController
extends
Base
{
public
function
detailAction
()
{
// (new detailValidate())->validate();
//
// $name = $this->params['name'] ?? '';
// $printerSn = $this->params['printer_sn'] ?? '';
// $printerKey = $this->params['printer_key'] ?? '';
// $offset = $this->params['offset'] ?? 0;
// $limit = $this->params['limit'] ?? 20;
// $res = TakePlaceService::list($name,$printerSn,$printerKey,$offset,$limit);
$data
=
[
'detail'
=>
[],
];
$this
->
success
([
'data'
=>
$data
]);
}
public
function
listAction
()
{
$data
=
[
'list'
=>
[
[
'uid'
=>
123
,
'username'
=>
'aaa'
,
'avator'
=>
'aaaaaa.jpg'
,
'id'
=>
1
,
'name'
=>
'一起拼一定赢'
,
'desc'
=>
'吃喝玩乐'
,
'create_time'
=>
'2021-07-29 20:03:08'
,
'sold_num'
=>
123
,
'min_price'
=>
15
,
'max_price'
=>
89
,
],
[
'uid'
=>
234
,
'username'
=>
'bbbbb'
,
'avator'
=>
'aaaaaa1.jpg'
,
'id'
=>
1
,
'name'
=>
'俺是打款就'
,
'desc'
=>
'吃喝玩乐'
,
'create_time'
=>
'2021-07-29 20:03:08'
,
'sold_num'
=>
345
,
'min_price'
=>
13
,
'max_price'
=>
99
,
]
],
'total'
=>
2
];
$this
->
success
([
'data'
=>
$data
]);
}
}
\ No newline at end of file
application/modules/Marketing/controllers/Takeplace.php
View file @
2b83f128
...
@@ -25,7 +25,7 @@ class TakePlaceController extends Base {
...
@@ -25,7 +25,7 @@ class TakePlaceController extends Base {
$limit
=
$this
->
params
[
'limit'
]
??
20
;
$limit
=
$this
->
params
[
'limit'
]
??
20
;
$res
=
TakePlaceService
::
searchList
(
$keywords
,
$offset
,
$limit
);
$res
=
TakePlaceService
::
searchList
(
$keywords
,
$offset
,
$limit
);
$this
->
success
([
'
data
'
=>
$res
]);
$this
->
success
([
'
result
'
=>
$res
]);
}
}
/**
/**
...
@@ -68,7 +68,7 @@ class TakePlaceController extends Base {
...
@@ -68,7 +68,7 @@ class TakePlaceController extends Base {
$data
=
TakePlaceService
::
getPindanTakePlaceList
(
$marketingPindanId
,
$offset
,
$limit
);
$data
=
TakePlaceService
::
getPindanTakePlaceList
(
$marketingPindanId
,
$offset
,
$limit
);
$this
->
success
([
'
data
'
=>
$data
]);
$this
->
success
([
'
result
'
=>
$data
]);
}
}
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
2b83f128
...
@@ -860,6 +860,22 @@ class GoodsService
...
@@ -860,6 +860,22 @@ class GoodsService
* @throws GoodsException
* @throws GoodsException
*/
*/
public
static
function
getGoodsSkuInfo
(
$params
=
[])
public
static
function
getGoodsSkuInfo
(
$params
=
[])
{
$marketingType
=
!
empty
(
$params
[
'marketing_type'
])
?
$params
[
'marketing_type'
]
:
0
;
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
return
MarketingPindanGoodsService
::
pindanGoodsInfo
(
$params
);
}
else
{
return
self
::
generalGoodsInfo
(
$params
);
}
}
/**
* 普通商品详情,通过sku_id查询
* @param $params
* @return array
* @throws GoodsException
*/
private
static
function
generalGoodsInfo
(
$params
)
{
{
$data
=
[];
$data
=
[];
$sku
=
GoodsSku
::
get
([
"life_account_id"
,
"goods_sku_id"
,
"category_1_id"
,
"category_2_id"
,
"goods_name"
,
$sku
=
GoodsSku
::
get
([
"life_account_id"
,
"goods_sku_id"
,
"category_1_id"
,
"category_2_id"
,
"goods_name"
,
...
@@ -1529,7 +1545,9 @@ class GoodsService
...
@@ -1529,7 +1545,9 @@ class GoodsService
}
}
$ids
=
GoodsSkuPicRecord
::
select
(
"id"
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
$ids
=
GoodsSkuPicRecord
::
select
(
"id"
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
GoodsSkuPicRecord
::
delete
([
"id"
=>
$ids
]);
if
(
!
empty
(
$ids
))
{
GoodsSkuPicRecord
::
delete
([
"id"
=>
$ids
]);
}
$urlList
=
array_unique
(
array_merge
(
$descPicUrl
,
$introducePicUrl
));
$urlList
=
array_unique
(
array_merge
(
$descPicUrl
,
$introducePicUrl
));
$data
=
[];
$data
=
[];
...
...
application/services/goods/MarketingPindanGoodsService.php
View file @
2b83f128
...
@@ -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\PindanGoodsSnapshot
;
use
App\Models\goods\mysql\PindanGoodsSnapshot
;
...
@@ -74,7 +75,21 @@ class MarketingPindanGoodsService
...
@@ -74,7 +75,21 @@ class MarketingPindanGoodsService
GoodsSpu
::
rollback
();
GoodsSpu
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
0
]);
throw
new
GoodsException
([
"cus"
=>
0
]);
}
}
return
$skuId
;
$sku
=
PindanGoodsSku
::
getRecordMaster
([
"goods_sku_id"
=>
$skuId
]);
$data
=
[];
if
(
!
empty
(
$sku
[
0
]))
{
$sku
=
$sku
[
0
];
$data
[
"goods_info"
]
=
$sku
;
$data
[
"goods_info"
][
"original_price"
]
=
empty
(
$sku
[
"original_price"
])
?
''
:
(
string
)(
$sku
[
"original_price"
]
/
100
);
$data
[
"goods_info"
][
"price"
]
=
$sku
[
"price"
]
/
100
;
$data
[
"goods_info"
][
"desc_pic_url_list"
]
=
[];
if
(
!
empty
(
$sku
[
"desc_pic_url"
]))
{
$ksyun
=
GoodsService
::
getUrlList
(
$sku
[
"desc_pic_url"
]);
$data
[
"goods_info"
][
"desc_pic_url_list"
]
=
$ksyun
;
}
}
return
$data
;
}
}
/**
/**
...
@@ -359,14 +374,52 @@ class MarketingPindanGoodsService
...
@@ -359,14 +374,52 @@ class MarketingPindanGoodsService
$where
[
'ORDER'
]
=
[
"update_time"
=>
"DESC"
];
$where
[
'ORDER'
]
=
[
"update_time"
=>
"DESC"
];
$list
=
PindanGoodsSku
::
select
(
"*"
,
$where
);
$list
=
PindanGoodsSku
::
select
(
"*"
,
$where
);
$otaData
=
[];
if
(
!
empty
(
$list
))
{
$otaIds
=
array_unique
(
array_column
(
$list
,
"ota_id"
));
$otaList
=
Ota
::
select
([
"ota_id"
,
"ota_name"
],
[
"ota_id"
=>
$otaIds
]);
if
(
!
empty
(
$otaList
))
{
foreach
(
$otaList
as
$item
)
{
$otaData
[
$item
[
"ota_id"
]]
=
$item
;
}
}
}
$count
=
PindanGoodsSku
::
count
(
"*"
,
$where
);
$count
=
PindanGoodsSku
::
count
(
"*"
,
$where
);
if
(
!
empty
(
$list
))
{
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$key
=>
$item
)
{
foreach
(
$list
as
$key
=>
$item
)
{
$list
[
$key
][
"original_price"
]
=
$item
[
"original_price"
]
/
100
;
$list
[
$key
][
"original_price"
]
=
$item
[
"original_price"
]
/
100
;
$list
[
$key
][
"price"
]
=
$item
[
"price"
]
/
100
;
$list
[
$key
][
"price"
]
=
$item
[
"price"
]
/
100
;
if
(
!
empty
(
$otaData
)
&&
!
empty
(
$otaData
[
$item
[
"ota_id"
]]))
{
$list
[
$key
][
"ota_name"
]
=
$otaData
[
$item
[
"ota_id"
]][
"ota_name"
];
}
}
}
}
}
return
[
"list"
=>
$list
,
"count"
=>
$count
];
return
[
"list"
=>
$list
,
"count"
=>
$count
];
}
}
/**
* 获取拼单商品详情
* @param $params
* @return array
* @throws GoodsException
*/
public
static
function
pindanGoodsInfo
(
$params
)
{
$data
=
[];
$sku
=
PindanGoodsSku
::
get
(
"*"
,
[
"goods_sku_id"
=>
$params
[
"goods_sku_id"
]]);
if
(
empty
(
$sku
))
{
throw
new
GoodsException
([
"cus"
=>
15
]);
}
$data
[
"goods_info"
]
=
$sku
;
$data
[
"goods_info"
][
"original_price"
]
=
empty
(
$sku
[
"original_price"
])
?
''
:
(
string
)(
$sku
[
"original_price"
]
/
100
);
$data
[
"goods_info"
][
"price"
]
=
$sku
[
"price"
]
/
100
;
$data
[
"goods_info"
][
"desc_pic_url_list"
]
=
[];
if
(
!
empty
(
$sku
[
"desc_pic_url"
]))
{
$ksyun
=
GoodsService
::
getUrlList
(
$sku
[
"desc_pic_url"
]);
$data
[
"goods_info"
][
"desc_pic_url_list"
]
=
$ksyun
;
}
return
$data
;
}
}
}
\ No newline at end of file
application/services/goods/OtaService.php
View file @
2b83f128
...
@@ -27,8 +27,8 @@ class OtaService
...
@@ -27,8 +27,8 @@ class OtaService
$where
[
'ORDER'
]
=
[
'ota_id'
=>
'DESC'
];
$where
[
'ORDER'
]
=
[
'ota_id'
=>
'DESC'
];
$where
[
'LIMIT'
]
=
[
$offset
,
$limit
];
$where
[
'LIMIT'
]
=
[
$offset
,
$limit
];
// $e = Ota::debug();
$res
[
'list'
]
=
Ota
::
select
(
self
::
COLUMNS
,
$where
);
$res
[
'list'
]
=
Ota
::
select
(
self
::
COLUMNS
,
$where
);
unset
(
$where
[
'ORDER'
],
$where
[
'LIMIT'
]);
$res
[
'total'
]
=
Ota
::
count
(
'*'
,
$where
);
$res
[
'total'
]
=
Ota
::
count
(
'*'
,
$where
);
return
$res
;
return
$res
;
...
...
application/services/marketing/MarketingService.php
View file @
2b83f128
...
@@ -234,29 +234,41 @@ class MarketingService
...
@@ -234,29 +234,41 @@ class MarketingService
"online_status"
,
"update_time"
,
"create_time"
]
"online_status"
,
"update_time"
,
"create_time"
]
,
$where
);
,
$where
);
$marketingIds
=
[];
$lists
=
[];
foreach
(
$list
as
$key
=>
$value
)
{
if
(
!
empty
(
$list
))
{
$marketingIds
[]
=
$value
[
"marketing_id"
];
$marketingIds
=
[];
}
foreach
(
$list
as
$key
=>
$value
)
{
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"min_price"
,
"max_price"
,
"pindan_desc"
]
$marketingIds
[]
=
$value
[
"marketing_id"
];
,
[
"marketing_id"
=>
$marketingIds
]);
$priceData
=
[];
if
(
!
empty
(
$marketingPindanData
))
{
foreach
(
$marketingPindanData
as
$item
)
{
$priceData
[
$item
[
"marketing_id"
]]
=
$item
;
}
}
}
$lists
=
[];
$marketingPindanData
=
MarketingPindan
::
select
([
"marketing_id"
,
"publish_life_account_id"
,
"min_price"
,
"max_price"
,
"pindan_desc"
]
foreach
(
$list
as
$key
=>
$value
)
{
,
[
"marketing_id"
=>
$marketingIds
]);
$lists
[
$key
]
=
$value
;
$priceData
=
[];
$lists
[
$key
][
"online_status_desc"
]
=
Marketing
::
$onlineStatusDesc
[
$value
[
"online_status"
]];
if
(
!
empty
(
$marketingPindanData
))
{
if
(
!
empty
(
$priceData
[
$value
[
"marketing_id"
]]))
{
foreach
(
$marketingPindanData
as
$item
)
{
$lists
[
$key
][
"min_price"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"min_price"
];
$priceData
[
$item
[
"marketing_id"
]]
=
$item
;
$lists
[
$key
][
"max_price"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
];
}
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
}
$publishLifeAccountIds
=
array_unique
(
array_column
(
$marketingPindanData
,
"publish_life_account_id"
));
$lifeAccountList
=
CommonService
::
getlifeAccountList
([
'life_account_id'
=>
$publishLifeAccountIds
]);
foreach
(
$list
as
$key
=>
$value
)
{
$lists
[
$key
]
=
$value
;
$lists
[
$key
][
"online_status_desc"
]
=
Marketing
::
$onlineStatusDesc
[
$value
[
"online_status"
]];
if
(
!
empty
(
$priceData
[
$value
[
"marketing_id"
]]))
{
$currentLifeAccountId
=
$priceData
[
$value
[
"marketing_id"
]][
"publish_life_account_id"
];
$lists
[
$key
][
"publish_life_account_id"
]
=
$currentLifeAccountId
;
if
(
!
empty
(
$lifeAccountList
[
$currentLifeAccountId
]))
{
$lists
[
$key
][
"life_account_icon"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_icon"
];
$lists
[
$key
][
"life_account_name"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_name"
];
}
$lists
[
$key
][
"min_price"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"min_price"
];
$lists
[
$key
][
"max_price"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
];
$lists
[
$key
][
"pindan_desc"
]
=
$priceData
[
$value
[
"marketing_id"
]][
"pindan_desc"
];
}
}
}
}
}
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'LIMIT'
]);
unset
(
$where
[
'ORDER'
]);
unset
(
$where
[
'ORDER'
]);
$count
=
Marketing
::
count
(
"*"
,
$where
);
$count
=
Marketing
::
count
(
"*"
,
$where
);
...
@@ -717,8 +729,11 @@ class MarketingService
...
@@ -717,8 +729,11 @@ class MarketingService
$goodsSkuId
=
array_column
(
$goodsSkuList
,
'goods_sku_id'
);
$goodsSkuId
=
array_column
(
$goodsSkuList
,
'goods_sku_id'
);
$goodsSkuList
=
PindanGoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
PindanGoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$marketingData
[
"life_account_name"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_name"
];
$marketingData
[
"life_account_name"
]
=
$marketingData
[
"life_account_icon"
]
=
""
;
$marketingData
[
"life_account_icon"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_icon"
];
if
(
!
empty
(
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]]))
{
$marketingData
[
"life_account_name"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_name"
];
$marketingData
[
"life_account_icon"
]
=
$lifeAccountList
[
$pindanMarketing
[
"publish_life_account_id"
]][
"life_account_icon"
];
}
$marketingData
[
"id"
]
=
$marketingInfo
[
"marketing_id"
];
$marketingData
[
"id"
]
=
$marketingInfo
[
"marketing_id"
];
$marketingData
[
"marketing_name"
]
=
$marketingInfo
[
"marketing_name"
];
$marketingData
[
"marketing_name"
]
=
$marketingInfo
[
"marketing_name"
];
$marketingData
[
"good_count"
]
=
$marketingInfo
[
"good_count"
];
$marketingData
[
"good_count"
]
=
$marketingInfo
[
"good_count"
];
...
...
application/services/tcc/Tcc2Service.php
View file @
2b83f128
...
@@ -26,13 +26,10 @@ class Tcc2Service
...
@@ -26,13 +26,10 @@ class Tcc2Service
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
=
$numList
=
[];
foreach
(
$goodsInfoList
as
$item
)
{
foreach
(
$goodsInfoList
as
$item
)
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
[]
=
$item
[
"goods_sku_id"
];
$numList
[
$item
[
"goods_sku_id"
]]
=
$item
[
"num"
];
}
}
$tccInfo
=
self
::
getTccRecord
(
$tid
);
$tccInfo
=
self
::
getTccRecord
(
$tid
);
...
@@ -46,19 +43,14 @@ class Tcc2Service
...
@@ -46,19 +43,14 @@ class Tcc2Service
return
self
::
TCC_RESULT_SUCCESS
;
return
self
::
TCC_RESULT_SUCCESS
;
}
}
$skus
=
GoodsSku
::
getRecords
([
"goods_sku_id"
=>
$goodsSkuIds
]
if
(
!
empty
(
$goodsInfoList
))
{
,
[
"goods_sku_id"
,
"inventory_rest"
,
"inventory_lock"
,
"online_status"
]);
if
(
!
empty
(
$skus
))
{
GoodsSku
::
beginTransaction
();
GoodsSku
::
beginTransaction
();
foreach
(
$skus
as
$sku
)
{
foreach
(
$goodsInfoList
as
$item
)
{
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$num
=
$item
[
"num"
];
$sku
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
,
[
"goods_sku_id"
,
"inventory_rest"
,
"inventory_lock"
,
"online_status"
]);
if
(
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
if
(
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
if
(
empty
(
$numList
[
$goodsSkuId
]))
{
return
self
::
TCC_RESULT_FAIL
;
}
$num
=
$numList
[
$goodsSkuId
];
//条件加上乐观锁
//条件加上乐观锁
$rowCount
=
GoodsSku
::
save
([
$rowCount
=
GoodsSku
::
save
([
"inventory_lock"
=>
$sku
[
"inventory_lock"
]
+
$num
,
"inventory_lock"
=>
$sku
[
"inventory_lock"
]
+
$num
,
...
@@ -92,7 +84,8 @@ class Tcc2Service
...
@@ -92,7 +84,8 @@ class Tcc2Service
* 下单 商品tcc confirm
* 下单 商品tcc confirm
* @param $keys
* @param $keys
* @param $tid
* @param $tid
* @return int
* @return bool
* @throws GoodsException
*/
*/
public
static
function
placeAnOrderConfirm
(
$keys
,
$tid
)
public
static
function
placeAnOrderConfirm
(
$keys
,
$tid
)
{
{
...
@@ -101,13 +94,10 @@ class Tcc2Service
...
@@ -101,13 +94,10 @@ class Tcc2Service
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
=
$numList
=
[];
foreach
(
$goodsInfoList
as
$item
)
{
foreach
(
$goodsInfoList
as
$item
)
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
[]
=
$item
[
"goods_sku_id"
];
$numList
[
$item
[
"goods_sku_id"
]]
=
$item
[
"num"
];
}
}
$tccInfo
=
self
::
getTccRecord
(
$tid
);
$tccInfo
=
self
::
getTccRecord
(
$tid
);
...
@@ -125,17 +115,15 @@ class Tcc2Service
...
@@ -125,17 +115,15 @@ class Tcc2Service
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$skus
=
GoodsSku
::
getRecords
([
"goods_sku_id"
=>
$goodsSkuIds
]
if
(
!
empty
(
$goodsInfoList
))
{
,
[
"goods_sku_id"
,
"total_amount_order"
,
"inventory_lock"
,
"online_status"
]);
if
(
!
empty
(
$skus
))
{
GoodsSku
::
beginTransaction
();
GoodsSku
::
beginTransaction
();
foreach
(
$skus
as
$sku
)
{
foreach
(
$goodsInfoList
as
$item
)
{
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$num
=
$item
[
"num"
];
$sku
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
,
[
"goods_sku_id"
,
"inventory_rest"
,
"total_amount_order"
,
"inventory_lock"
,
"online_status"
]);
if
(
!
empty
(
$sku
[
"inventory_lock"
])
&&
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
if
(
!
empty
(
$sku
[
"inventory_lock"
])
&&
$sku
[
"online_status"
]
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
if
(
empty
(
$numList
[
$goodsSkuId
]))
{
return
self
::
TCC_RESULT_FAIL
;
}
$num
=
$numList
[
$goodsSkuId
];
//条件加上乐观锁
//条件加上乐观锁
$rowCount
=
GoodsSku
::
save
([
$rowCount
=
GoodsSku
::
save
([
...
@@ -176,13 +164,10 @@ class Tcc2Service
...
@@ -176,13 +164,10 @@ class Tcc2Service
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
=
$numList
=
[];
foreach
(
$goodsInfoList
as
$item
)
{
foreach
(
$goodsInfoList
as
$item
)
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
if
(
empty
(
$item
[
"goods_sku_id"
])
||
empty
(
$item
[
"num"
]))
{
return
self
::
TCC_RESULT_FAIL
;
return
self
::
TCC_RESULT_FAIL
;
}
}
$goodsSkuIds
[]
=
$item
[
"goods_sku_id"
];
$numList
[
$item
[
"goods_sku_id"
]]
=
$item
[
"num"
];
}
}
$tccInfo
=
self
::
getTccRecord
(
$tid
);
$tccInfo
=
self
::
getTccRecord
(
$tid
);
...
@@ -202,16 +187,13 @@ class Tcc2Service
...
@@ -202,16 +187,13 @@ class Tcc2Service
return
self
::
TCC_RESULT_SUCCESS
;
return
self
::
TCC_RESULT_SUCCESS
;
}
}
$skus
=
GoodsSku
::
getRecords
([
"goods_sku_id"
=>
$goodsSkuIds
]
if
(
!
empty
(
$goodsInfoList
))
{
,
[
"goods_sku_id"
,
"inventory_rest"
,
"inventory_lock"
,
"total_amount_order"
,
"online_status"
]);
if
(
!
empty
(
$skus
))
{
GoodsSku
::
beginTransaction
();
GoodsSku
::
beginTransaction
();
foreach
(
$skus
as
$sku
)
{
foreach
(
$goodsInfoList
as
$item
)
{
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$item
[
"goods_sku_id"
];
if
(
empty
(
$numList
[
$goodsSkuId
]))
{
$num
=
$item
[
"num"
];
return
self
::
TCC_RESULT_FAIL
;
$sku
=
GoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
}
,
[
"goods_sku_id"
,
"inventory_rest"
,
"inventory_lock"
,
"total_amount_order"
,
"online_status"
]);
$num
=
$numList
[
$goodsSkuId
];
//T时候执行C2,条件加上乐观锁
//T时候执行C2,条件加上乐观锁
if
(
$tccInfo
[
"status"
]
==
Tcc
::
STATUS_T_SUCCESS
)
{
if
(
$tccInfo
[
"status"
]
==
Tcc
::
STATUS_T_SUCCESS
)
{
...
@@ -224,6 +206,7 @@ class Tcc2Service
...
@@ -224,6 +206,7 @@ class Tcc2Service
throw
new
GoodsException
([
"cus"
=>
31
]);
throw
new
GoodsException
([
"cus"
=>
31
]);
}
}
}
}
//T时候执行C2,条件加上乐观锁
//T时候执行C2,条件加上乐观锁
if
(
$tccInfo
[
"status"
]
==
Tcc
::
STATUS_C1_SUCCESS
)
{
if
(
$tccInfo
[
"status"
]
==
Tcc
::
STATUS_C1_SUCCESS
)
{
$rowCount
=
GoodsSku
::
save
([
$rowCount
=
GoodsSku
::
save
([
...
...
daemon/Goods.php
View file @
2b83f128
...
@@ -9,7 +9,7 @@ use App\Models\goods\mysql\GoodsSku;
...
@@ -9,7 +9,7 @@ use App\Models\goods\mysql\GoodsSku;
use
App\Services\goods\GoodsService
;
use
App\Services\goods\GoodsService
;
use
Api\PhpUtils\Log\DaemonLog
;
use
Api\PhpUtils\Log\DaemonLog
;
class
Goods
implements
DaemonServiceInterface
class
Goods
implements
DaemonServiceInterface
{
public
function
run
()
public
function
run
()
{
{
sleep
(
2
);
sleep
(
2
);
...
...
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