Commit 01a82297 authored by luhongguang's avatar luhongguang

update:商品详情内团长判断

parent 037b1a0f
...@@ -19,8 +19,10 @@ use App\Models\goods\mysql\GoodsSnapshot; ...@@ -19,8 +19,10 @@ use App\Models\goods\mysql\GoodsSnapshot;
use App\Models\goods\mysql\GoodsSpu; use App\Models\goods\mysql\GoodsSpu;
use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord; use App\Models\goods\mysql\PaySuccessGoodsCallbackRecord;
use App\Models\goods\mysql\Shop; use App\Models\goods\mysql\Shop;
use App\Models\marketing\mysql\Distributor;
use App\Models\marketing\mysql\MarketingGoods; use App\Models\marketing\mysql\MarketingGoods;
use App\Models\shop\mysql\SubShop; use App\Models\shop\mysql\SubShop;
use App\Services\marketing\DistributorService;
use App\Services\marketing\MarketingGoodsService; use App\Services\marketing\MarketingGoodsService;
use App\Services\shop\ShopService; use App\Services\shop\ShopService;
use Api\PhpUtils\Http\Request; use Api\PhpUtils\Http\Request;
...@@ -564,8 +566,8 @@ class GoodsService ...@@ -564,8 +566,8 @@ class GoodsService
"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"],
"introduce" => $skuData["introduce"], "introduce" => $params["introduce"],
"introduce_pic_url" => $skuData["introduce_pic_url"], "introduce_pic_url" => $params["introduce_pic_url"],
"expiration_time" => $params["expiration_time"], "expiration_time" => $params["expiration_time"],
"rule_limit" => $params["rule_limit"], "rule_limit" => $params["rule_limit"],
"rule_desc" => $params["rule_desc"], "rule_desc" => $params["rule_desc"],
...@@ -696,6 +698,22 @@ class GoodsService ...@@ -696,6 +698,22 @@ class GoodsService
$subShopList = SubShop::select("*", ["sub_shop_id" => $subShopIds]); $subShopList = SubShop::select("*", ["sub_shop_id" => $subShopIds]);
$data["goods_info"]["sub_shop"] = $subShopList; $data["goods_info"]["sub_shop"] = $subShopList;
} }
//是否是分销活动
$runningMarketing = MarketingGoodsService::getRunningMarketing([$sku["goods_sku_id"]]);
$data["goods_info"]["is_fenxiao"] = false;
if (!empty($runningMarketing[$sku["goods_sku_id"]])) {
$data["goods_info"]["is_fenxiao"] = true;
}
//当前人是否是团长
$data["goods_info"]["is_tuanzhang"] = false;
if (!empty($params["user_id"])) {
$distributorList = DistributorService::getDistributorInfo($params["user_id"]);
if (!empty($distributorList)) {
$data["goods_info"]["is_tuanzhang"] = true;
}
}
} }
} }
$recordList = GoodsOperationRecord::select("*", ["goods_spu_id" => $goodsSpuId]); $recordList = GoodsOperationRecord::select("*", ["goods_spu_id" => $goodsSpuId]);
...@@ -775,6 +793,22 @@ class GoodsService ...@@ -775,6 +793,22 @@ class GoodsService
$data["goods_info"]["sub_shop"][$key]["phone"] = $sub["phone"]; $data["goods_info"]["sub_shop"][$key]["phone"] = $sub["phone"];
} }
} }
//是否是分销活动
$runningMarketing = MarketingGoodsService::getRunningMarketing([$params["goods_sku_id"]]);
$data["goods_info"]["is_fenxiao"] = false;
if (!empty($runningMarketing[$params["goods_sku_id"]])) {
$data["goods_info"]["is_fenxiao"] = true;
}
//当前人是否是团长
$data["goods_info"]["is_tuanzhang"] = false;
if (!empty($params["user_id"])) {
$distributorList = DistributorService::getDistributorInfo($params["user_id"]);
if (!empty($distributorList)) {
$data["goods_info"]["is_tuanzhang"] = true;
}
}
return $data; return $data;
} }
......
...@@ -459,4 +459,21 @@ class DistributorService ...@@ -459,4 +459,21 @@ class DistributorService
"count" => $count]], []); "count" => $count]], []);
return $res['id_snow'][$type] ?? []; return $res['id_snow'][$type] ?? [];
} }
/**
* 获取团长信息
* @param $userIds
* @return array
*/
public static function getDistributorInfo($userIds)
{
$list = Distributor::select(["parent_user_id", "user_id", "user_name"], ["user_id" => $userIds]);
$data = [];
if (!empty($list)) {
foreach ($list as $item) {
$data[$item["user_id"]] = $item;
}
}
return $data;
}
} }
\ No newline at end of file
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