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
53d17487
Commit
53d17487
authored
Nov 02, 2021
by
顾文旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix 七牛图片获取
parent
de463e76
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
51 deletions
+46
-51
GoodsService.php
application/services/goods/GoodsService.php
+44
-39
MarketingService.php
application/services/marketing/MarketingService.php
+2
-12
No files found.
application/services/goods/GoodsService.php
View file @
53d17487
...
...
@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException;
class
GoodsService
{
const
CHARGEFEE
=
0.006
;
/**
* 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...
...
@@ -250,8 +251,8 @@ class GoodsService
"inventory_rest"
=>
$skuData
[
"inventory"
],
"original_price"
=>
empty
(
$skuData
[
"original_price"
])
?
''
:
$skuData
[
"original_price"
]
*
100
,
"price"
=>
$skuData
[
"price"
]
*
100
,
"online_start_time"
=>
empty
(
$skuData
[
"online_start_time"
])
?
""
:
$skuData
[
"online_start_time"
],
"online_end_time"
=>
empty
(
$skuData
[
"online_end_time"
])
?
""
:
$skuData
[
"online_end_time"
],
"online_start_time"
=>
empty
(
$skuData
[
"online_start_time"
])
?
""
:
$skuData
[
"online_start_time"
],
"online_end_time"
=>
empty
(
$skuData
[
"online_end_time"
])
?
""
:
$skuData
[
"online_end_time"
],
"online_type"
=>
empty
(
$skuData
[
"online_type"
])
?
""
:
$skuData
[
"online_type"
],
];
if
(
!
empty
(
$skuData
[
"setmeal"
]))
{
...
...
@@ -280,7 +281,7 @@ class GoodsService
if
(
!
empty
(
$skuData
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$skuData
[
"online_type"
],
[
1
,
2
]))
{
if
(
in_array
(
$skuData
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
}
...
...
@@ -434,14 +435,14 @@ class GoodsService
"rejected_reason"
=>
$rejectedReason
];
}
if
(
$status
==
GoodsSku
::
STATUS_PASS
)
{
$online_type
=
empty
(
$sku
[
"online_type"
])
?
0
:
$sku
[
"online_type"
];
if
(
$online_type
==
1
)
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
$statusData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
//定点上架
if
(
$online_type
==
2
)
{
$onlineStartTime
=
empty
(
$sku
[
"online_start_time"
])
?
0
:
strtotime
(
$sku
[
"online_start_time"
]);
...
...
@@ -531,13 +532,13 @@ class GoodsService
$goodsSkuData
=
[
"online_status"
=>
$onlineStatus
];
if
(
$onlineStatus
==
GoodsSku
::
ONLINE_STATUS_OFFLINE
){
if
(
$onlineStatus
==
GoodsSku
::
ONLINE_STATUS_OFFLINE
)
{
$goodsSkuData
[
'online_type'
]
=
3
;
$goodsSkuData
[
'online_start_time'
]
=
null
;
$goodsSkuData
[
'online_end_time'
]
=
null
;
}
if
(
$onlineStatus
==
GoodsSku
::
ONLINE_STATUS_ONLINE
){
if
(
$onlineStatus
==
GoodsSku
::
ONLINE_STATUS_ONLINE
)
{
$goodsSkuData
[
'online_type'
]
=
1
;
$goodsSkuData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
...
...
@@ -577,11 +578,11 @@ class GoodsService
/**
* 设置商品上架
* @date 2021-08-25
* @copyright [copyright]
* @license [license]
* @version [version]
* @param $params [description]
* @return array [description]
* @version [version]
* @copyright [copyright]
* @license [license]
*/
public
static
function
onlineSite
(
$params
)
{
...
...
@@ -610,16 +611,16 @@ class GoodsService
}
$goodsSkuData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
//暂不上架
if
(
$onlineType
==
3
)
{
//$goodsSkuData['audit_status'] = 0;
if
(
$sku
[
'audit_status'
]
==
1
)
{
$goodsSkuData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
else
{
}
else
{
$goodsSkuData
[
'online_status'
]
=
0
;
}
}
if
(
$onlineType
==
2
)
{
...
...
@@ -627,14 +628,14 @@ class GoodsService
if
(
$onlineStartTime
>
time
())
{
if
(
$sku
[
'audit_status'
]
==
1
)
{
$goodsSkuData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
else
{
}
else
{
$goodsSkuData
[
'online_status'
]
=
0
;
}
}
}
//立即上架和定时上架
if
(
in_array
(
$onlineType
,
[
1
,
2
]))
{
if
(
in_array
(
$onlineType
,
[
1
,
2
]))
{
if
(
$sku
[
"expiration_time"
]
<=
$goodsSkuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
...
...
@@ -643,7 +644,7 @@ class GoodsService
$operatorId
=
empty
(
$params
[
"user_id"
])
?
0
:
$params
[
"user_id"
];
$operatorName
=
!
empty
(
$params
[
"user_name"
])
?
$params
[
"user_name"
]
:
''
;
//商品操作记录
//商品操作记录
$record
=
[
"goods_spu_id"
=>
$goodsSpuId
,
"goods_sku_id"
=>
$goodsSkuId
,
...
...
@@ -882,7 +883,7 @@ class GoodsService
if
(
!
empty
(
$params
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$params
[
"online_type"
],
[
1
,
2
]))
{
if
(
in_array
(
$params
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuParams
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
52
]);
}
...
...
@@ -918,8 +919,8 @@ class GoodsService
{
$clearPrice
=
$skuParams
[
"clear_price"
];
$price
=
$skuParams
[
"price"
];
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
$chargeFee
=
0
;
}
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
...
...
@@ -930,9 +931,9 @@ class GoodsService
if
(
!
empty
(
$marketingIds
))
{
$marketingIds
=
array_column
(
$marketingIds
,
"marketing_id"
);
$marketings
=
Marketing
::
select
(
"*"
,
[
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
,
"online_status"
=>
Marketing
::
ONLINE_STATUS_QIDONG
]
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
,
"online_status"
=>
Marketing
::
ONLINE_STATUS_QIDONG
]
);
if
(
!
empty
(
$marketings
))
{
...
...
@@ -951,26 +952,26 @@ class GoodsService
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
else
{
}
else
{
//比例计算
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
10000
*
$price
;
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
33
]);
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
33
]);
}
}
//固定金额
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
33
]);
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
33
]);
}
}
}
}
}
else
{
}
else
{
if
(
$clearPrice
>
0
&&
((
$price
-
$chargeFee
)
<
$clearPrice
))
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
...
...
@@ -1059,7 +1060,7 @@ class GoodsService
$data
[
"goods_info"
][
"online_type"
]
=
$sku
[
"online_type"
];
$data
[
"goods_info"
][
"online_start_time"
]
=
$sku
[
"online_start_time"
];
$data
[
"goods_info"
][
"online_end_time"
]
=
$sku
[
"online_end_time"
];
$categoryNameList
=
Category
::
select
(
"name"
,
[
"category_id"
=>
[
$sku
[
"category_1_id"
],
$sku
[
"category_2_id"
]]]);
$data
[
"goods_info"
][
"category_1_name"
]
=
$categoryNameList
[
0
];
$data
[
"goods_info"
][
"category_2_name"
]
=
$categoryNameList
[
1
];
...
...
@@ -1091,14 +1092,14 @@ class GoodsService
$data
[
"goods_info"
][
"is_tuanzhang"
]
=
true
;
if
(
!
empty
(
$runningMarketing
))
{
//分销返现多少钱
$data
[
"goods_info"
][
"cash_back"
]
=
substr
(
sprintf
(
"%.4f"
,
$runningMarketing
[
$sku
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]),
0
,
-
2
);
$data
[
"goods_info"
][
"cash_back"
]
=
substr
(
sprintf
(
"%.4f"
,
$runningMarketing
[
$sku
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]),
0
,
-
2
);
}
}
}
}
}
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
,
"ORDER"
=>
[
"create_time"
=>
"DESC"
]]);
if
(
!
empty
(
$recordList
))
{
foreach
(
$recordList
as
$key
=>
$record
)
{
...
...
@@ -1125,7 +1126,7 @@ class GoodsService
$goodsSukParams
=
GoodsSkuId
::
getGoodsSkuIdParams
(
$params
[
"goods_sku_id"
]);
if
(
!
empty
(
$goodsSukParams
))
{
if
(
isset
(
$goodsSukParams
[
"table_tag"
])
&&
(
$goodsSukParams
[
"table_tag"
]
==
GoodsSkuId
::
TABLE_TAG_PINDAN
||
$goodsSukParams
[
"category_1_id"
]
==
"00"
))
{
||
$goodsSukParams
[
"category_1_id"
]
==
"00"
))
{
return
MarketingPindanGoodsService
::
pindanGoodsInfo
(
$params
);
}
else
{
return
self
::
generalGoodsInfo
(
$params
);
...
...
@@ -1236,9 +1237,9 @@ class GoodsService
if
(
!
empty
(
$runningMarketing
))
{
//分销返现多少钱
if
(
!
empty
(
$marketing
)
&&
$marketing
[
'commission_mode'
]
==
2
)
{
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]);
}
else
{
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]);
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]);
}
else
{
$data
[
"goods_info"
][
"cash_back"
]
=
(
float
)
sprintf
(
"%.2f"
,
$runningMarketing
[
$params
[
"goods_sku_id"
]]
*
$data
[
"goods_info"
][
"price"
]);
}
}
}
...
...
@@ -1290,7 +1291,7 @@ class GoodsService
$where
[
'ORDER'
]
=
[
"create_time"
=>
"DESC"
];
$list
=
GoodsSku
::
select
([
"goods_spu_id"
,
"goods_sku_id"
,
"goods_name"
,
"category_1_id"
,
"category_2_id"
,
"life_account_id"
,
"publish_user_id"
,
"update_time"
,
"create_time"
,
"audit_status"
,
"online_status"
,
"online_start_time"
,
"online_end_time"
,
"online_type"
],
"publish_user_id"
,
"update_time"
,
"create_time"
,
"audit_status"
,
"online_status"
,
"online_start_time"
,
"online_end_time"
,
"online_type"
],
$where
);
if
(
!
empty
(
$list
))
{
foreach
(
$list
as
$key
=>
$item
)
{
...
...
@@ -1306,7 +1307,7 @@ class GoodsService
if
(
$item
[
'online_type'
]
==
1
)
{
$list
[
$key
][
"online_end_time"
]
=
""
;
}
}
}
return
[
"list"
=>
$list
,
"count"
=>
$count
];
...
...
@@ -1741,11 +1742,11 @@ class GoodsService
if
(
!
empty
(
$params
[
'goods_sku_id'
]))
{
$where
[
'goods_sku_id'
]
=
$params
[
'goods_sku_id'
];
}
if
(
!
empty
(
$params
[
'sub_shop_id'
]))
{
$where
[
'sub_shop_id'
]
=
$params
[
'sub_shop_id'
];
}
$list
=
GoodsSkuSubShop
::
getRecords
(
$where
);
return
$list
;
}
...
...
@@ -1762,6 +1763,10 @@ class GoodsService
$data
=
$ksyunParams
=
[];
$strList
=
explode
(
","
,
$picUrlStr
);
foreach
(
$strList
as
$key
=>
$str
)
{
if
(
empty
(
$str
)
||
substr
(
$str
,
0
,
2
)
!=
"SHQ"
)
{
$data
[]
=
"https://pingouimg.jwshq.cn/"
.
$str
;
continue
;
}
$arr
=
explode
(
"/"
,
$str
);
if
(
preg_match
(
"/^http[s]
{
0,1
}
:\/\/([\w.]+\/?)\S*/"
,
$str
))
{
$data
[]
=
$str
;
...
...
application/services/marketing/MarketingService.php
View file @
53d17487
...
...
@@ -362,13 +362,7 @@ class MarketingService
$lists
[
$key
][
"life_account_icon"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_icon"
];
$lists
[
$key
][
"life_account_name"
]
=
$lifeAccountList
[
$currentLifeAccountId
][
"life_account_name"
];
}
if
(
empty
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
])
||
substr
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
],
0
,
2
)
===
"SHQ"
)
{
$picUrl
=
GoodsService
::
getUrlList
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
]);
}
else
{
$picUrl
=
"https://pingouimg.jwshq.cn/"
.
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
];
}
$picUrl
=
GoodsService
::
getUrlList
(
$priceData
[
$value
[
"marketing_id"
]][
"pindan_pic"
]);
$lists
[
$key
][
"min_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"min_price"
]
/
100
);
$lists
[
$key
][
"max_price"
]
=
sprintf
(
"%.2f"
,
$priceData
[
$value
[
"marketing_id"
]][
"max_price"
]
/
100
);
$lists
[
$key
][
"pindan_pic_url"
]
=
$picUrl
;
...
...
@@ -1110,11 +1104,7 @@ class MarketingService
$marketingData
[
"marketing_type"
]
=
$marketingInfo
[
"marketing_type"
];
$marketingData
[
"publish_life_account_id"
]
=
$pindanMarketing
[
"publish_life_account_id"
];
$marketingData
[
"pindan_pic"
]
=
$pindanMarketing
[
"pindan_pic"
];
if
(
empty
(
$marketingData
[
"pindan_pic"
])
||
substr
(
$marketingData
[
"pindan_pic"
],
0
,
2
)
===
"SHQ"
)
{
$picUrl
=
GoodsService
::
getUrlList
(
$marketingData
[
"pindan_pic"
]);
}
else
{
$picUrl
=
"https://pingouimg.jwshq.cn/"
.
$marketingData
[
"pindan_pic"
];
}
$picUrl
=
GoodsService
::
getUrlList
(
$marketingData
[
"pindan_pic"
]);
$marketingData
[
"pindan_pic_url"
]
=
$picUrl
;
$marketingData
[
"pindan_desc"
]
=
$pindanMarketing
[
"pindan_desc"
];
$marketingData
[
"max_price"
]
=
sprintf
(
"%.2f"
,
$pindanMarketing
[
"max_price"
]
/
100
);
...
...
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