|
|
@@ -21,11 +21,13 @@ class PicController extends BaseController
|
|
|
$categoryId = isset($get['categoryId']) && is_numeric($get['categoryId']) ? $get['categoryId'] : -1;
|
|
|
if ($categoryId != -1) {
|
|
|
$where['categoryId'] = $get['categoryId'];
|
|
|
+ $list = PicCategoryService::getPicList($where);
|
|
|
+ } else {
|
|
|
+ $list = PicService::getPicList($where);
|
|
|
}
|
|
|
- $list = PicCategoryService::getPicList($where);
|
|
|
util::success($list);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//上传图片 shish 2019.12.7
|
|
|
public function actionAdd()
|
|
|
{
|
|
|
@@ -51,19 +53,27 @@ class PicController extends BaseController
|
|
|
}
|
|
|
$categoryIdList = isset($post['categoryIdList']) && !empty($post['categoryIdList']) ? $post['categoryIdList'] : [];
|
|
|
unset($post['categoryIdList']);
|
|
|
+ if (empty($categoryIdList)) {
|
|
|
+ util::fail('最少选择一个分类');
|
|
|
+ }
|
|
|
$merchantHas = CategoryService::getCategoryIdList($this->merchantId);
|
|
|
$diff = array_diff($categoryIdList, $merchantHas);
|
|
|
if (!empty($diff)) {
|
|
|
- util::fail('只能设置自己的分类');
|
|
|
+ util::fail('只能选择自己的分类');
|
|
|
}
|
|
|
$picList = PicService::getByIds($picIdList);
|
|
|
$add = [];
|
|
|
+ print_r($picIdList);
|
|
|
+ print_r($picList);
|
|
|
foreach ($picList as $picKey => $picVal) {
|
|
|
if ($picVal['merchantId'] != $this->merchantId) {
|
|
|
util::fail('只能设置自己的图片');
|
|
|
}
|
|
|
$currentId = $picVal['id'];
|
|
|
PicService::updateById($currentId, $post);
|
|
|
+ echo $currentId;
|
|
|
+ print_r($post);
|
|
|
+ die;
|
|
|
foreach ($categoryIdList as $categoryId) {
|
|
|
$add[] = ['categoryId' => $categoryId, 'picId' => $currentId, 'merchantId' => $this->merchantId];
|
|
|
}
|