Commit 53137dad authored by luhongguang's avatar luhongguang

update:init_shop 接口

parent 9da2c37a
<?php
namespace Validate;
/**
* Class GoodsInitShopValidate
*
* @package Validate
*/
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
...@@ -13,6 +13,7 @@ use \Validate\GoodsListCValidate; ...@@ -13,6 +13,7 @@ use \Validate\GoodsListCValidate;
use \Validate\OrderGoodsValidate; use \Validate\OrderGoodsValidate;
use \Validate\GoodsOnlineOfflineValidate; use \Validate\GoodsOnlineOfflineValidate;
use \Validate\PaySuccessGoodsCallbackValidate; use \Validate\PaySuccessGoodsCallbackValidate;
use \Validate\GoodsInitShopValidate;
use \App\Services\goods\ElasticGoodService; use \App\Services\goods\ElasticGoodService;
...@@ -246,4 +247,16 @@ class GoodsController extends Base ...@@ -246,4 +247,16 @@ class GoodsController extends Base
$this->success(["result" => $res]); $this->success(["result" => $res]);
} }
/**
* 初始化 shop_id
* @throws \App\Exception\custom\GoodsException
*/
public function init_shopAction()
{
(new GoodsInitShopValidate())->validate();
$params = $this->params;
$shopId = GoodsService::initShop($params);
$this->success(["result" => ["shop_id" => $shopId]]);
}
} }
\ No newline at end of file
...@@ -1356,4 +1356,19 @@ class GoodsService ...@@ -1356,4 +1356,19 @@ class GoodsService
GoodsSkuPicRecord::save($data); GoodsSkuPicRecord::save($data);
} }
} }
/**
* 当前没有初始化shop的地方,单拎出来一个接口
* @param array $params
* @return mixed
* @throws GoodsException
*/
public static function initShop($params = [])
{
$lifeAccount = [
"life_account_id" => $params["life_account_id"],
"merchant_id" => $params["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