'ID', 'mall_id' => 'Mall ID', 'before_setting' => 'Before Setting', 'created_at' => 'Created At', ]; } /** * 添加setting修改日志 * * @param Setting $setting * @return boolean */ public static function addSettingLog(Setting $setting) { // 修改前设置 $old_setting = $setting->oldAttributes; // 新增为空时不操作 if (empty($old_setting)) return true; // before_setting $before_setting = [ 'app_key' => $old_setting['app_key'], 'app_secret' => $old_setting['app_secret'], 'auto_update' => Json::decode($old_setting['auto_update']), 'sell' => Json::decode($old_setting['sell']), 'cost' => Json::decode($old_setting['cost']), 'original' => Json::decode($old_setting['original']), ]; $data = [ 'mall_id' => $old_setting['mall_id'], 'before_setting' => Json::encode($before_setting), ]; $model = new self(); return ($model->load($data, '') && $model->save()); } }