$params['mall_id']], ['item_id' => $params['item_id']] ]); if (empty($model)) { $model = new WechatVideoShopGoodsSetting(); $model->mall_id = $params['mall_id']; $model->item_id = $params['item_id']; } $config = $data['config']; ksort($config); $model->is_enable = $data['is_enable']; $model->config = $config; if (!$model->save()) throw new \Exception($model->getErrorMessage()); return true; } catch (\Exception $e) { self::$static_error = $e->getMessage(); return false; } } /** * @return string */ public static function getErrorMessage() { return self::$static_error; } }