Commit 53d17487 authored by 顾文旭's avatar 顾文旭

fix 七牛图片获取

parent de463e76
...@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException; ...@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException;
class GoodsService class GoodsService
{ {
const CHARGEFEE = 0.006; const CHARGEFEE = 0.006;
/** /**
* 通过发号器拿 id (非雪花) * 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位 * number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...@@ -280,7 +281,7 @@ class GoodsService ...@@ -280,7 +281,7 @@ class GoodsService
if (!empty($skuData["online_type"])) { 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']) { if ($skuData["expiration_time"] <= $skuData['online_start_time']) {
throw new GoodsException(["cus" => 52]); throw new GoodsException(["cus" => 52]);
} }
...@@ -531,13 +532,13 @@ class GoodsService ...@@ -531,13 +532,13 @@ class GoodsService
$goodsSkuData = ["online_status" => $onlineStatus]; $goodsSkuData = ["online_status" => $onlineStatus];
if ($onlineStatus == GoodsSku::ONLINE_STATUS_OFFLINE){ if ($onlineStatus == GoodsSku::ONLINE_STATUS_OFFLINE) {
$goodsSkuData['online_type'] = 3; $goodsSkuData['online_type'] = 3;
$goodsSkuData['online_start_time'] = null; $goodsSkuData['online_start_time'] = null;
$goodsSkuData['online_end_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_type'] = 1;
$goodsSkuData['online_start_time'] = date("Y-m-d H:i:s"); $goodsSkuData['online_start_time'] = date("Y-m-d H:i:s");
} }
...@@ -577,11 +578,11 @@ class GoodsService ...@@ -577,11 +578,11 @@ class GoodsService
/** /**
* 设置商品上架 * 设置商品上架
* @date 2021-08-25 * @date 2021-08-25
* @copyright [copyright]
* @license [license]
* @version [version]
* @param $params [description] * @param $params [description]
* @return array [description] * @return array [description]
* @version [version]
* @copyright [copyright]
* @license [license]
*/ */
public static function onlineSite($params) public static function onlineSite($params)
{ {
...@@ -616,7 +617,7 @@ class GoodsService ...@@ -616,7 +617,7 @@ class GoodsService
//$goodsSkuData['audit_status'] = 0; //$goodsSkuData['audit_status'] = 0;
if ($sku['audit_status'] == 1) { if ($sku['audit_status'] == 1) {
$goodsSkuData['online_status'] = GoodsSku::ONLINE_STATUS_OFFLINE; $goodsSkuData['online_status'] = GoodsSku::ONLINE_STATUS_OFFLINE;
}else{ } else {
$goodsSkuData['online_status'] = 0; $goodsSkuData['online_status'] = 0;
} }
...@@ -627,14 +628,14 @@ class GoodsService ...@@ -627,14 +628,14 @@ class GoodsService
if ($onlineStartTime > time()) { if ($onlineStartTime > time()) {
if ($sku['audit_status'] == 1) { if ($sku['audit_status'] == 1) {
$goodsSkuData['online_status'] = GoodsSku::ONLINE_STATUS_OFFLINE; $goodsSkuData['online_status'] = GoodsSku::ONLINE_STATUS_OFFLINE;
}else{ } else {
$goodsSkuData['online_status'] = 0; $goodsSkuData['online_status'] = 0;
} }
} }
} }
//立即上架和定时上架 //立即上架和定时上架
if (in_array($onlineType, [1,2])) { if (in_array($onlineType, [1, 2])) {
if ($sku["expiration_time"] <= $goodsSkuData['online_start_time']) { if ($sku["expiration_time"] <= $goodsSkuData['online_start_time']) {
throw new GoodsException(["cus" => 52]); throw new GoodsException(["cus" => 52]);
...@@ -882,7 +883,7 @@ class GoodsService ...@@ -882,7 +883,7 @@ class GoodsService
if (!empty($params["online_type"])) { 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']) { if ($skuData["expiration_time"] <= $skuParams['online_start_time']) {
throw new GoodsException(["cus" => 52]); throw new GoodsException(["cus" => 52]);
} }
...@@ -918,8 +919,8 @@ class GoodsService ...@@ -918,8 +919,8 @@ class GoodsService
{ {
$clearPrice = $skuParams["clear_price"]; $clearPrice = $skuParams["clear_price"];
$price = $skuParams["price"]; $price = $skuParams["price"];
$chargeFee = !empty($price) ? (float)bcmul($price , self::CHARGEFEE,2) : 0; //手续费 (分) $chargeFee = !empty($price) ? (float)bcmul($price, self::CHARGEFEE, 2) : 0; //手续费 (分)
if ($chargeFee<1) { if ($chargeFee < 1) {
$chargeFee = 0; $chargeFee = 0;
} }
if ($clearPrice > 0 && $clearPrice > $price) { if ($clearPrice > 0 && $clearPrice > $price) {
...@@ -931,7 +932,7 @@ class GoodsService ...@@ -931,7 +932,7 @@ class GoodsService
$marketingIds = array_column($marketingIds, "marketing_id"); $marketingIds = array_column($marketingIds, "marketing_id");
$marketings = Marketing::select("*", [ $marketings = Marketing::select("*", [
"marketing_id" => $marketingIds, "marketing_id" => $marketingIds,
"marketing_type"=> Marketing::MARKETING_TYPE_FENXIAO, "marketing_type" => Marketing::MARKETING_TYPE_FENXIAO,
"online_status" => Marketing::ONLINE_STATUS_QIDONG] "online_status" => Marketing::ONLINE_STATUS_QIDONG]
); );
...@@ -951,26 +952,26 @@ class GoodsService ...@@ -951,26 +952,26 @@ class GoodsService
throw new GoodsException(['cus' => 40]); throw new GoodsException(['cus' => 40]);
} }
} }
}else{ } else {
//比例计算 //比例计算
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_RATE) { if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_RATE) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]) / 10000 * $price; $commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]) / 10000 * $price;
if ($price < ($commissionTotal+$chargeFee)) { if ($price < ($commissionTotal + $chargeFee)) {
throw new MarketingException(['cus'=>33]); throw new MarketingException(['cus' => 33]);
} }
} }
//固定金额 //固定金额
if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_FIXED) { if ($marketing["commission_mode"] == Marketing::COMMISSION_MODE_FIXED) {
$commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]); $commissionTotal = ($marketing["first_commission_value"] + $marketing["second_commission_value"]);
if ($price < ($commissionTotal+$chargeFee)) { if ($price < ($commissionTotal + $chargeFee)) {
throw new MarketingException(['cus'=>33]); throw new MarketingException(['cus' => 33]);
} }
} }
} }
} }
}else{ } else {
if ($clearPrice > 0 && (($price - $chargeFee) < $clearPrice)) { if ($clearPrice > 0 && (($price - $chargeFee) < $clearPrice)) {
throw new GoodsException(['cus' => 40]); throw new GoodsException(['cus' => 40]);
} }
...@@ -1091,7 +1092,7 @@ class GoodsService ...@@ -1091,7 +1092,7 @@ class GoodsService
$data["goods_info"]["is_tuanzhang"] = true; $data["goods_info"]["is_tuanzhang"] = true;
if (!empty($runningMarketing)) { 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);
} }
} }
} }
...@@ -1236,9 +1237,9 @@ class GoodsService ...@@ -1236,9 +1237,9 @@ class GoodsService
if (!empty($runningMarketing)) { if (!empty($runningMarketing)) {
//分销返现多少钱 //分销返现多少钱
if (!empty($marketing) && $marketing['commission_mode'] == 2) { if (!empty($marketing) && $marketing['commission_mode'] == 2) {
$data["goods_info"]["cash_back"] = (float)sprintf("%.2f",$runningMarketing[$params["goods_sku_id"]]); $data["goods_info"]["cash_back"] = (float)sprintf("%.2f", $runningMarketing[$params["goods_sku_id"]]);
}else{ } 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"]] * $data["goods_info"]["price"]);
} }
} }
} }
...@@ -1290,7 +1291,7 @@ class GoodsService ...@@ -1290,7 +1291,7 @@ class GoodsService
$where['ORDER'] = ["create_time" => "DESC"]; $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", $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); $where);
if (!empty($list)) { if (!empty($list)) {
foreach ($list as $key => $item) { foreach ($list as $key => $item) {
...@@ -1762,6 +1763,10 @@ class GoodsService ...@@ -1762,6 +1763,10 @@ class GoodsService
$data = $ksyunParams = []; $data = $ksyunParams = [];
$strList = explode(",", $picUrlStr); $strList = explode(",", $picUrlStr);
foreach ($strList as $key => $str) { foreach ($strList as $key => $str) {
if (empty($str) || substr($str, 0, 2) != "SHQ") {
$data[] = "https://pingouimg.jwshq.cn/" . $str;
continue;
}
$arr = explode("/", $str); $arr = explode("/", $str);
if (preg_match("/^http[s]{0,1}:\/\/([\w.]+\/?)\S*/", $str)) { if (preg_match("/^http[s]{0,1}:\/\/([\w.]+\/?)\S*/", $str)) {
$data[] = $str; $data[] = $str;
......
...@@ -362,13 +362,7 @@ class MarketingService ...@@ -362,13 +362,7 @@ class MarketingService
$lists[$key]["life_account_icon"] = $lifeAccountList[$currentLifeAccountId]["life_account_icon"]; $lists[$key]["life_account_icon"] = $lifeAccountList[$currentLifeAccountId]["life_account_icon"];
$lists[$key]["life_account_name"] = $lifeAccountList[$currentLifeAccountId]["life_account_name"]; $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"]); $picUrl = GoodsService::getUrlList($priceData[$value["marketing_id"]]["pindan_pic"]);
} else {
$picUrl = "https://pingouimg.jwshq.cn/" . $priceData[$value["marketing_id"]]["pindan_pic"];
}
$lists[$key]["min_price"] = sprintf("%.2f", $priceData[$value["marketing_id"]]["min_price"] / 100); $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]["max_price"] = sprintf("%.2f", $priceData[$value["marketing_id"]]["max_price"] / 100);
$lists[$key]["pindan_pic_url"] = $picUrl; $lists[$key]["pindan_pic_url"] = $picUrl;
...@@ -1110,11 +1104,7 @@ class MarketingService ...@@ -1110,11 +1104,7 @@ class MarketingService
$marketingData["marketing_type"] = $marketingInfo["marketing_type"]; $marketingData["marketing_type"] = $marketingInfo["marketing_type"];
$marketingData["publish_life_account_id"] = $pindanMarketing["publish_life_account_id"]; $marketingData["publish_life_account_id"] = $pindanMarketing["publish_life_account_id"];
$marketingData["pindan_pic"] = $pindanMarketing["pindan_pic"]; $marketingData["pindan_pic"] = $pindanMarketing["pindan_pic"];
if (empty($marketingData["pindan_pic"]) || substr($marketingData["pindan_pic"], 0, 2) === "SHQ") {
$picUrl = GoodsService::getUrlList($marketingData["pindan_pic"]); $picUrl = GoodsService::getUrlList($marketingData["pindan_pic"]);
} else {
$picUrl = "https://pingouimg.jwshq.cn/" . $marketingData["pindan_pic"];
}
$marketingData["pindan_pic_url"] = $picUrl; $marketingData["pindan_pic_url"] = $picUrl;
$marketingData["pindan_desc"] = $pindanMarketing["pindan_desc"]; $marketingData["pindan_desc"] = $pindanMarketing["pindan_desc"];
$marketingData["max_price"] = sprintf("%.2f", $pindanMarketing["max_price"] / 100); $marketingData["max_price"] = sprintf("%.2f", $pindanMarketing["max_price"] / 100);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment