'ID', 'mall_id' => 'Mall ID', 'source' => 'Source', 'source_id' => 'Source Id', 'goods_id' => 'Goods ID', 'is_enable' => 'Is Enable', 'status' => 'Status', 'created_at' => 'Created At', 'updated_at' => 'Updated At', ]; } /** * 保存设置 * @Author: lun * @DateTime: 2022/3/23 0023 14:26 * @Copyright: copyright (c) 2021 广东七件事集团 * @param $mall_id * @param $goods_id * @param $item * @return bool */ public static function setGoodsSetting($mall_id, $goods_id, $item) { try { $model = self::findOne(['mall_id' => $mall_id, 'goods_id' => $goods_id, 'source' => $item['source'], 'source_id' => $item['source_id'], 'status' => StatusEnum::ENABLED]); if (empty($model)) { $model = new self(); $model->mall_id = $mall_id; $model->goods_id = $goods_id; $model->loadDefaultValues(); } if (!$model->load($item, '') || !$model->save()) throw new Exception($model->getErrorMessage()); return $model; } catch (\Exception $e) { self::setStaticError('商品嗨购设置失败:' . $e->getMessage()); return false; } } }