|
|
|
@ -180,29 +180,36 @@ class Merchant extends Controller |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function setMerchantGoodsCate(): Json{ |
|
|
|
|
$model = new MerchantGoodsCate; |
|
|
|
|
$merchantId = $this->merchantId; |
|
|
|
|
$detail = MerchantGoodsCate::detail($merchantId); |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
$data['merchant_id'] = $merchantId; |
|
|
|
|
|
|
|
|
|
if (empty($detail)) { |
|
|
|
|
if ($model->add($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$data['merchant_id'] = $detail['merchant_id']; |
|
|
|
|
if ($detail->edit($data)) { |
|
|
|
|
return $this->renderSuccess('操作成功'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $this->renderError($model->getError() ?: '操作失败'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getMerchantGoodsCate(): Json{ |
|
|
|
|
$merchantId = $this->merchantId; |
|
|
|
|
$merchant = MerchantGoodsCate::detail($merchantId); |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
//var_dump($merchant); |
|
|
|
|
|
|
|
|
|
return $this->renderSuccess(compact("merchant")); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function addMerchant(): Json |
|
|
|
|
{ |
|
|
|
|
$data = $this->postForm(); |
|
|
|
|
$data = json_decode($data); |
|
|
|
|
$Merchant = MerchantGoodsCate::where($this->storeId)->find()->toArray(); |
|
|
|
|
return $this->renderSuccess($Merchant); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|