Commit fd69c988 authored by luhongguang's avatar luhongguang

update:传参需要merchant_id的地方修改

parent 8ede2e83
......@@ -40,5 +40,6 @@ class GoodsException extends BaseException
26 => '结束时间格式不对',
27 => 'TCC调用失败',
28 => '上架状态不能编辑,需先下架,再做编辑操作',
29 => '发布商品的生活号不存在',
];
}
\ No newline at end of file
......@@ -13,11 +13,9 @@ class GoodsInitShopValidate extends BaseValidate
{
protected $rule = [
'life_account_id' => 'require',
'merchant_id' => 'require',
];
protected $message = [
"life_account_id" => "生活号id不能为空",
"merchant_id" => "商户id不能为空",
];
}
\ No newline at end of file
......@@ -71,9 +71,19 @@ class GoodsService
{
GoodsSpu::beginTransaction();
//生活号信息
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]);
if (empty($lifeAccountRes["response"]["result"])) {
throw new GoodsException(['cus' => 29]);
}
$lifeAccount = [
"life_account_id" => $params["life_account_id"],
"merchant_id" => $params["merchant_id"],
"merchant_id" => $lifeAccountRes["response"]["result"]["merchant_id"],
];
$shopId = self::addShop($lifeAccount);
$spuData = self::addGoodsSpu($shopId, $params);
......@@ -1379,10 +1389,21 @@ class GoodsService
*/
public static function initShop($params = [])
{
//生活号信息
$url = config('interface', 'merchant.lifeaccount.get_life_account_by_id');
if (empty($url)) {
throw new InterfaceException(['cus' => 0]);
}
$lifeAccountRes = (new Request())->get($url, ["life_account_id" => $params["life_account_id"]]);
if (empty($lifeAccountRes["response"]["result"])) {
throw new GoodsException(['cus' => 29]);
}
$lifeAccount = [
"life_account_id" => $params["life_account_id"],
"merchant_id" => $params["merchant_id"],
"merchant_id" => $lifeAccountRes["response"]["result"]["merchant_id"],
];
return self::addShop($lifeAccount);
}
}
\ 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