Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
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
chenchuanwen
my-yaf-project
Commits
e2d46432
Commit
e2d46432
authored
Sep 11, 2018
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
goods
parent
5fb7ebba
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
33 deletions
+31
-33
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+20
-27
StoreService.php
application/models/Business/Store/StoreService.php
+3
-4
Order.php
application/models/DAO/Order/Order.php
+1
-0
OrderGoods.php
application/models/DAO/Order/OrderGoods.php
+7
-2
No files found.
application/models/Business/Goods/GoodsCommonService.php
View file @
e2d46432
...
@@ -402,7 +402,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -402,7 +402,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
//用户是否有参加这个活动
//用户是否有参加这个活动
if
(
$price
=
\DAO\SaleGoodsModel
::
getInstance
()
->
getSalePrice
(
$data
,
$activities
)){
if
(
$price
=
\DAO\SaleGoodsModel
::
getInstance
()
->
getSalePrice
(
$data
,
$activities
)){
$v
[
'goods_price'
]
=
$price
;
$v
[
'goods_price'
]
=
$price
;
$commonInfo
[
'goods_price'
]
=
min
(
$commonInfo
[
'goods_price'
],
$price
)
;
$commonInfo
[
'goods_price'
]
=
$price
;
}
}
}
}
}
}
...
@@ -857,55 +857,48 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -857,55 +857,48 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
* 销售订单任务脚本
* 销售订单任务脚本
*/
*/
public
function
saleGoods
(){
public
function
saleGoods
(){
for
(
$i
=
0
;
$i
<
2000
;
$i
++
){
$baseConfDir
=
\Our\Common
::
getConfig
(
'out.config'
);
if
(
$orderGoodsId
=
\DAO\SaleGoodsModel
::
getInstance
()
->
popOrderGoodsList
()){
$savePath
=
$baseConfDir
.
\Our\PathConst
::
orderConfirmTaskAddTime
;
$saleOrder
=
\DAO\SaleOrderModel
::
getInstance
()
->
find
(
array
(
'order_goods_id'
=>
$orderGoodsId
),
'id'
);
$addTime
=
file_get_contents
(
$savePath
);
$addTime
=
$addTime
?
$addTime
:
ApiConst
::
zero
;
$orderDao
=
\DAO\Order\OrderGoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$pageBegin
=
\Our\PageConst
::
taskPageBegin
;
$time
=
TIMESTAMP
;
do
{
$orders
=
$orderDao
->
getSaleOrderGoods
(
'rec_id,sale_act_id,sale_id,goods_id,goods_num,goods_name,goods_image,order_id,is_refund'
,
$addTime
,
$pageBegin
,
\Our\PageConst
::
taskPageSize
,
'send_time'
);
foreach
(
$orders
[
'list'
]
as
$orderGoods
)
{
$saleOrder
=
\DAO\SaleOrderModel
::
getInstance
()
->
find
(
array
(
'order_goods_id'
=>
$orderGoods
[
'rec_id'
]),
'id'
);
$insert
=
[];
$insert
=
[];
$update
=
[];
$update
=
[];
$orderGoods
=
\DAO\Order\OrderGoodsModel
::
getInstance
()
->
find
(
array
(
'rec_id'
=>
$orderGoodsId
),
'sale_act_id,sale_id,goods_id,goods_num,goods_name,goods_image,refund_id,order_id,refund_state_name'
);
$order
=
\DAO\Order\OrderModel
::
getInstance
()
->
findByOrderId
(
$orderGoods
[
'order_id'
],
'order_state'
);
$order
=
\DAO\Order\OrderModel
::
getInstance
()
->
findByOrderId
(
$orderGoods
[
'order_id'
],
'buyer_id,order_state,evaluation_state'
);
if
(
$saleOrder
){
if
(
$saleOrder
){
$update
[
'refund_id'
]
=
$orderGoods
[
'refund_id'
];
$update
[
'is_refund'
]
=
$orderGoods
[
'is_refund'
];
$update
[
'refund_state_name'
]
=
$orderGoods
[
'refund_state_name'
];
$update
[
'order_state'
]
=
$order
[
'order_state'
];
$update
[
'order_state'
]
=
$order
[
'order_state'
];
$update
[
'evaluation_state'
]
=
$order
[
'evaluation_state'
];
}
else
{
}
else
{
$member
=
\DAO\MemberModel
::
getInstance
()
->
find
(
$order
[
'buyer_id'
]);
$member
=
\DAO\MemberModel
::
getInstance
()
->
find
(
$order
[
'buyer_id'
]);
$insert
[
'member_name'
]
=
$member
[
'member_name'
];
$insert
[
'member_name'
]
=
$member
[
'member_name'
];
$insert
[
'member_avatar'
]
=
$member
[
'member_avatar'
];
$insert
[
'member_avatar'
]
=
$member
[
'member_avatar'
];
$insert
[
'order_goods_id'
]
=
$orderGoods
Id
;
$insert
[
'order_goods_id'
]
=
$orderGoods
[
'rec_id'
]
;
$insert
[
'sale_act_id'
]
=
$orderGoods
[
'sale_act_id'
];
$insert
[
'sale_act_id'
]
=
$orderGoods
[
'sale_act_id'
];
$insert
[
'sale_id'
]
=
$orderGoods
[
'sale_id'
];
$insert
[
'sale_id'
]
=
$orderGoods
[
'sale_id'
];
$insert
[
'goods_id'
]
=
$orderGoods
[
'goods_id'
];
$insert
[
'goods_id'
]
=
$orderGoods
[
'goods_id'
];
$insert
[
'goods_num'
]
=
$orderGoods
[
'goods_num'
];
$insert
[
'goods_num'
]
=
$orderGoods
[
'goods_num'
];
$insert
[
'goods_name'
]
=
$orderGoods
[
'goods_name'
];
$insert
[
'goods_name'
]
=
$orderGoods
[
'goods_name'
];
$insert
[
'goods_image'
]
=
$orderGoods
[
'goods_image'
];
$insert
[
'goods_image'
]
=
$orderGoods
[
'goods_image'
];
$insert
[
'refund_id'
]
=
$orderGoods
[
'refund_id'
];
$insert
[
'order_id'
]
=
$orderGoods
[
'order_id'
];
$insert
[
'order_id'
]
=
$orderGoods
[
'order_id'
];
$insert
[
'refund_state_name'
]
=
$orderGoods
[
'refund_state_name'
];
$insert
[
'member_id'
]
=
$order
[
'buyer_id'
];
$insert
[
'member_id'
]
=
$order
[
'buyer_id'
];
$insert
[
'order_state'
]
=
$order
[
'order_state'
];
$insert
[
'order_state'
]
=
$order
[
'order_state'
];
$insert
[
'evaluation_state'
]
=
$order
[
'evaluation_state'
];
$insert
[
'is_refund'
]
=
$orderGoods
[
'is_refund'
];
}
if
(
$orderGoods
[
'refund_id'
]
>
0
){
$refund
=
\DAO\Order\RefundReturnModel
::
getInstance
()
->
find
(
array
(
'refund_id'
=>
$orderGoods
[
'refund_id'
]),
'seller_state,is_platform_in,platform_state'
);
if
(
$saleOrder
){
$update
[
'seller_state'
]
=
$refund
[
'seller_state'
];
$update
[
'is_platform_in'
]
=
$refund
[
'is_platform_in'
];
$update
[
'platform_state'
]
=
$refund
[
'platform_state'
];
}
else
{
$insert
[
'seller_state'
]
=
$refund
[
'seller_state'
];
$insert
[
'is_platform_in'
]
=
$refund
[
'is_platform_in'
];
$insert
[
'platform_state'
]
=
$refund
[
'platform_state'
];
}
}
}
if
(
$saleOrder
){
if
(
$saleOrder
){
\DAO\SaleOrderModel
::
getInstance
()
->
update
(
array
(
'order_goods_id'
=>
$orderGoods
Id
),
$update
);
\DAO\SaleOrderModel
::
getInstance
()
->
update
(
array
(
'order_goods_id'
=>
$orderGoods
[
'rec_id'
]
),
$update
);
}
else
{
}
else
{
\DAO\SaleOrderModel
::
getInstance
()
->
insert
(
$insert
);
\DAO\SaleOrderModel
::
getInstance
()
->
insert
(
$insert
);
}
}
}
}
}
$pageBegin
++
;
}
while
(
!
empty
(
$orders
[
'list'
]));
file_put_contents
(
$savePath
,
$time
);
}
}
/**
/**
...
...
application/models/Business/Store/StoreService.php
View file @
e2d46432
...
@@ -175,7 +175,7 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -175,7 +175,7 @@ class StoreServiceModel extends \Business\AbstractModel{
return
array
(
'storeName'
=>
$storeInfo
[
'store_name'
],
'storeLabel'
=>
$storeLabel
,
'fansCount'
=>
\DAO\FavoritesStoreModel
::
getInstance
()
->
getFavoritesStoreCountByStoreId
(
$storeId
),
'clazz'
=>
$returnClass
,
'address'
=>
$address
,
'storePhone'
=>
$storeInfo
[
'store_phone'
],
'openingHours'
=>
$openingHours
,
'storeService'
=>
$storeInfo
[
'store_notice'
],
"qualificationImage"
=>
$detailImg
);
return
array
(
'storeName'
=>
$storeInfo
[
'store_name'
],
'storeLabel'
=>
$storeLabel
,
'fansCount'
=>
\DAO\FavoritesStoreModel
::
getInstance
()
->
getFavoritesStoreCountByStoreId
(
$storeId
),
'clazz'
=>
$returnClass
,
'address'
=>
$address
,
'storePhone'
=>
$storeInfo
[
'store_phone'
],
'openingHours'
=>
$openingHours
,
'storeService'
=>
$storeInfo
[
'store_notice'
],
"qualificationImage"
=>
$detailImg
);
}
}
public
function
getRecommendGoodsCache
(
$param
,
$memberId
){
public
function
getRecommendGoodsCache
(
$param
,
$memberId
){
$recommendGoods
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreGoodsClassRedisModel
::
getInstance
(),
array
(
&
$this
,
'getRecommendGoods'
),
array
(
$param
,
$memberId
),
\Our\ApiConst
::
one
DaySecond
,
array
(
intval
(
$param
[
'storeId'
])));
$recommendGoods
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreGoodsClassRedisModel
::
getInstance
(),
array
(
&
$this
,
'getRecommendGoods'
),
array
(
$param
,
$memberId
),
\Our\ApiConst
::
one
Hour
,
array
(
intval
(
$param
[
'storeId'
])));
return
$recommendGoods
;
return
$recommendGoods
;
}
}
/**
/**
...
@@ -190,7 +190,6 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -190,7 +190,6 @@ class StoreServiceModel extends \Business\AbstractModel{
\DAO\StoreModel
::
getInstance
()
->
get
(
$storeId
,
false
);
\DAO\StoreModel
::
getInstance
()
->
get
(
$storeId
,
false
);
$activities
=
\DAO\SaleMemberModel
::
getInstance
()
->
isJoinStore
(
$storeId
,
$memberId
);
$activities
=
\DAO\SaleMemberModel
::
getInstance
()
->
isJoinStore
(
$storeId
,
$memberId
);
$storeClassDAO
=
\DAO\StoreGoodsClassModel
::
getInstance
();
$storeClassDAO
=
\DAO\StoreGoodsClassModel
::
getInstance
();
$tempStcs
=
$storeClassDAO
->
getList
(
array
(
'store_id'
=>
$storeId
),
'stc_id,stc_name'
);
$tempStcs
=
$storeClassDAO
->
getList
(
array
(
'store_id'
=>
$storeId
),
'stc_id,stc_name'
);
if
(
$tempStcs
)
{
if
(
$tempStcs
)
{
...
@@ -202,7 +201,7 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -202,7 +201,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$goodsIds
=
array_column
(
$stcGoods
,
'goods_common_id'
);
$goodsIds
=
array_column
(
$stcGoods
,
'goods_common_id'
);
$goodsCommonDAO
=
\DAO\GoodsCommonModel
::
getInstance
();
$goodsCommonDAO
=
\DAO\GoodsCommonModel
::
getInstance
();
if
(
$activities
===
false
){
if
(
$activities
===
false
){
$tempGoods
=
$goodsCommonDAO
->
getGoodsList
(
array
(
'goods_commonid in('
.
implode
(
','
,
$goodsIds
)
.
')'
),
'goods_name,goods_image,goods_price,goods_marketprice,goods_commonid'
);
$tempGoods
=
$goodsCommonDAO
->
getGoodsList
(
array
(
'goods_commonid in('
.
implode
(
','
,
$goodsIds
)
.
')'
),
'goods_name,goods_image,goods_price
as goodsPrice
,goods_marketprice,goods_commonid'
);
}
else
{
}
else
{
$activities
=
array_keys
(
$activities
);
$activities
=
array_keys
(
$activities
);
$tempGoods
=
$goodsCommonDAO
->
getListWithSale
(
array
(
'han_goods_common.goods_commonid in('
.
implode
(
','
,
$goodsIds
)
.
')'
),
'goods_name,goods_image,goods_price,goods_marketprice,han_goods_common.goods_commonid'
,
$activities
);
$tempGoods
=
$goodsCommonDAO
->
getListWithSale
(
array
(
'han_goods_common.goods_commonid in('
.
implode
(
','
,
$goodsIds
)
.
')'
),
'goods_name,goods_image,goods_price,goods_marketprice,han_goods_common.goods_commonid'
,
$activities
);
...
@@ -222,7 +221,7 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -222,7 +221,7 @@ class StoreServiceModel extends \Business\AbstractModel{
'goodsCommonId'
=>
$v
[
'goods_common_id'
],
'goodsCommonId'
=>
$v
[
'goods_common_id'
],
'goodsName'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods_name'
],
'goodsName'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods_name'
],
'goodsImage'
=>
\Our\ImageUtil
::
getGoodsImgUrl
(
$goods
[
$v
[
'goods_common_id'
]][
'goods_image'
]),
'goodsImage'
=>
\Our\ImageUtil
::
getGoodsImgUrl
(
$goods
[
$v
[
'goods_common_id'
]][
'goods_image'
]),
'goodsPrice'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods
_p
rice'
],
'goodsPrice'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods
P
rice'
],
'goodsMarketPrice'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods_marketprice'
],
'goodsMarketPrice'
=>
$goods
[
$v
[
'goods_common_id'
]][
'goods_marketprice'
],
];
];
if
(
key_exists
(
$v
[
'stc_id'
],
$recommendGoods
)){
if
(
key_exists
(
$v
[
'stc_id'
],
$recommendGoods
)){
...
...
application/models/DAO/Order/Order.php
View file @
e2d46432
...
@@ -890,6 +890,7 @@ class OrderModel extends \DAO\AbstractModel
...
@@ -890,6 +890,7 @@ class OrderModel extends \DAO\AbstractModel
}
}
/**
/**
* 获取订单列表
* 获取订单列表
* @param $where
* @param $where
...
...
application/models/DAO/Order/OrderGoods.php
View file @
e2d46432
...
@@ -186,8 +186,13 @@ class OrderGoodsModel extends \DAO\AbstractModel {
...
@@ -186,8 +186,13 @@ class OrderGoodsModel extends \DAO\AbstractModel {
'goodsPayPrice'
=>
$orderGoods
[
'goodsPayPrice'
],
'goodsPayPrice'
=>
$orderGoods
[
'goodsPayPrice'
],
);
);
}
}
//销售订单
public
function
getSaleOrderGoods
(
$field
,
$updateTime
,
$pageIndex
,
$pageSize
)
{
$this
->
setDb
(
$this
->
dbName
);
$where
=
Common
::
format
(
'sale_act_id >0 AND gmt_update >= {1}'
,
$updateTime
);
$list
=
$this
->
lists
(
$where
,
''
,
$field
,
$pageIndex
,
$pageSize
);
return
$list
;
}
public
function
insertAll
(
$datas
){
public
function
insertAll
(
$datas
){
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
...
...
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